Vim setup

Again, this is mostly a social bookmark to have a trace of what different parts of my configuration files in my Vim folder do. Feel free to steal whatever part you like. Note that not all of these settings will work without additional plugins. The ones I use on daily basis are: Powerline, bclose, voom and latex-suite.

A hint: Since I am using several computers I use Dropbox to synchronize all of my vim configurations thus my .vim folder on every machine is just a symlink to the Dropbox folder. I have moved my vimrc file there as well and source it from the original .vimrc file in the home folder.

" In case we are in a 256 color capable terminal
set t_Co=256

" Set a right colorscheme colorscheme zenburn

" Let Powerline use nice symbols let g:Powerline_symbols = ‘fancy’

" Look for modelines embedded in source files, this is especially useful when " getting python code from other developers set modeline

" The only GUI element we want is the icon, remove menubar, toolbars etc. set go=i

" Always show the statusline set laststatus=2

" Display the beginning of the last line at the end of the buffer set display=lastline

" Turn on the syntax highlighting syntax on

" Set default window size to something sensible set lines=60 set columns=170 " " Set the editor to wrap long lines on words set wrap set linebreak

" Do not insert break lines to long lines set textwidth=0 set wrapmargin=0

" Turn on folding set foldenable

" Make folding indent sensitive set foldmethod=indent

" Don’t autofold anything (but I can still fold manually) set foldlevel=100

" don’t open folds when you search into them set foldopen-=search

" don’t open folds when you undo stuff set foldopen-=undo

" Start the filetype plugin, this is really necessary filetype plugin on

"set fuopt=maxvert

" I use simple php templates au BufNewFile,BufRead *.tmpl setf php

" Load doxygen syntax highlighting when necessary let g:load_doxygen_syntax=1

" Add doxygen syntax highlighting to all cpp files au BufNewFile,BufRead *.cpp setf cpp.doxygen

" Add jQuery syntax highlighting au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery

" Activate line numbers set number

" Tab size to 4 spaces, and no expanding of tabs to spaces! set tabstop=4 set shiftwidth=4 set noexpandtab

" Display only 5 first suggestions when correcting orthograph set spellsuggest=best,5

" I use the <,> shortcut to align a paragraph to the wrap width nmap , gqap " " Use Ctrl-W+ to close current file without closing the split (needs bclose &quot; plugin) nmap &lt;C-W&gt; <Plug>Kwbd

" Enable the use of Ctrl-Space and Ctrl-Enter for completion imap <C-S-space> <C-n> imap <C-space> <C-p> imap <C-CR> <C-x><C-o>

" Map the up/down arrow keys to follow visual lines, not the real ones map <Up> gk map <Down> gj imap <Down> <C-o>gj imap <Up> <C-o>gk

" Map Meta-j and Meta-k to follow visual lines map <M-j> gj map <M-k> gk

" Map Home and End to go to beginning and end of the visual line map <End> g<End> map <Home> g<Home> imap <End> <C-o>g<End> imap <Home> <C-o>g<Home>

" Make Meta-Shift-MouseScroll create a visual block selection noremap <M-S-LeftMouse> <4-LeftMouse> inoremap <M-S-LeftMouse> <4-LeftMouse> noremap <M-S-LeftDrag> <LeftDrag> inoremap <M-S-LeftDrag> <LeftDrag>

"set statusline=%<[%02n]\ %F%(\ %m%h%w%y%r%)\ %a%=\ %8l,%c%V/%L\ (%P) " Map gw to switch the word under the cursors with the next one nnoremap <silent> gw "_yiw:s/(%#\w+)(\W+)(\w+)/\3\2\1/<CR><c-o><c-l>

" Map gl to switch the word under the cursor with the previous one nnoremap <silent> gl "_yiw?\w+_W+%#<CR>:s/(%#\w+)(_W+)(\w+)/\3\2\1/<CR><c-o><c-l>

" Map F3 to show the list of buffers map <F3> :buffers<CR>:b<space>

" Map F4 to switch between .h and .cpp file map <F4> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>g`"

" Map F5 and F6 to go to next/previous error marker map <F5> :cp<CR> map <F6> :cn<CR>

" Map F8 to save all files and run Make map <F8> :wall<CR>:make<CR>

" Start indenting scheme automatically filetype plugin indent on

" Use the right grep command on mac set grepprg=grep\ -nH\ $*

" Of course we are using latex let g:tex_flavor=‘latex’

" Autogenerate ctags on C/C++ source file save "au BufWritePost .c,.cpp,*.h silent! !ctags -R &amp;

" If we are on a Mac if has("unix") &amp;&amp; match(system("uname"),‘Darwin’) != -1 let g:platform_MAC=1 " Setup a nice font for powerline set guifont=Meslo\ LG\ M\ DZ\ for\ Powerline:h12

" Receive option keys as meta set macmeta

" Map :TB for mode for writing text on a big screen command TB colorscheme mayansmoke|set spell|set linespace=8|set guifont=Meslo\ LG\ M\ DZ\ for\ Powerline:h20|set fu " Map :TB for mode for writing text on a small screen command T colorscheme mayansmoke|set spell|set linespace=8|set guifont=Meslo\ LG\ M\ DZ\ for\ Powerline:h14 " Map :TB for mode for writing code command C colorscheme zenburn|set nospell|set linespace=0|set guifont=Meslo\ LG\ M\ DZ\ for\ Powerline:h12

" If we are on Linux else set guifont=Droid\ Sans\ Mono\ for\ Powerline\ 12 let g:Powerline_symbols = ‘fancy’

" Map Meta+V as paste from system clipboard imap <M-v> <Esc>"+pa imap <M-S-v> <Esc>"+Pa nmap <M-v> "+p nmap <M-S-v> "+P

" Map Meta+C as copy to system clipboard vmap <M-c> "+y

" Map Ctrl+S as save nmap <C-s> :w<CR> imap <C-s> <Esc>:w<CR>a

" Map :TB for mode for writing text command T colorscheme mayansmoke|set spell|set linespace=8|set guifont=Droid\ Sans\ Mono\ for\ Powerline\ 14 " Map :TB for mode for writing code command C colorscheme zenburn|set nospell|set linespace=0|set guifont=Droid\ Sans\ Mono\ for\ Powerline\ 10 endif

" Deletes double lines and such from a SVN log function! CleanSVNLog() %s/^-$//g %s/^r\d\d.$//g %s/\n\n\n/\r\r/ endfunction