VI VIM Cheatsheet
id : y3n48bi7oz
category : computer
blog : unixlinux
created : 04/14/10 - 11:18:56

Copy
  • y$ : Copy from cursor to en of line
  • y^ : Copy from cursor to line begining

Splitting
  • [ESC] :vsplit : Split vertically, and open file
  • [ESC] :split : Split horizontally, and open file
  • [CTRL]ww : Move to next region
  • [CTRL]W+ : Increase size of a window
  • [CTRL]W- : Decrease size of a window
  • [CTRL]Wh : Move to the window left
  • [CTRL]Wj : Move to the window below
  • [CTRL]Wk : Move to the window above
  • [CTRL]Wl : Move to the window right

Buffering
  • [ESC] :e : Edit a file in a new buffer
  • [ESC] :bnext (or :bn) : Go to next buffer
  • [ESC] :bprev (of :bp) : Go to previous buffer
  • [ESC] :bd : Delete a buffer (close a file)

Misc
  • se [no]list : Display '$' at end line (usefull to see empty lines)

Hacks/Tricks
  • Want to copy/cut an entier colum in vim
    • Hit ctrl-v to enter visual block mode
    • Select your aera with movement keys (h,j,k,l)
    • Hit 'y' to yank or 'c' to cut
    • hit 'p' to paste your column
  • Want to sort an entire file in vi/vim
    • Hit escape
    • Hit :
    • Type %!sort, or :from,to !sort