Like 'Go to Line/Column' but relative instead of absolute; vaguely vim-like cursor-relative line jumping through the Command Pallette.
Inspiration was taken from the built-in 'Go to Line/Column' (workbench.action.gotoLine
) command for the interface and feedback, as well as EnkelDigital and JJ Lee's relativity extension for the general behavior.
Provides the following commands;
Action | Keybinding | Command |
---|---|---|
Relative Motion: Navigate Up | alt+k | vscode-relative-motion.up |
Relative Motion: Navigate Down | alt+j | vscode-relative-motion.down |
The Command Pallette will then accept input in the form;
Input | Operation |
---|---|
2 |
Moves up/down 2 rows |
4#3 |
Moves up/down 4 rows, moves to column 3 |
6:5 |
Moves up/down 6 rows, moves to column 5 |
8,7 |
Moves up/down 8 rows, moves to column 7 |
relativeMotion.previewRelativeLineNumbers
: Render relative line numbers when previewing Relative Motion's navigation.
-
previewRelativeLineNumbers
interacts poorly with the"editor.lineNumbers" = "interval"
.tl;dr - if the active editor is rendering
"interval"
line numbers,previewRelativeLineNumbers
is ignored.
This is becausevscode.window.activeTextEditor.options.lineNumbers
doesn't understand theinterval
configuration, the below sequence;const previousSetting = vscode.window.activeTextEditor.options.lineNumbers; vscode.window.activeTextEditor.options.lineNumbers = TextEditorLineNumbersStyle.Relative; vscode.window.activeTextEditor.options.lineNumbers = previousSetting;
will result in line numbers being rendered as
"on"
rather than"interval"
.
See VSCode #198787. -
Multi-cursor support.
'Go to Line/Column' doesn't bother moving multiple cursors. Should Relative Motion?
If you find something wrong with this extension or have a feature request, please open an issue with a detailed description and, if applicable, minimal reproduction case.
Proof-of-Concept commands thunked into an official home!