ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Keyboard​Navigation

by robertcollier4 ST2/ST3

Navigate fast between contiguous boundaries. Keyboard movement and selection and deletion to custom delimeters. For SublimeText ST2 ST3

Details

Installs

  • Total 617
  • Win 453
  • OS X 79
  • Linux 85
Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4
Windows 0 1 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 1 1 0 0 1 0 1 0 1 0 0 1 0 0 0 0 0 0 0 1 1
OS X 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 0 0 0 0 0 0 0 0
Linux 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 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

KeyboardNavigation

Keyboard movement and selection and deletion to beginning of word and custom delimeters. Navigate fast between contiguous boundaries via visual inspection. For SublimeText ST2 ST3.

You always move to the beginning of places instead of non-deterministic (*beginning of of contiguous boundaries demarcated by whitespace). In the following sample you move to the delineated places. After you are at the beginning you move around from the beginning.

|sample |text |thisisthebeginning |, |233434343

Therefore you know via visual inspection how many keystrokes to go to where you want to go. (preplanning of keystrokes).

This can be seen as analagous to mode in vim of move word to word of “w” and “b” and “W” and “B”. But this expands it to arrow keys and extends it to all functions such as delete and backspace as well.

Package Installation

  • Manual method: Download ZIP from github. Extract the files to Sublime_Data_Dir\Packages\KeyboardNavigation
  • Automatic method: Install 'KeyboardNavigation' from Package Control.

Key Bindings Explanation

Recommended Keybindings: * ctrl+left move cursor to *beginning of next contiguous boundary demarcated by whitespace * ctrl+right move cursor to *beginning of previous contiguous boundary demarcated by whitespace * alt+left move cursor to *beginning of previous subword boundary delineated by symbols * alt+right move cursor to *beginning of next subword boundary delineated by symbols * home move cursor to beginning of line limit (goes all the way to the beginning whereas the native one goes to beginning of indentation) * end move cursor to end of line limit * ctrl+shift+left select to *beginning of next contiguous boundary demarcated by whitespace * ctrl+shift+right select to *beginning of previous contiguous boundary demarcated by whitespace * alt+shift+left select to *beginning of previous subword boundary delineated by symbols * alt+shift+right select to *beginning of next subword boundary delineated by symbols * shift+home select to beginning of line (goes all the way to the beginning whereas the native one goes to beginning of indentation) * shift+end select to end of line * ctrl+shift+w expand selection to whitespace * ctrl+shift+e expand selection to symbols * ctrl+shift+q expand selection to quotes “, ' * ctrl+shift+b expand selection to brackets (, ), <, >, [, ], {, } * ctrl+shift+l select line with linebreak * ctrl+alt+shift+l select line without linebreak and prepending tab * ctrl+backspace delete(backspace) to *beginning of previous contiguous boundary demarcated by whitespace * ctrl+delete delete to next contiguous boundary demarcated by whitespace * alt+backspace delete(backspace) to previous subword boundary delineated by symbols * alt+delete delete to next subword boundary delineated by symbols * ctrl+o delete line with linebreak * ctrl+alt+o delete line without linebreak * ctrl+shift+c copy full lines * ctrl+shift+x cut full lines * ctrl+v paste (differs from innate in that does not put a newline above when copy used from nonselection line) * ctrl+alt+v paste on the line above (with a newline if not already one on the clipboard) * ctrl+alt+down swap line down with up (native) * ctrl+alt+up swap line up with down (native) * ctrl+d duplicate line above (instead of below like innate one) * ctrl+alt+left blank line above * ctrl+alt+right blank line below * ctrl+alt+- indent less (to the left) * ctrl+alt+= indent more (to the right) (even works with blank line which the native one does not)

Key Bindings Configuration

Since these are redefining / replacing your very basic navigational keys, the package does not automatically overwrite your existing key bindings. You must choose to add the keybindings yourself specific to your OS.

For Windows, you can use the recommended keybindings by adding the following lines to Sublime_Data_Dir\Packages\User\Default (Windows).sublime-keymap

{ "keys": ["ctrl+left"], "command": "move_to_beg_of_contig_boundary", "args": {"forward": false} },
{ "keys": ["ctrl+right"], "command": "move_to_beg_of_contig_boundary", "args": {"forward": true} },
{ "keys": ["alt+left"], "command": "move_to_beg_of_subword_boundary", "args": {"forward": false} },
{ "keys": ["alt+right"], "command": "move_to_beg_of_subword_boundary", "args": {"forward": true} },

{ "keys": ["home"], "command": "kn_linelimit", "args": {"forward": false} },
{ "keys": ["end"], "command": "kn_linelimit", "args": {"forward": true} },

{ "keys": ["ctrl+shift+left"], "command": "select_to_beg_of_contig_boundary", "args": {"forward": false} },
{ "keys": ["ctrl+shift+right"], "command": "select_to_beg_of_contig_boundary", "args": {"forward": true} },
{ "keys": ["alt+shift+left"], "command": "select_to_beg_of_subword_boundary", "args": {"forward": false} },
{ "keys": ["alt+shift+right"], "command": "select_to_beg_of_subword_boundary", "args": {"forward": true} },

{ "keys": ["shift+home"], "command": "select_to_kn_linelimit", "args": {"forward": false} },
{ "keys": ["shift+end"], "command": "select_to_kn_linelimit", "args": {"forward": true} },

{ "keys": ["ctrl+shift+w"], "command": "expand_selection_to_whitespace" },
{ "keys": ["ctrl+shift+e"], "command": "expand_selection_to_delims" },
{ "keys": ["ctrl+shift+q"], "command": "expand_selection_to_quotes"},
{ "keys": ["ctrl+shift+b"], "command": "expand_selection_to_brackets"},
{ "keys": ["ctrl+shift+l"], "command": "select_line" },
{ "keys": ["ctrl+alt+shift+l"], "command": "select_line_wo_linebreak" },

{ "keys": ["ctrl+backspace"], "command": "delete_to_beg_of_contig_boundary", "args": {"forward": false} },
{ "keys": ["ctrl+delete"], "command": "delete_to_beg_of_contig_boundary", "args": {"forward": true} },
{ "keys": ["alt+backspace"], "command": "delete_to_beg_of_subword_boundary", "args": {"forward": false} },
{ "keys": ["alt+delete"], "command": "delete_to_beg_of_subword_boundary", "args": {"forward": true} },

{ "keys": ["ctrl+o"], "command": "delete_line" },
{ "keys": ["ctrl+alt+o"], "command": "delete_line_wo_linebreak" },

{ "keys": ["ctrl+shift+c"], "command": "copy_fulllines" },
{ "keys": ["ctrl+shift+x"], "command": "cut_fulllines" },
{ "keys": ["ctrl+v"], "command": "kn_paste" },
{ "keys": ["ctrl+alt+v"], "command": "paste_above_lines" },

{ "keys": ["ctrl+alt+up"], "command": "swap_line_up" },
{ "keys": ["ctrl+alt+down"], "command": "swap_line_down" },
{ "keys": ["ctrl+d"], "command": "kn_duplicate_line" },
{ "keys": ["ctrl+alt+left"], "command": "blankline_add", "args": {"forward": false} },
{ "keys": ["ctrl+alt+right"], "command": "blankline_add", "args": {"forward": true} },

{ "keys": ["ctrl+alt+-"], "command": "kn_indent", "args": {"forward": false} },
{ "keys": ["ctrl+alt+="], "command": "kn_indent", "args": {"forward": true} }

How this compares with vim

Vim has this concept in a cryptic structure of "w” and “b” keys.

For a paradigm of where this is implemented in vim see “w” and “b” movement in vim. Each time the beginning of a word is moved to. There is also capital “W” and “B” for subwords. KeyboardNavigation brings this to you in the form of arrow keys.

https://docs.oracle.com/cd/E19683-01/806-7612/6jgfmsvqf/index.html - Scroll to section “Moving One Word”.
https://stackoverflow.com/questions/22931032/vim-word-vs-word See definition of word vs WORD
https://www.computerhope.com/unix/vim.htm - Scroll to section “Moving From Word To Word”
https://vim.rtorr.com/ - See definition of “w” , “W” , “b” , “B”
https://forum.sublimetext.com/t/change-cursor-position-at-beginning-of-next-word-when-moving/21474 - This concept is described here

Using the arrow keys is much more thought out. And using it with Ctrl and Alt is a way to make it accessible to the hand in a way which is spatially oriented. We know that we want to move to the word next and we want to move to the beginning so we know where we will go. Vim allows you to do this but with keys that are spaced far apart and not spatially oriented. Sublime has a way with KeyboardNavigation.

KeyboardNavigation allows contiguous boundary movement like vim's concept of “w” and “b” fastly through arrow keys that make sense and are thought out.