Sublime Forum

Some ideas for code navigation

#1

I have two “features” I’d love to see implemented in ST.

The first is one I really miss after coming from the old editor I used: when you’re on an indented line and then jump to/create a new line, the spaces/tabs from the indented line (i.e. the previous line the caret was on) are stripped, if it was left empty (the actual line is kept of course). And hopefully this would be something that could be changed in the settings, in case there’s people who maybe wouldn’t want it?

The other one is pretty simple (hopefully to implement as well): when you’re on the first line of a document and you navigate “up”, the caret should go to the beginning of the line, and when you navigate “down” while on the last line, the caret should go to the end of the line. Most editors should support this by now really…

0 Likes

#2

"trim_trailing_white_space_on_save": true, "trim_automatic_white_space": true,

Wonder which one :question:
Tried in 4 different editor and none works like this (at least by default).
And it’s not something I personally want.
I suppose it could be possible with a plugin.

0 Likes

#3

[quote=“Nisto”]
The other one is pretty simple (hopefully to implement as well): when you’re on the first line of a document and you navigate “up”, the caret should go to the beginning of the line, and when you navigate “down” while on the last line, the caret should go to the end of the line. Most editors should support this by now really…[/quote]

Just checked it, ST3 has this behaviour (I think it’s OS X default)…

0 Likes

#4

Cool, thanks planet.

bizoo: Notepad++ is one editor that supports that. Also, I’ve set those two settings to true already, but it doesn’t work… is it a bug or does it do something completely different? Was I not clear when explaining? It doesn’t seem to strip any whitespace.

EDIT: okay, it does strip whitespace of the previous line, but only if you create a new (empty!) line (i.e. not if you simply move to an already existent line) and if that line is automatically indented as well…

0 Likes

#5

[quote=“planet”]
Just checked it, ST3 has this behaviour (I think it’s OS X default)…[/quote]

Don’t work like this on Windows 7.

This is the behavior of the trim_automatic_white_space settings.

trim_trailing_white_space_on_save settings should remove all trailing space of all lines in the file when you **save **it.

0 Likes

#6

Couldn’t a setting for “trim_white_space” be implemented? Maybe that way you could even merge the trim_automatic_white_space and trim_Trailing_white_space_on_save settings? Proposition: a string setting with the alternatives: “automatic”, “save”, “default” (which would be the same as the previous two activated), and one for “line_switch” or something.

0 Likes

#7

github.com/SublimeText/TrailingSpaces

[quote]The main feature you gain from using this plugin is that of deleting all trailing spaces in the currently edited document. In order to use this deletion feature, you may either:

click on “Edit / Trailing Spaces / Delete”;
bind the deletion command to a keyboard shortcut:
To add a key binding, open “Preferences / Key Bindings - User” and add:

{ “keys”: “ctrl+shift+t”], “command”: “delete_trailing_spaces” }[/quote]

0 Likes

#8

Woah, turns out I missed the setting for up/down on first/last line:

// This controls what happens when pressing up or down when on the first // or last line. // On OS X, this value is overridden in the platform specific settings, so // you'll need to place this line in your user settings to override it. "move_to_limit_on_up_down": false,

One down! :smile:

0 Likes