A Sublime Text 2 plugin extension to the move command
A new command is added, "move_by_paragraph"
. These "args"
are accepted:
"forward"
(bool): True if this moves down the page"extend"
(bool): True if this should create a selectionignore_blank_lines
(bool): Set to true to ignore lines with nothing but whitespace (excluding newline) as text for paragraph boundaries. Defaults to true.stop_at_paragraph_begin
(bool): Set to true to stop the cursor at the beginning of paragraphs. Defaults to truestop_at_paragraph_end
(bool): Set to true to stop the cursor at the end of paragraphs. Defaults to false. Bothstop_at_paragraph_begin
andstop_at_paragraph_end
can be set at the same time.
Example (add this to your keymap):
{"keys": ["ctrl+up"], "command": "move_by_paragraph", "args": {"forward": false}},
{"keys": ["ctrl+down"], "command": "move_by_paragraph", "args": {"forward": true}},
Example with selection (add this to your keymap):
{"keys": ["ctrl+shift+up"], "command": "move_by_paragraph", "args": {"forward": false, "extend": true}},
{"keys": ["ctrl+shift+down"], "command": "move_by_paragraph", "args": {"forward": true, "extend": true}},
Note that "ctrl+shift+up/down"
will overwrite the default action of moving
the current selection up or down, which is why this is not set by default.
Personally, I remapped that behaviour to "ctrl+t"
and "ctrl+g"
.