Posts Tagged ‘vim’

vim: re-read your .vimrc

February 25, 2010

To re-read your vimrc, type:

:source $MYVIMRC

vim: dealing with split screens

February 25, 2010

Some useful commands for dealing with split screens in vim:

  • :split  – split the screen  (:vsplit splits vertically)
  • ^Ww – go to the other window
  • ^Whjkl – go to the window in the specified direction
  • ^W+ – increase the height of the window (- decreases it), add a count if you like
  • 42^W_ – set the height to 42 lines
  • ^W> – increase the width of the window (< decreases it), add a count if you like
  • :close – close the current window
  • :only – close all other windows

vim: scroll screen up and down without leaving current line

February 25, 2010

To move the *screen* up or down without actually leaving the line you’re on, the commands are ^E and ^Y.

vim: reset the search pattern

February 25, 2010

To reset the most recent search pattern (used by ‘n’ and ‘N’, among others), do:

:let @/= “”

Setting it to an empty string actually sets it to nothing. Put a different pattern in the quotes if you prefer.

(I’ve found this useful when setting up complex search/replace macros.)

vim: zz to center screen on current line

February 25, 2010

The vim command “zz” moves your screen up or down so that the line you’re on ends up in the center/centre of the screen.