IDE Like a Pro

ActionVim - CommandVim - Keyboard ShortcutVS Code - Command[^2]1VS Code - Keyboard Shortcut[^3]2GoLand - Action[^5][^5.1]3GoLand4 - Keyboard Shortcut
Undou
Redo<C-r>
➡️ Fold AllFold AllCtrl + K, Ctrl + 0Collapse AllCtrl + K, Ctrl + 0
🔙 Unfold AllUnfold AllCtrl + K, Ctrl + JExpand AllCtrl + K, Ctrl + J
Expand All to Level(Unfold All)1. (Ctrl + K, Ctrl + J)1.1. Expand All to …1. Ctrl + Shift + *
Fold Level 1 (2, 3…)2. Ctrl + K, Ctrl + 1 (2, 3…)1.2. … Level2. 1 (2, 3…)
2. Expand All to LevelAssigned to Ctrl + Shift + *
➡️ Shrink SelectionVisual mode: <S-v>Shrink Selection5Alt + Shift + LeftArrowShrink SelectionCtrl + Shift + W (default)
🔙 Expand SelectionVisual mode: vExpand SelectionAlt + Shift + RightArrowExtend SelectionAlt + Shift + Right
Assigned to Alt + Shift + LeftArrow
➡️ Move Line DownMove Line DownAlt + DownArrowMove Line DownAlt + DownArrow
🔙 Move Line UpMove Line6 UpAlt + UpArrowMove Line UpAlt + UpArrow
➡️ Copy Line Downyy pCopy Line DownAlt + Shift + DownArrowDuplicate LineAlt + Shift + DownArrow
🔙 Copy Line Upyy PCopy Line7 UpAlt + Shift + UpArrow8NA
Delete Current Linedd
➡️ Add Cursor BelowAdd Cursor BelowCtrl + Shift + DownArrow2. UpArrow / DownArrow
🔙 Add Cursor AboveAdd Cursor AboveCtrl + Shift + UpArrowAdd multiple carets on double Ctrl with arrow keys1. Ctrl Ctrl (hold alter second press)
Cursor UndoCursor UndoCtrl + U
➡️ Right with SelectionNARight with SelectionShift + RightArrow
🔙 Left with SelectionNALeft with SelectionShift + LeftArrow
➡️ Down with SelectionNADown with SelectionShift + DownArrow
🔙 Up with SelectionNAUp with SelectionShift + UpArrow
Column Selection<C-v>Toggle Column Selection ModeAssigned to Alt + Shift + InsertColumn Selection ModeAlt + Shift + Insert
Line SelectionVExpand Line SelectionCtrl + LExtend Line SelectionReassigned to Ctrl + L
Format Code<Leader> fmFormat DocumentAlt + Shift + FReformat CodeAlt + Shift + F
➡️ Close TabBuffer close<Leader> xClose EditorCtrl + WClose TabCtrl + W
🔙 Reopen Closed TabReopen Closed EditorCtrl + Shift + TReopen Closed TabCtrl + Shift + T
Toggle Terminal<M-h> (Horizon)
<M-i> (Float)
<M-v> (Vertical)
Toggle TerminalCtrl + ` TerminalCtrl + ` or Ctrl + Tab, T
➡️ Show Explorer<C-N> (Focus)Show ExplorerCtrl + Shift + EProject ViewCtrl + Shift + E or Ctrl + Tab, 1
🔙 Hide Explorer<Leader> + e (Toggle)Toggle Primary SidebarCtrl + BProject ViewCtrl + Shift + E
Command PaletteShow All CommandsCtrl + Shift + PFind ActionsCtrl + Shift + P
Markdown: Open PreviewMarkdown: Open PreviewCtrl + Shift + VPreviewCtrl + Shift + V
Markdown: Open Preview to the SideMarkdown: Open Preview to the SideCtrl K, Ctrl + VEditor and PreviewCtrl K, Ctrl + V
Reveal in Explorer ViewReveal in Explorer ViewAssigned to Ctrl + K, ESelect Opened FileCtrl + K, E
Structure (of current file)Focus on Outline ViewAssigned to Alt + 79StructureAlt + 7 or Ctrl +Tab, 7
➡️ Switch to Next Tab<Tab>Ctrl + Tab
🔙 Switch to Previous Tab<S-Tab>Ctrl + Shift + Tab
Search Files<Leader> ffGo to Files…Ctrl + PGo to Files…Ctrl + P
Toggle Line Comment<Leader> /Toggle Line CommentCtrl + /
Open in TerminalOpen in Integrated TerminalAssigned to Ctrl + K, Ctrl + ` Open in TerminalAssigned to Ctrl + K, Ctrl + `
Open Keyboard ShortcutsPreferences: Open Keyboard ShortcutsCtrl + K, Ctrl + SKeymap / Configure Keymap…Assigned to Ctrl + K, Ctrl + S
➡️ Go To Next ProblemGo To Next ProblemF8Next Highlighted ErrorAssigned to F8
🔙 Go To Previous ProblemGo To Previous ProblemShift + F8Previous Highlighted ErrorShift + F8
BackGo BackAssigned to Alt + LeftArrowBackAlt + LeftArrow
ForwardGo ForwardAssigned to Alt + RightArrowForwardAlt + RightArrow
Context Actions~ Source ActionsCtrl + .Context ActionsCtrl + .
RefactorRefactorAssigned to Ctrl + Alt + R (to match with other refactor actions)
Introduce VariableCtrl + Alt + V
Introduce ConstantCtrl + Alt + C
Extract MethodCtrl + Alt + M
Go ToGo ToAssigned to Ctrl + K, Ctrl + G
Go To DeclarationGo To DefinitionCtrl + Click + or F12Go To DeclarationCtrl + Click or F12
Go To Type DeclarationGo To Type DefinitionGo To Type DeclarationCtrl + Shift + Click or Ctrl + F12
Implement InterfaceGo: Generate Interface StubsImplement Interface0. Move the cursor to the type
(Workaround with Quick Fixes)10e.g. var _ MyInterface = (*MyType)(nil)1. Ctrl + . (Source Actions)
Cursor Top (First line)First Linegg or <C-Home>Cursor TopCtrl + Home2. Implement Interface... (Assigned to Ctrl + Alt + I)
Cursor Bottom (Last line)Last LineG or <C-End>Cursor BottomCtrl + End
Cursor Home (Beginning of line)^ or HomeCursor HomeHome
Cursor End (End of line)$ or EndCursor EndEnd
CopyYank/Copyy (The cursor will move to the start of selected area)
PastePaste after cursor(Move the cursor to end of word/line…) - p
Switch ProfileProfiles: Switch Profile…Change to Ctrl + Shift + M (to match with browsers)
ActionMost appsVim - Keyboard Shortcut
Move cursor backward (1 character)<Left>h
Move cursor forward (1 character)<Right>l
Move cursor down (1 line)<Down>j
Move cursor up (1 line)<Up>k
Move cursor down (1 page)<PageDown><S-Down> or <C-f>
Move cursor up (1 page)<PageUp><S-Up>or <C-b>
Move cursor to beginning of line<Home>
Move cursor to end of line<End>
Move cursor to first line<C-Home>
Move cursor to last line<C-End>

nvim

Vim modes

Vim provides a modal user interface, which means that the result of pressing any key on the keyboard may differ depending on which mode is active at the time.

Vim has 4 main modes:

  • Normal mode
  • Insert mode
  • Visual modes
  • Command-line mode

Vim commands and Vim notation

  • In Normal mode, a Vim command is composed by pressing one or more keystrokes in sequence.

    NotationMeaning
    xPress x once
    dwPress d, then w (in sequence)
    dapPress d, a, then p (in sequence)
  • A keystroke can be composed of:

    • one key on the keyboard, e.g. c, m, s

      • Some key has special names:

        NotationMeaningNote
        <Esc>Press the Escape key
        <CR>Press the carriage return keyaka <Enter>
        <Ctrl>Press the Control key
        <Tab>Press the Tab key
        <Shift>Press the Shift key
        <Up>Press the up arrow key
        <Down>Press the down arrow key
        Press the space bar

        For the full list of keys and its notations, use :help key-notation

    • multiple keys on the keyboard (by pressing all at the same time). e.g. Ctrl and n

    [!NOTE] Vim uses <> notation to make clear of a keystroke.

    Vim Notation (for a keystroke)MeaningKeyboard KeyAlternative Notation
    cc
    m, am, a
    ss
    <C-…>control-keyCtrl^
    <M-…>, <A-…>alt-key or meta-keyAlt^[
    <S-…>shift-keyShiftUse an uppercase letter, e.g. V equivalent to <S-v>
    <Leader>vim uses <Leader> key as a namespace for our own user-defined commandsSpace (Typically)
  • Combine both of facts that:

    • a Vim command is composed of one or more keystrokes
    • a keystroke can be a single or multiple key pressing

    a notation can be a little complicated:

    Notation (for multiple keystrokes)First KeystrokeSecond Keystroke
    <C-n>Press <Ctrl> and n (at the same time)
    g<C-]>Press gPress <Ctrl> and ] (at the same time)
    <C-r>0Press <Ctrl> and r (at the same time)Press 0
    <C-w><C-=>Press <Ctrl> and w (at the same time)Press <Ctrl> and = (at the same time)

Switch between Vim modes:

ModePurposeHow to switch to?Note
Normal modeVim’s default modeFrom other modes: press EscThis is where all the magic happens.
Insert mode~ Text EditorFrom normal mode, press i, a or o:There are also <S-i>, <S-a> and <S-o>:
- i: Insert (before cursor).- <S-i>: Insert at the beginning of the line.
- a: Append (after cursor).- <S-a>: Append at the end of the line.
- o: Add newline (after current line) then insert (on newline)- <S-o>: Add newline (before current line), then insert (on newline).
Visual modesText selectionFrom
- v: Character-wise Visual mode
- <S-v>: Line-wise Visual mode
- <C-v>: Block-wise Visual mode
Command-line modeRun any Vim commandFrom press :
4

GoLand keymap has changed to a custom one based on VS Code

11

VS Code commands can be invoked with Command Palette (Ctrl + Shift + P)

12

VS Code Keyboard Shortcut is aka keybinding

13

GoLand actions can be invoked in Search Everywhere / Actions

3

Actions tab of Search Everywhere can be accessed directly with Ctrl + Shift + P

8

The commands Copy Line Up/Down are unbound on Linux because the VS Code default keybindings would conflict with Ubuntu keybindings

9

Override VS Code workbench.action.openEditorAtIndex7