VIm Settings for Programming

Since I am using VIm (VI Improved) then and now for C programming, I started „optimizing“ the its looks (like turning syntax highlighting on, enabling line numbering etc.). All the settings go to your „~/.vimrc“.

To switch on syntax highlighting (does not work with VI, only with VIm!):

syntax on

Turn on line numbering:

set nu

Set tab stop to 4 chars:

set tabstop=4
set shiftwidth=4

Enable search pattern highlighting:

set hlsearch

Change background color to blue, foreground to white (hello borland turbo c):

highlight Normal ctermfg=grey ctermbg=darkblue

My whole „.vimrc“ then reads like this:

syntax on
set nu
set tabstop=2
set shiftwidth=2
set hlsearch
highlight Normal ctermfg=grey ctermbg=darkblue

And this is how the result looks like:

2 Comments to VIm Settings for Programming

  1. eric's Gravatar eric
    18. Januar 2012 at 20:03 | Permalink

    Nice settings. My config looks very similar.
    In my case hlsearch is enabled by default.

    You may like the feature of „ignorecase“. It will ignore the case-sensitivity of your searches.

    My vimrc:
    syntax on
    set number
    set tabstop=2
    set shiftwidth=2
    set ignorecase

    “ what? foreground? background? fontstyle?
    highlight LineNr ctermfg=8 ctermbg=NONE cterm=NONE
    highlight NonText ctermfg=8 ctermbg=NONE cterm=NONE
    highlight Visual ctermfg=0 ctermbg=7 cterm=NONE
    highlight Comment ctermfg=4 ctermbg=NONE cterm=NONE
    highlight Pmenu ctermfg=4 ctermbg=0 cterm=NONE
    highlight PmenuSel ctermfg=15 ctermbg=8 cterm=NONE
    highlight Statement ctermfg=2 ctermbg=NONE cterm=BOLD
    highlight Type ctermfg=12 ctermbg=NONE cterm=NONE

Leave a Reply

You must be logged in to post a comment.