When I have an indented block of text in Sublime Text, and empty lines below it, pressing tab will indent up to the level of that block.
This still surprises me every time it happens, so I'd like to turn it off. I would like to manually indent an empty line up to the desired level. Currently, I will often have to hit tab once, then hit backspace some number of times, depending on how deeply nested the preceding method ended up.
So far, I've tried setting auto_indent
to false
. This does stop the behavior... along with everything else related to automatic indentation. I want something more targeted.
I've also tried setting smart_indent
to false
. This has no effect in the cases I've tried so far; it still indents multiple tab stops.
Trying to put together an example case. Quality of the code isn't important, only the geometry.
class MyAwesomeClass:
def my_okay_method(self):
print(self) # point A
# point B
Pretend the comments aren't there, they're just for reference.
If I wanted to add to the behavior of my_okay_method, I would position my cursor at the end of the line at point A, and press the 'enter' key. I would expect my cursor to end up on the next, newly added line, which should be indented by 8 spaces. EDIT FOR CLARITY: Note that this behavior stems from trim_automatic_white_space
and auto_indent
having their default value of true
. If you press 'enter' and, for some reason, your cursor doesn't end up indented, something weird is happening.
If I want to add a new method to MyAwesomeClass, I would position my cursor before point B, add some blank lines, and press 'tab', on the empty line two lines below point A. I would like that blank line to be indented by the default tabstop (which is usually 4 spaces), rather than far enough to the right that it's in the scope of my_okay_method. (This gets really aggravating when loops or conditionals are involved, because it goes into the last one in the method.)