Skip to content

Instantly share code, notes, and snippets.

@nirdosh17
Created March 11, 2024 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nirdosh17/a0b42399b15c6ea6ed00b3988a5db105 to your computer and use it in GitHub Desktop.
Save nirdosh17/a0b42399b15c6ea6ed00b3988a5db105 to your computer and use it in GitHub Desktop.

VIM 101

  • Create or open file: vi <filename>
  • Normal mode: ESC | Insert mode: i | Command mode: : In normal mode, we can execute Vim commands to search, and transform text. In Insert mode, we can edit the file content.
  • Write and quit: :wq
  • Select lines: Press v to start visual selection. Select lines with arrow keys.
  • Copy with y | Paste with p 
  • Delete or cut line: d 
  • Repeat last action: . Press dot as many times as you want to repeat the command (e.g. indent)
  • Search: /<term> E.g. /nodePort
  • Case insensitive search: /<term>\c E.g. /nodeport\c
  • Navigate search results: * for next and # for the previous occurrence
  • Indent: Select lines with v , shift + < to indent left. Press dot . multiple times to indent further. shift + > to indent right.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment