Adds commands from Sublime Text to VS Code: Transpose, Expand Selection to Line, Split into Lines, Join Lines
MIT License
Adds commands from Sublime Text to VS Code: Transpose, Expand Selection to Line, Split into Lines, Join Lines.
By default, sublime-commands doesn't add any shortcuts. You should add them to keybinding.json
yourself; mine are:
{"key": "ctrl+t", "command": "extension.transpose", "when": "editorFocus"},
{"key": "cmd+l", "command": "extension.expandToLine", "when": "editorFocus"},
{"key": "shift+cmd+l", "command": "extension.splitIntoLines", "when": "editorFocus"},
{"key": "cmd+j", "command": "extension.joinLines", "when": "editorFocus"},
extension.transpose
will, if all selections are empty (i.e. if you have one or more cursors and no selections), behave like ^t
in macOS/emacs: for each cursor, swap the character before the cursor with the character after cursor, and move the cursor after both characters.
extension.transpose
will, otherwise (i.e. if some selections aren't empty), transpose the selections, putting the contents of the first selection into the second, the second into the third, etc, and the last into the first. If there's only one selection, nothing will happen.extension.expandToLine
will expand all cursors/selections to the entire line (including the ending \n
). Note that this puts the end of the selection on the next line, so repeated use will expand the selection downward.extension.splitIntoLines
will split a selection into lines, not including the linebreak. If every selection is already single-line, nothing happens. If a selection ends with a linebreak, the next line will not be included.extension.joinLines
will, for all selected lines, replace the linebreak and surrounding whitespace with a single space. If a selection is empty (it's just a cursor), the cursor will be moved to right after the space.