Wednesday, June 9, 2010

My .vimrc

This is another post for my future self: At the time of writing, my .vimrc looks like this:

" --------------------------------------------------------------------------------
" call system vimrc
" --------------------------------------------------------------------------------
source $VIM/_vimrc

" --------------------------------------------------------------------------------
" startup
" --------------------------------------------------------------------------------
autocmd GUIEnter * simalt ~X    " maximize window

" --------------------------------------------------------------------------------
" opening files
" --------------------------------------------------------------------------------

" change working directory to path of file
autocmd BufEnter * lcd %:p:h    

" reformat xml files (pretty print)
autocmd FileType xml exe ":silent 1,$!xmllint --format --encode UTF-8 --recover - 2>/dev/null"

" --------------------------------------------------------------------------------
" saving files
" --------------------------------------------------------------------------------
set backupdir=./_Backup,$TEMP,.

" --------------------------------------------------------------------------------
" searching
" --------------------------------------------------------------------------------
set hlsearch        " highlight matches to search pattern
set incsearch        " incremental search
set smartcase       " case sensitive if search string contains uppercase letters
set ignorecase        " case insensitive searching

" --------------------------------------------------------------------------------
" configure editor with tabs and nice stuff...
" --------------------------------------------------------------------------------
set expandtab           " enter spaces when tab is pressed
set textwidth=0         " do not break lines when line length increases
set tabstop=4            " use 4 spaces to represent tab
set softtabstop=4
set shiftwidth=4        " number of spaces to use for auto indent
set autoindent          " copy indent from current line when starting a new line

" make backspaces more powerfull
set backspace=indent,eol,start 

set ruler               " show line and column number


" --------------------------------------------------------------------------------
" encoding
" --------------------------------------------------------------------------------
set encoding=utf-8
"set printencoding=utf-8

" --------------------------------------------------------------------------------
" keyboard mappings
" --------------------------------------------------------------------------------
set langmap=¨]


Future Daren, you can find the location of the .vimrc by editing the file $MYVIMRC in vim itself! Unless it hasn't been created yet ($MYVIMRC will then point to the system-wide version). In Windows, just plop a _vimrc file in your %userprofile%.

No comments:

Post a Comment