pms
pms

Reputation: 4626

Cursor placed at the very beginning of the line instead of the place where I left it

I don't understand why sometimes in Sublime Text 3 the cursor is placed at the very beginning of the line, instead of the place where I left it. I illustrate it below:

1) I start a new line, the cursor is in line with other commands, i.e., where it should be

Step 1

2) Before starting to write in that line, for whatever reason, I move to some other line and I start a new line there:

Step 2

3) Then I move back to the line from 1) but the cursor is placed at the very beginning of the line, instead of the place where I left it in 1)

Step 3

Is this the desired behavior? Personally, it's annoying to me. I've tried to change it, but I cannot find any solution in the documentation nor Google. I'm under Max OS, have "auto_indent": true and rather standard settings in ST3.

Upvotes: 0

Views: 38

Answers (1)

MattDMo
MattDMo

Reputation: 102852

Add the following to your user preferences (Sublime Text -> Preferences -> Settings-User):

"trim_automatic_white_space": false

The default true value gets rid of any auto-indentation whitespace when the cursor is moved off the line. In languages like Python where whitespace is important, the interpreter (maybe) and linters (definitely) might complain if you end up not putting anything on a line except whitespace. However, Sublime has an option for that, too! Setting the following:

"trim_trailing_white_space_on_save": true

will get rid of any whitespace between the last non-whitespace character and the newline, and all whitespace on a line containing nothing else when you save the file. That setting has saved me lots of PEP8 warnings.

Upvotes: 1

Related Questions