Code Flow

December 14, 2021 ยท View on GitHub

Code Flow

A VS Code Extension for Productivity Junkies

Code Flow is an extension that aims to improve a default set of keybindings with a keyboard-centric workflow. The shortcuts here were elaborated to provide a better editing experience with mnemonics and consistent conventions.

Shortcuts

The shortcuts here presented use some kind a mnemonic device to improve command usage and discovery. Although the main goal is to provide a more productive shortcut scheme, the extension tries to stay as close as possible to the overall editing experience in VS Code, trying to not drastically change important editing commands... For instance, we avoid poluting commands in the global scope (Ctrl, Alt & Shift) and the rebinds that are done are thought out to improve on the standard shortcuts. For the most part we try to stay consistant with the current editing experience but expanding a little bit more on top of it.

Most of the new commands/ chords will be located in a specific scope like:

  • K as in - Workbench navigation
  • B as in - Buffer (text editor) and panels
  • T as in - Text Transformations
  • L as in - Line movement and editing
  • G as in - Go somewhere in the file

Workbench Navigation

ShortcutCommand
Ctrl + K Ctrl + EToggle Explorer
Ctrl + K Ctrl + FToggle Find (Search)
Ctrl + K Ctrl + DToggle Debugger
Ctrl + K Ctrl + GToggle Git
Ctrl + K Ctrl + SToggle Sidebar
Ctrl + K Ctrl + RToggle Remote Explorer
Ctrl + K Ctrl + BToggle Buffer (Text Editor)
Ctrl + K Ctrl + TToggle Terminal
Ctrl + K Ctrl + MToggle Minimap

File Explorer Commands

ShortcutCommand
Ctrl + NNew File
Ctrl + Shift + NNew Folder

Buffer Commands

ShortcutCommand
Ctrl + B Ctrl + WClose Buffer
Ctrl + B Ctrl + NSplit (New) Buffer
Ctrl + B Ctrl + POpen Preview Buffer
Ctrl + B Ctrl + -Split Buffer Horizontaly
Ctrl + B Ctrl + =Split Buffer Orthogonaly
Ctrl + B RightMove To Right Buffer
Ctrl + B LeftMove To Left Buffer
Ctrl + B UpMove To Top Buffer
Ctrl + B DownMove To Bottom Buffer
Ctrl + B Ctrl + RightMove Buffer Right
Ctrl + B Ctrl + LeftMove Buffer Left
Ctrl + B Ctrl + UpMove Buffer Top
Ctrl + B Ctrl + DownMove Buffer Bottom
Ctrl + B Ctrl + AShow All Editors
Ctrl + B Ctrl + GShow Editors In Active Group
Ctrl + B Ctrl + RReopen Last Closed

Content Manipulation

ShortcutCommand
Ctrl + [Indent
Ctrl + ]Deindent
Ctrl + Shift + [Fold
Ctrl + Shift + ]Unfold
Alt + T UTransform To Uppercase
Alt + T LTransform To Lowercase
Alt + T TTransform To Titlecase
Alt + T STransform To SnakeCase
Alt + Shift + DDelete Word

Line Editing

ShortcutCommand
Ctrl + L EMove To End Of Line
Ctrl + L Shift + ESelect To End Of Line
Ctrl + L SMove To Start Of Line
Ctrl + L Shift + SSelect To Start Of Line
Ctrl + L LSelect The Whole Line
Ctrl + L DDelete The Line
Ctrl + L DeleteDelete everything To The Right
Ctrl + L BackspaceDelete everything To The Left

Paragraph

ShortcutCommand
Ctrl + H HExpand Selection To Paragraph
Ctrl + H SExpand Selection To Paragraph
Ctrl + H Shift + SExpand Selection To Paragraph
Ctrl + H EExpand Selection To Paragraph
Ctrl + H Shift + EExpand Selection To Paragraph

Movement

ShortcutCommand
Ctrl + UpSmart Travel Up
Ctrl + DownSmart Travel Down
Alt + RightDeslocate Word Right
Alt + LeftDeslocate Word Left
Alt + LeftDeslocate Word Left
Ctrl + G GGo To Line Number
Ctrl + G LGo To Last Editing Location
Ctrl + G BGo To Bracket
Ctrl + G Shift + BSelect To Bracket
Ctrl + G SGo Start Of File
Ctrl + G EGo To End Of File
Ctrl + G UpGo Up To The Visible Screen Area
Ctrl + G Shift + UpSelect Up To The Visible Screen Area
Ctrl + G DownGo Down To The Visible Screen Area
Ctrl + G Shift + DownSelect Down To The Visible Screen Area

Custom Features

Smart Travel

Navigate vertically in your code using Ctrl + Up and Ctrl + Down by skipping non-relevant lines (like punctuation or whitespace only). The criteria to decide if a line is considered relevant or not can be configured per language using the code-flow.languageMarks setting. If the extension does not found a compatible language configured, the default behaviour is to jump to lines where there are word characters: /^\w+/.

PS.: This is generally more flexible than using VS Code symbols because you don't need an external provider and you can configure your own rules.

Keyboard Layout

This extensions uses layout independent bingings. If by any means you have problems with your keyboard layout, you can customize the shortucts in your user profile.

An example of OEM bingings for a ABNT2 keyboard

Only remap if the shortcuts are not properly recognized by your system

{
  "key": "ctrl+shift+oem_6",
  "command": "editor.fold"
},
{
  "key": "ctrl+shift+oem_5",
  "command": "editor.unfold"
},
{
  "key": "ctrl+oem_6",
  "command": "editor.action.indentLines"
},
{
  "key": "ctrl+oem_5",
  "command": "editor.action.outdentLines"
},
{
  "key": "ctrl+b ctrl+oem_plus",
  "command": "workbench.action.splitEditorOrthogonal"
},
{
  "key": "ctrl+b ctrl+oem_minus",
  "command": "workbench.action.splitEditorDown"
}

Extensions pairings

  • Code Flea: To speed up even more your code navigation

Future Ideas

  • Ctrl + T = Select Until Character (VIM-Like)
  • Ctrl + G R = Go To Relative Line Number (VIM-Like)
  • Ctrl + G F = Go To Line Fuzzy
  • Alt + L = Delete Line