Apple - Color code for vi on terminal on Mac?
Add the following to your ~/.vimrc
:
filetype plugin indent on
set term=builtin_ansi
syntax on
If you’re using iTerm, use this instead of line 2:
set term=xterm-256color
Use :syn on
to turn on syntax highlighting. Put this in your ~/.vimrc
file to use it every time. (Vim should detect your terminal type automatically, no need to worry about that.)
To customize the colors, use the :highlight
command. Type :help :hi
in Vim for more information on this. For more help on syntax highlighting in general, type :help :syntax-highlighting
.
If you want to customize it a lot, you can even create a color scheme. This is basically a list of commands, like a .vimrc file, into which you put all the :hi
commands. Make sure to include let colors_name = "whatever"
somewhere so it'll work correctly.