GotoEndOfLineOrScope
Sublime Text plugin to bind a key (for example the end key) to move/extend the cursor/selection(s) to the end of the line, or to before the specified scope (i.e. a comment) at the end of the line
Details
Installs
- Total 640
- Win 339
- Mac 153
- Linux 148
Dec 22 | Dec 21 | Dec 20 | Dec 19 | Dec 18 | Dec 17 | Dec 16 | Dec 15 | Dec 14 | Dec 13 | Dec 12 | Dec 11 | Dec 10 | Dec 9 | Dec 8 | Dec 7 | Dec 6 | Dec 5 | Dec 4 | Dec 3 | Dec 2 | Dec 1 | Nov 30 | Nov 29 | Nov 28 | Nov 27 | Nov 26 | Nov 25 | Nov 24 | Nov 23 | Nov 22 | Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
GoToEndOfLineOrScope
Sublime Text plugin to move the cursor(s) to the end of the line, or to before the specified scope at the end of the line.
Features
This plugin allows you to create key bindings that will:
- Go to the end of the line, or
- Go to the start of the specified scope that is at the end of the line
- Go to the start of the closest token to the end of the line that matches the specified scope
To explain:
You have a line like: foo bar # I am a comment
You want to bind the End key, so that when you press it, the cursor will either go to the end of the line or to just before the start of the comment marker, depending where the cursor is and your preferences.
i.e. foo bar |# I am a comment
, foo bar| # I am a comment
or foo bar # I am a comment|
where |
represents the cursor.
It works with multiple cursors, and each key binding can use a different scope, and a different order. For example, you might want the cursor to go to the start of the comment after any whitespace, then to the end of the line. Or you might want the cursor to go to the end of the line, then to the start of the comment before any whitespace. At the same time, you might want a different key binding to jump the cursor to just before the semi-colon at the end of the line.
Binding
The command is called move_to_end_of_line_or_before_specified_scope
, and it accepts the following arguments:
- scope
- the scope to move the cursor before, if it is at the end of the line
- extend
- whether or not to extend the selection
- eol_first
- whether or not the cursor should go to the end of the line first or the beginning of the specified scope. Note that with word wrapped lines, as this plugin emulates the default End key behavior of going to hard EOL when at a soft EOL, setting this argument to true
with word wrap enabled will make the command act like the default move_to { "to": "eol" }
command. Suggestions for how to improve this behavior is welcome. For now, you can use auto
which is equivalent to true
if word_wrap
is off or the line is unwrapped, and false
if word_wrap
is enabled. This is perhaps not ideal because the cursor location isn't consistent, hence the request for suggestions. Going to EOL first is the preferred default because it is easier for muscle memory to press it twice to get to the start of a comment than to press it once, expecting to be at EOL and finding oneself at a comment. It may be useful to get into the habit of pressing Ctrl+Enter instead of End followed by Enter to get a new line below the current one, then perhaps a more sane default would be false
…
- before_whitespace
- whether or not the cursor should go to the beginning of any whitespace that occurs immediately before the specified scope
- find_only_at_eol
- whether or not to search backwards from the end of the line to find the given scope. If true
, just checks at EOL.