It is easy to indent a whole line.
Just highlight the whole line and press Tab
Go to the start of the line and press Tab
Click anywhere in the line and press Ctrl + ]
Now the problem is how to insert indent in the middle of the line.
And also, how to indent at the end of the line.
Example usage scenario:
# Hyperparameters
LENGTH = 10 # length of foo
TEMP = 20 # temperature of bar
IV = 99.99 # induction variability of foo bar
Concretely, we want:
# Hyperparameters
LENGTH = 10 # length of foo
TEMP = 20 # temperature of bar
IV = 99.99 # induction variability of foo bar
Or even better (in some cases):
# Hyperparameters
LENGTH = 10 # length of foo
TEMP = 20 # temperature of bar
IV = 99.99 # induction variability of foo bar
- Note that by pressing the Tab button however, we are actually calling auto-complete instead of indenting.
- Of course we can always manual align them by using spacebar, but then we will have to do this every time we tune the hyperparameters.
So, how to indent instead of auto-completing in Jupyter?
P.S. Yes, I am aware of print("\t"), copying the output and pasting the indent. But that is not desirable.
One alternative would be to use the Alt keyboard sequence.
In this case it would be
Alt + 09
. It is about as short as one could hope for.For this to work you need a numpad on your keyboard, as the top row of numbers on the keyboard does not work to produce Alt keyboard sequences.
However, this does leave rather ugly arrows in place of the tab, which seems to be the way Jupyter Notebooks displays tab characters.