Setting up VIM editor

From Tuxation

(Difference between revisions)

Revision as of 04:40, 10 September 2007

Setting up VIM

When my Kubuntu was up and running, I noticed that vim is not turning on syntax highlighting and not remembering my last cursor position when I last opened the file - the cursor always positions at the top of the file everytime I open it. Time to hack that .vimrc! (/etc/vim/vimrc)

" turn on syntax highlighting
syntax on

' turn on pattern highlighting during search
set hlsearch

" Make VIM move the cursor automatically to the last position when we last opened the file.
if has("autocmd")
 autocmd BufReadPost *
 \\ if line("'\'") > 0 && line("'\'") <= line("$") |
 \\ exe "normal g`\\"" |
 \\ endif
endif
Personal tools