Thursday, November 7, 2013

Colors and Split Screens in Vim

Here is some info on vim that I put here mainly for my reference. Maybe someone else will find them useful.

Color schemes
Set the color scheme in .vimrc, e.g. add a line like "colorscheme ron"
In vim, you can list the color schemes with ":colo <TAB>" (space after "colo")
If no colors after setting the color scheme, make sure syntax is enabled. In .vimrc add the line "syntax on".

Editing Multiple Files
:ls - List open files
:n or :bn - Go to next file
:p or :bp - Go to previous file
:b10 - Go to 10th file
:b foo - Go to file named "foo"
:b <TAB-KEY> - Cycle through open files (space after ":b")
CTRL-w v - Split screen vertically
CTRL-w s - Split screen horizontally
CTRL-w h and CTRL-w l - Switch through vertical windows
CTRL-w k and CTRL-w j - Switch through horizontal windows