Home / HomePage / Contents / Setting up VIM

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 file! (/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


    Post a comment

    Your Name or E-mail ID (mandatory)

     

    Note: Your comment will be published after approval of the owner.




     RSS of this page