/handy-vscode

Work-in-progress handy mode for VSCode

Primary LanguageTypeScriptMIT LicenseMIT

handy-vscode

This is a work-in-progress extension to implement the handy mode for VS Code.

Handy offers levels of keyboard bindings to incorporate them progressively. At the moment we have a small subset of commands described in the following sections.

You can change this level in your user settings handy-vscode level ("handy-vscode.level": 7 by default).

Level 1 - JLIK

Character and line movements with Alt+JLIK keys.

      .-----.
      |  I  |
.-----'     '-----.
|  J     K     L  |
'-----------------'

This set of keys simulate the arrow keys of any keyboard but they are located in the home row mainly (JKL) so you don't have to move your hand to move the cursor:

  • Alt+J: Just like Left arrow key, moves the cursor one character to the left (cursorLeft)
  • Alt+L: Just like Right arrow key, moves the cursor one character to the left (cursorRight)
  • Alt+I: Just like Up arrow key, moves the cursor to the previous line (cursorUp)
  • Alt+K: Just like Down arrow key, moves the cursor to the next line (cursorDown)

And with the Shift modifier:

  • Shift+Alt+J: Jumps the balanced expression at the left (handy-vscode.cursorExprLeft)
  • Shift+Alt+L: Jumps the balanced expression at the right (handy-vscode.cursorExprRight)
  • Shift+Alt+I: Just like Page Up key, jumps to the previous page (cursorPageUp)
  • Shift+Alt+K: Just like Page Down key, jumps to the next page (cursorPageDown)

TODO: Jumping between string limits ("...") is not supported yet.

Balanced Expression

What is a balanced expression? It can be anything that is balanced in the actual programming language. For example, on mathematical expression, it should jump between (...)

x= ( (a+2)  * y -  (5*z) )
    ^-----^       ^-----^
  ^----------------------^

On programming languages it should jump between balanced strings limits "...", scopes {...}, array indexer [...], etc. When none of these characters are found, it should move just through words.

Level 2 - NM

Prefix for commands with Alt+M and cancel action with Alt+N.

            .-----.
            |     |
      .-----'     '-----.
      |                 |
.-----'-----------------'
|  N     M  |
'-----------'
  • Alt+N: Cancels the active selection or other commands.
  • Alt+M ...: Prefix key for other key shortcuts, similar to Ctrl+K ....
  • Alt+M S: Saves the active file (workbench.action.files.save).
  • Alt+M Alt+S: Saves all files (workbench.action.files.saveAll).
  • Alt+M Alt+F: Quick open a file, just like Ctrl+P (workbench.action.quickOpen).
  • Alt+M Alt+G: Find text in files (workbench.action.findInFiles).

Level 3 - UO

Words movement with Alt+U and Alt+O keys.

      .-----.-----.-----.
      |  U  |     |  O  |
      |-----'     '-----|
      |                 |
.-----'-----------------'
|           |
'-----------'
  • Alt+U: Jumps the word at the left (cursorWordLeft)

  • Alt+O: Jumps the word at the right (cursorWordRight)

  • Shift+Alt+U: TODO Not available yet.

  • Shift+Alt+O: TODO Not available yet.

Level 4 - ZB

Enables Alt+ZXCVB and Alt+Spacebar.

                                    .-----.-----.-----.
                                    |     |     |     |
                                    |-----'     '-----|
                                    |                 |
.-----------------------------.-----'-----------------'
|  Z     X     C     V     B  |           |
'-----------.                 '-----------|
            |             SPC             |
            '-----------------------------'
  • Alt+Z: Undoes the last action, just like pressing Ctrl+Z (undo)
  • Alt+X: Cuts the selection, like Ctrl+X (editor.action.clipboardCutAction)
  • Alt+C: Copies the selection, like Ctrl+C (editor.action.clipboardCopyAction)
  • Alt+V: Pastes the clipboard content, like Ctrl+V (editor.action.clipboardPasteAction)
  • Alt+B: Opens other editors, like Ctrl+K Ctrl+P (workbench.action.showAllEditors).

Level 5

Enables Alt+YH keys.

                              .-----.-----.-----.-----.
                              |  Y  |     |     |     |
                              |     |-----'     '-----|
                              |  H  |                 |
.-----------------------------|-----'-----------------'
|                             |           |
'-----------.                 '-----------|
            |                             |
            '-----------------------------'
  • Alt+Y: Finds text or goes to the next match (actions.find or editor.action.nextMatchFindAction).

  • Alt+H: Goes to the beginning of line (cursorHome).

  • Shift+Alt+Y: Finds text or goes to the previous match (actions.find or editor.action.previousMatchFindAction).

  • Shift+Alt+H: Goes to the end of line (cursorEnd).

Level 6 - WERD

Keys to delete characters and words.

      .-----------------.     .-----.-----.-----.-----.
      |  W     E     R  |     |     |     |     |     |
      '-----.           '-----|     |-----'     '-----|
            |  D     F     G  |     |                 |
.-----------'-----------------|-----'-----------------'
|                             |           |
'-----------.                 '-----------|
            |                             |
            '-----------------------------'
  • Alt+W: TODO Not available yet.
  • Alt+E: Deletes the word at the left side (deleteWordLeft).
  • Alt+R: Deletes the word at the right side (deleteWordRight).
  • Alt+D: Just like pressing the Backspace key to delete the character at the left (deleteLeft).
  • Alt+F: Just like pressing the Delete key to delete the character at the right (deleteRight).
  • Alt+G: TODO Not available yet.

Level 7

TODO Not available yet.