jupyter new-line auto format when cursor between parentheses - jupyter-notebook

When I have my cursor within a set of parentheses in a jupyter notebook and press return, I just get a new line as below, which forces me to go back to the previous line, and hit return again to keep typing:
In other editors like vscode, I get a nice auto-formatted new line with indentation, like this:
Is there a way to get jupyter new line auto formatting like vscode?

Related

How to get console cursor back to the begining of line in R?

Sometimes I perform long lasting calculations in the loop. To get control of the progress I print current value of the loop variable. However it makes my console flooded with numbers.
I would like to move back cursor to the begining of console line after each printing. This would end with the last value of the variable only. That would be similar to command without on line printer.
Any idea on how to achieve that in R console?
as b2f correctly mentions in the comment use \r as in the example below
cat('hello world\rMinor')
Minor world
One thing to note though is that every command is assigned a new line in an interactive setting, so in interactive code this only works as part of a single command.

Jupyter notebook tab or space indentation error

# Convert string column to float
def str_column_to_float(dataset, column):
for row in dataset:
row[column] = float(row[column].strip())
print(row[column])
Am trying to create a above function in python using jupyter notebook. But am getting error like below:
File "<ipython-input-5-b591f37367db>", line 5
print(row[column])
^
TabError: inconsistent use of tabs and spaces in indentation
Can anyone help me to fix this?
Make sure the spaces and indentations are proper. The code you have entered should look something like this:

How to make R script jump to the next line?

The last line of my script creates a table
write.xlsx(res, file="C:/Users/salahmed/Desktop/test/res6.xlsx", row.names=FALSE);
But after I run the whole script, the cursor remains stuck at the end of this line and the table is not created. It moves to the next line (with the > symbol) only if I press Enter and only then the table is created in the folder. How do I make it automatically move to the next line without having to press Enter?
As mentioned in the comments, the problem was solved by adding a blank line at the end of the script.

Text writes over itself instead of creating a new line in R session

I am running an R session on the Unix cluster, and whenever I reach a certain amount of characters, instead of starting on the new line, the text starts to write over itself at the beginning. So, for example, it should look like this:
foo <- read.table("/file/buried/deep/within/lots/of/folders/makes/for/a
/long/name.txt")
but instead it looks like this:
ame.txt")read.table("/file/buried/deep/within/lots/of/folders/makes/for/a/long/na
because the text is wrapping around and starting again at the beginning of the line.
I've changed my width parameter in the options() function, but no such luck.
ETA: I am running R on the command line in a Unix environment

Terminal of unix can be without square brackets

Can i make look like root#arch$.
Instead if [root#arch~],
I don't like square braces.
Help me if you know i want to remove square[] bracess.
The prompt you're talking about is named PS1, and you can customise its appearance in your .bashrc file.
So edit that file and add something like the following:
PS1="\\u#\\h:\\w"
The next time you log in you should have your new appearance.
PS1="\[\e[1;31m\]\u\[\e[0;15m\]#\\h \\w "
Insert the above code in '~/.bashrc' file, whenever you open a terminal '~/.bashrc' file will be executed hence you get custom prompt.
Tinker with numbers above to get desired colors.

Resources