VIM

August 24, 2021

Navigation Commands

  • H – Go to the first line of current screen.
  • M – Go to the middle line of current screen.
  • L – Go to the last line of current screen.
  • ctrl+f – Jump forward one full screen.
  • ctrl+b – Jump backwards one full screen.
  • ctrl+d – Jump forward (down) a half screen.
  • ctrl+u – Jump back (up) one half screen.
  • gd - go to function definition
  • g; - go to the previous change location
  • g, - go to the newer change location
  • gi - place the cursor at the same position where it was left last time in the Insert mode
  • * or # - searches for the exact word at the cursor

Edit commands

  • ci" change inside "
  • ca" change around "
  • cit change inside tag
  • cs'" change surround ' with "
  • di" delete inside "
  • da" delete around "
  • dit change inside tag

vim-commentary

  • gcc to comment out a line (takes a count)
  • gc to comment out the target of a motion (for example, gcap to comment out a paragraph),
  • gc in visual mode to comment out the selection
  • gc in operator pending mode to target a comment.

FZF

  • Look for files under current directory :FZF

  • Look for files under your home directory :FZF ~

  • With fzf command-line options :FZF --reverse --info=inline /tmp

  • Bang version starts fzf in fullscreen mode :FZF!

switch between tabs

gt -> Switch between tabs