Home Download Buy Blog Forum Support

Some ideas for code navigation

Some ideas for code navigation

Postby Nisto on Thu Mar 28, 2013 3:06 pm

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..
Nisto
 
Posts: 6
Joined: Thu Mar 28, 2013 2:29 pm

Re: Some ideas for code navigation

Postby bizoo on Thu Mar 28, 2013 3:27 pm

Nisto wrote: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?

Code: Select all
   "trim_trailing_white_space_on_save": true,
   "trim_automatic_white_space": true,

Nisto wrote: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..

Wonder which one :?:
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.
bizoo
 
Posts: 889
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Some ideas for code navigation

Postby planet on Thu Mar 28, 2013 3:39 pm

Nisto wrote: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..

Just checked it, ST3 has this behaviour (I think it's OS X default)...
planet
 
Posts: 25
Joined: Fri Feb 17, 2012 12:30 pm

Re: Some ideas for code navigation

Postby Nisto on Thu Mar 28, 2013 3:45 pm

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...
Nisto
 
Posts: 6
Joined: Thu Mar 28, 2013 2:29 pm

Re: Some ideas for code navigation

Postby bizoo on Thu Mar 28, 2013 3:58 pm

planet wrote:Just checked it, ST3 has this behaviour (I think it's OS X default)...

Don't work like this on Windows 7.

Nisto wrote: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...

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.
bizoo
 
Posts: 889
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Some ideas for code navigation

Postby Nisto on Thu Mar 28, 2013 5:25 pm

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.
Nisto
 
Posts: 6
Joined: Thu Mar 28, 2013 2:29 pm

Re: Some ideas for code navigation

Postby robertcollier4 on Thu Mar 28, 2013 9:38 pm

https://github.com/SublimeText/TrailingSpaces

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" }
robertcollier4
 
Posts: 154
Joined: Sun Feb 24, 2013 5:37 pm

Re: Some ideas for code navigation

Postby Nisto on Fri Mar 29, 2013 11:28 am

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


Code: Select all
    // 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! :)
Nisto
 
Posts: 6
Joined: Thu Mar 28, 2013 2:29 pm


Return to Ideas and Feature Requests

Who is online

Users browsing this forum: DoTheEvo and 5 guests