Turning syntax highlighting for vi and vim in Mac OS X is as simple as creating a file called “.vimrc
” in your home folder with the following content:
set nocompatible syntax on
You may not like the standard color highlighting schema, but it can be easily changed. For example open some “.php
” file and type :colorscheme
followed by an space and the hit the tab key (or shift-tab to go backwards). You will see the different color schema names available in the system and then if you hit enter you’ll se immediately how it changes to the one you selected.
You can also set your default color highlighting schema in the “.vimrc
” with “colo schemaname
“:
set nocompatible syntax on colo default
The available schema names are those folder names inside the folder “/usr/share/vim/vimXX/
” (the XX are 2 numbers that change for version to version of Mac OS X) without the “.vim
” extension:
$ ls /usr/share/vim/`echo vim[0-9][0-9]`/colors/*.vim /usr/share/vim/vim73/colors/blue.vim /usr/share/vim/vim73/colors/darkblue.vim /usr/share/vim/vim73/colors/default.vim /usr/share/vim/vim73/colors/delek.vim /usr/share/vim/vim73/colors/desert.vim /usr/share/vim/vim73/colors/elflord.vim /usr/share/vim/vim73/colors/evening.vim /usr/share/vim/vim73/colors/koehler.vim /usr/share/vim/vim73/colors/morning.vim /usr/share/vim/vim73/colors/murphy.vim /usr/share/vim/vim73/colors/pablo.vim /usr/share/vim/vim73/colors/peachpuff.vim /usr/share/vim/vim73/colors/ron.vim /usr/share/vim/vim73/colors/shine.vim /usr/share/vim/vim73/colors/slate.vim /usr/share/vim/vim73/colors/torte.vim /usr/share/vim/vim73/colors/zellner.vim
My favorite one is “peachpuff”.
Ref: http://igoles.wordpress.com/2006/09/01/anadiendo-color-a-vim-en-mac-os-x/
http://alvinalexander.com/linux/vi-vim-editor-color-scheme-colorscheme
1 Comments.