Skip to content

thiagomajesk/code-flow

Repository files navigation

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

Shortcut Command
Ctrl + K Ctrl + E Toggle Explorer
Ctrl + K Ctrl + F Toggle Find (Search)
Ctrl + K Ctrl + D Toggle Debugger
Ctrl + K Ctrl + G Toggle Git
Ctrl + K Ctrl + S Toggle Sidebar
Ctrl + K Ctrl + R Toggle Remote Explorer
Ctrl + K Ctrl + B Toggle Buffer (Text Editor)
Ctrl + K Ctrl + T Toggle Terminal
Ctrl + K Ctrl + M Toggle Minimap

File Explorer Commands

Shortcut Command
Ctrl + N New File
Ctrl + Shift + N New Folder

Buffer Commands

Shortcut Command
Ctrl + B Ctrl + W Close Buffer
Ctrl + B Ctrl + N Split (New) Buffer
Ctrl + B Ctrl + P Open Preview Buffer
Ctrl + B Ctrl + - Split Buffer Horizontaly
Ctrl + B Ctrl + = Split Buffer Orthogonaly
Ctrl + B Right Move To Right Buffer
Ctrl + B Left Move To Left Buffer
Ctrl + B Up Move To Top Buffer
Ctrl + B Down Move To Bottom Buffer
Ctrl + B Ctrl + Right Move Buffer Right
Ctrl + B Ctrl + Left Move Buffer Left
Ctrl + B Ctrl + Up Move Buffer Top
Ctrl + B Ctrl + Down Move Buffer Bottom
Ctrl + B Ctrl + A Show All Editors
Ctrl + B Ctrl + G Show Editors In Active Group
Ctrl + B Ctrl + R Reopen Last Closed

Content Manipulation

Shortcut Command
Ctrl + [ Indent
Ctrl + ] Deindent
Ctrl + Shift + [ Fold
Ctrl + Shift + ] Unfold
Alt + T U Transform To Uppercase
Alt + T L Transform To Lowercase
Alt + T T Transform To Titlecase
Alt + T S Transform To SnakeCase
Alt + Shift + D Delete Word

Line Editing

Shortcut Command
Ctrl + L E Move To End Of Line
Ctrl + L Shift + E Select To End Of Line
Ctrl + L S Move To Start Of Line
Ctrl + L Shift + S Select To Start Of Line
Ctrl + L L Select The Whole Line
Ctrl + L D Delete The Line
Ctrl + L Delete Delete everything To The Right
Ctrl + L Backspace Delete everything To The Left

Paragraph

Shortcut Command
Ctrl + H H Expand Selection To Paragraph
Ctrl + H S Expand Selection To Paragraph
Ctrl + H Shift + S Expand Selection To Paragraph
Ctrl + H E Expand Selection To Paragraph
Ctrl + H Shift + E Expand Selection To Paragraph

Movement

Shortcut Command
Ctrl + Up Smart Travel Up
Ctrl + Down Smart Travel Down
Alt + Right Deslocate Word Right
Alt + Left Deslocate Word Left
Alt + Left Deslocate Word Left
Ctrl + G G Go To Line Number
Ctrl + G L Go To Last Editing Location
Ctrl + G B Go To Bracket
Ctrl + G Shift + B Select To Bracket
Ctrl + G S Go Start Of File
Ctrl + G E Go To End Of File
Ctrl + G Up Go Up To The Visible Screen Area
Ctrl + G Shift + Up Select Up To The Visible Screen Area
Ctrl + G Down Go Down To The Visible Screen Area
Ctrl + G Shift + Down Select 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