1 " My overloaded vimrc <buz@netbuz.org>
      2 "
      3 " To give it a try:
      4 "
      5 " git clone git://netbuz.org/dotvim ~/.vim
      6 " ln -s ~/.vim/vimrc ~/.vimrc
      7 
+   -     8 +-- 96 lines: plugins
  8 " plugins {{{1
|     9 let g:plug_window = 'botright new'
|    10 call plug#begin('~/.vim/bundle')
|    11 
|+  |-   12 +--- 20 lines: basic plugins
 12 " basic plugins {{{2
||   13 Plug 'tpope/vim-repeat' " repeat.vim: enable repeating supported plugin maps with .
||   14 Plug 'tpope/vim-surround' " surround.vim: quoting/parenthesizing made simple
||   15 Plug 'tpope/vim-commentary' " commentary.vim: comment stuff out
||   16 Plug 'tpope/vim-abolish' " abolish.vim: easily search for, substitute, and abbreviate multiple variants of a word
||   17 Plug 'tpope/vim-unimpaired' " unimpaired.vim: pairs of handy bracket mappings
||   18 Plug 'tpope/vim-tbone' " tbone.vim: tmux basics
||   19 Plug 'tpope/vim-speeddating' " speeddating.vim: use CTRL-A/CTRL-X to increment dates, times, and more
||   20 Plug 'tpope/vim-fugitive' " fugitive.vim: a Git wrapper so awesome, it should be illegal
||   21 Plug 'tpope/vim-dispatch' " dispatch.vim: asynchronous build and test dispatcher
||   22 Plug 'tpope/vim-vinegar' " vinegar.vim: combine with netrw to create a delicious salad dressing
||   23 Plug 'ervandew/supertab' " Perform all your vim insert mode completions with Tab
||   24 Plug 'godlygeek/tabular' " Vim script for text filtering and alignment
||   25 Plug 'buztard/vim-rel-jump' " rel-jump.vim - Turn up-down motions into jump-motions
||   26 Plug 'buztard/vim-nomad' " Vim plugin to keep your environment variables in sync with tmux
||   27 Plug 'nelstrom/vim-visual-star-search' " Start a * or # search from a visual block
||   28 Plug 'tommcdo/vim-exchange' " Easy text exchange operator for Vim
||   29 Plug 'Lokaltog/vim-easymotion' " Vim motions on speed!
||   30 Plug 'mileszs/ack.vim' " Vim plugin for the Perl module / CLI script 'ack'
||   31 
|+  |-   32 +--- 18 lines: user interface
 32 " user interface {{{2
||   33 Plug 'buztard/vim-marshmallow' " A dark colorscheme based on xoria256 and bubblegum
||   34 Plug 'ctrlpvim/ctrlp.vim' " Fuzzy file, buffer, mru, tag, etc finder.
||   35 Plug 'JazzCore/ctrlp-cmatcher', { 'do': './install.sh' }
||   36 
||   37 Plug 'Shougo/vimproc.vim', { 'do': 'make -f make_unix.mak' }
||   38 Plug 'Shougo/unite.vim' " Unite and create user interfaces
||   39 Plug 'Shougo/unite-outline' " outline source for unite.vim
||   40 Plug 'bling/vim-airline' " lean & mean status/tabline for vim that's light as air
||   41 
||   42 " A tree explorer plugin for vim
||   43 Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }
||   44 
||   45 " Display your undo history in a graph
||   46 Plug 'https://github.com/mbbill/undotree', { 'on': 'UndotreeToggle' }
||   47 Plug 'gregsexton/gitv', { 'on': 'Gitv' } " gitk for Vim
||   48 
||   49 
|+  |-   50 +--- 18 lines: language support
 50 " language support {{{2
||   51 Plug 'fatih/vim-go' " Go development plugin for Vim
||   52 Plug 'pangloss/vim-javascript' " Vastly improved Javascript indentation and syntax support
||   53 Plug 'elzr/vim-json' " A better JSON for Vim
||   54 Plug 'sudar/vim-arduino-syntax' " Arduino syntax files for Vim
||   55 Plug 'kergoth/aftersyntaxc.vim' " C Syntax Extensions
||   56 Plug 'kchmck/vim-coffee-script' " CoffeeScript support for vim 
||   57 Plug 'JulesWang/css.vim' " Cutting-edge vim css syntax file
||   58 Plug 'othree/html5.vim' " HTML5 omnicomplete and syntax
||   59 Plug 'digitaltoad/vim-jade' " Vim Jade template engine syntax highlighting and indention
||   60 Plug 'tpope/vim-markdown' " Vim Markdown runtime files 
||   61 Plug 'mutewinter/nginx.vim' " Syntax highlighting for nginx.conf and related config files
||   62 Plug 'wting/rust.vim' " Vim support for Rust file detection and syntax highlighting
||   63 Plug 'wavded/vim-stylus' " Syntax Highlighting for Stylus
||   64 Plug 'tejr/vim-tmux' " Tmux vim syntax
||   65 Plug 'tkztmk/vim-vala' " vim-vala is a set of Vim syntax, indent and ftdetect files for Vala
||   66 Plug 'ap/vim-css-color' " Highlight colors in css files
||   67 
|+  |-   68 +--- 36 lines: programming tools
 68 " programming tools {{{2
||   69 Plug 'vim-scripts/matchit.zip' " extended % matching for HTML, LaTeX, and many other languages
||   70 Plug 'SirVer/ultisnips' " A snippet engine
||   71 Plug 'honza/vim-snippets' " Various snippets
||   72 
||   73 " Vim plugin that displays tags in a window, ordered by class etc.
||   74 Plug 'majutsushi/tagbar'
||   75 
||   76 " Syntax checking hacks for vim
||   77 Plug 'scrooloose/syntastic'
||   78 
||   79 " A Vim plugin which shows a git diff in the gutter (sign column) and stages/reverts hunks.
||   80 Plug 'airblade/vim-gitgutter'
||   81 
||   82 " emmet for vim: http://emmet.io/
||   83 Plug 'mattn/emmet-vim', { 'for': ['html', 'xhtml', 'css', 'xml'] }
||   84 
||   85 " A vim plugin that simplifies the transition between multiline and single-line code
||   86 Plug 'AndrewRadev/splitjoin.vim'
||   87 
||   88 " Use of Clang for completing C, C++, Objective-C and Objective-C++
||   89 Plug 'Rip-Rip/clang_complete', { 'for': ['c', 'cpp'] }
||   90 Plug 'Valloric/YouCompleteMe', { 'do': './install.sh --clang-completer --system-libclang' }
||   91 
||   92 
||   93  " Vim python-mode. PyLint, Rope, Pydoc, breakpoints from box.
||   94 Plug 'klen/python-mode', { 'for': 'python' }
||   95 
||   96 " Tern plugin for Vim 
||   97 Plug 'marijnh/tern_for_vim', { 'for': 'javascript', 'do': 'npm install' }
||   98 
||   99 if filereadable(expand("~/.vim/local_plugins.vim"))
||  100     source ~/.vim/local_plugins.vim
||  101 endif
||  102 call plug#end()
||  103 
+   -   104 +--100 lines: general options
104 " general options {{{1
|   105 set nocompatible        " force not to use the vi compatible mode
|   106 set showcmd             " Show (partial) command in status line.
|   107 set showmatch           " Show matching brackets.
|   108 set ignorecase          " Do case insensitive matching
|   109 set smartcase           " Do smart case matching
|   110 "set infercase          " Case matching for completion
|   111 set incsearch           " Incremental search
|   112 set hlsearch            " Highlight search
|   113 set autoread            " Automatically read changed files
|   114 set autowrite           " Automatically save before commands like :next and :make
|   115 "set hidden             " Hide buffers when they are abandoned
|   116 set mouse=n             " Enable mouse in normal mode for convenient window resizing
|   117 set ttymouse=xterm2     " force xterm2 mode, needed for screen and tmux
|   118 set title               " Set term title
|   119 set history=500         " keep 500 lines of command line history
|   120 set ruler               " show the cursor position all the time
|   121 set autoindent          " always set autoindenting on
|   122 set viminfo=!,'20,\"500 " read/write a .viminfo file, don't store more than
|   123                         " 500 lines of registers
|   124 set wildignore=*.o,*.obj,*.la,*.lo,*.so,*.pyc,*.pyo,*.jpg,*.png,*.gif " ignore this files in wildcard arguments
|   125 set scrolloff=5         " show some additional lines on the bottom
|   126 set nofoldenable        " bite me, I don't like folding default
|   127 set completeopt=longest,menu
|   128 set wildmenu            " Command-line completion menu
|   129 set exrc                " Allow local .vimrc files
|   130 set secure              " Make reading local .vimrc files more secure
|   131 if has('cryptmethod')
|   132     set cryptmethod=blowfish " Encrypt with Schneiers blowfish
|   133 endif
|   134 set switchbuf=usetab    " Reuse window from an existant tab if available
|   135 set noshowmode          " Don't show mode messages, we have a status line
|   136 set backspace=indent,eol,start
|   137 set modeline            " Force modeline
|   138 set foldmethod=marker   " Use fold-markers
|   139 set spelllang=en,de     " Spellchecking languages
|   140 set diffopt=filler,vertical " Diffs should be vertical
|   141 
|   142 " default tabstop settings
|   143 set tabstop=4
|   144 set softtabstop=4
|   145 set shiftwidth=4
|   146 set shiftround          " Round indent to a multiple of shiftwidth
|   147 set expandtab           " Use spaces instead of tabs by default
|   148 
|   149 set ttimeoutlen=0       " XXX still needs some testing
|   150 
|   151 set listchars=eol:$,tab:>-,trail:-,extends:>,precedes:<,nbsp:+
|   152 if &termencoding ==# 'utf-8' || &encoding ==# 'utf-8'
|   153   let &listchars = "tab:\u276f\u254c,trail:\u2423,extends:\u21c9,precedes:\u21c7,nbsp:\u26ad"
|   154   " fold:\u2500 doesn't work as expected
|   155   let &fillchars = "vert:\u2502,fold:\u2508"
|   156 endif
|   157 
|   158 if exists('+breakindent')
|   159     set breakindent
|   160 endif
|   161 
|   162 " use ',' as <leader>
|   163 let mapleader = " "
|   164 let g:xml_syntax_folding=1
|   165 
|   166 " this one it taken from tpope's vim-sensible plugin, but enables backups
|   167 " only if we use a cache directory
|   168 if isdirectory(expand('~/.cache'))
|   169   if &directory =~# '^\.,'
|   170     if !isdirectory(expand('~/.cache/vim/swap'))
|   171       call mkdir(expand('~/.cache/vim/swap'), 'p')
|   172     endif
|   173     set directory^=~/.cache/vim/swap//
|   174   endif
|   175   if &backupdir =~# '^\.,'
|   176     if !isdirectory(expand('~/.cache/vim/backup'))
|   177       call mkdir(expand('~/.cache/vim/backup'), 'p')
|   178     endif
|   179     set backupdir^=~/.cache/vim/backup//
|   180     set backup
|   181   endif
|   182   if exists('+undodir') && &undodir =~# '^\.\%(,\|$\)'
|   183     if !isdirectory(expand('~/.cache/vim/undo'))
|   184       call mkdir(expand('~/.cache/vim/undo'), 'p')
|   185     endif
|   186     set undodir^=~/.cache/vim/undo//
|   187   endif
|   188 endif
|   189 if exists('+undofile')
|   190   set undofile
|   191 endif
|   192 
|   193 if has('unnamedplus') || (has('nvim') && executable('xsel'))
|   194   " XXX: I'm not entirely satisfied with this
|   195   set clipboard^=unnamedplus
|   196 endif
|   197 
|   198 " Prefer silver searcher over grep
|   199 if executable('ag')
|   200     set grepprg=ag\ --nogroup\ --nocolor
|   201     " let g:ctrlp_user_command = 'ag %s -l --nocolor --nogroup -g ""'
|   202 endif
|   203 
+   -   204 +-- 18 lines: visual settings
204 " visual settings {{{1
|   205 syntax on               " we really want to use syntax highlighting
|   206 set background=dark
|   207 if &t_Co != 256 && ! has("gui_running")
|   208     color wombat
|   209 else
|   210     color marshmallow
|   211 endif
|   212 
|   213 
|   214 " TODO: Fix for 256 colors
|   215 " if &term =~ "xterm\\|rxvt"
|   216 "   " use an yellow cursor in insert mode
|   217 "   let &t_SI = "\<Esc>]12;yellow\x7"
|   218 "   " use a green cursor otherwise
|   219 "   let &t_EI = "\<Esc>]12;green\x7"
|   220 " endif
|   221 
+   -   222 +-- 15 lines: autocommands
222 " autocommands {{{1
|   223 " Uncomment the following to have Vim jump to the last position when
|   224 " reopening a file
|   225 if has("autocmd")
|   226   au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
|   227     \| exe "normal g'\"" | endif
|   228 endif
|   229 
|   230 " Uncomment the following to have Vim load indentation rules according to the
|   231 " detected filetype. Per default Debian Vim only load filetype specific
|   232 " plugins.
|   233 if has("autocmd")
|   234   filetype plugin indent on
|   235 endif
|   236 
+   -   237 +-- 10 lines: custom functions
237 " custom functions {{{1
|   238 function! ClosePreview()
|   239     exe "silent! wincmd P"
|   240     if &previewwindow
|   241         exe "close"
|   242     endif
|   243 endfunction
|   244 nnoremap <silent> <leader>cp :call ClosePreview()<CR>
|   245 
|   246 
+   -   247 +-- 20 lines: custom commands
247 " custom commands {{{1
|   248 " Most times I type :wq too fast... ;)
|   249 command! W w
|   250 command! Q q
|   251 command! Wq wq
|   252 command! WQ wq
|   253 
|   254 " write a file with sudo
|   255 command! Wsudo :execute ':silent w !sudo tee % > /dev/null' | :edit!
|   256 
|   257 " custom grep
|   258 command! -nargs=+ Grep execute 'silent grep! -s <args>' | :copen
|   259 
|   260 " generate ctags
|   261 command! GenCTags !ctags -R --c++-kinds=+p --fields=+iaS --extra=+q **/*.(c|cpp|h|hpp)
|   262 command! GenValaTags !anjuta-tags **/*.vala
|   263 
|   264 " kill whitespaces at the end of line
|   265 command! KillWhiteSpaces :%s/\s\+$//
|   266 
+   -   267 +--132 lines: key mappings
267 " key mappings {{{1
|   268 
|   269 " Function keys
|   270 nnoremap <silent> <F2> :SyntasticToggleMode<CR>
|   271 nnoremap <silent> <F3> :GitGutterToggle<CR>
|   272 nnoremap <silent> <F4> :set paste!<CR>
|   273 inoremap <silent> <F4> <C-O>:set paste!<CR>
|   274 nnoremap <silent> <F6> :NERDTreeToggle<CR>
|   275 nnoremap <silent> <F7> :Gstatus<CR>
|   276 nnoremap <silent> <F8> :Gdiff<CR>
|   277 nnoremap <silent> <F9> gg=G<C-O><C-O>
|   278 nnoremap <silent> <F10> :call ToggleExtraWhitespace()<CR>
|   279 nnoremap <silent> <F11> :TagbarToggle<CR>
|   280 
|   281 " paste while keeping the current indent
|   282 nnoremap <leader>p p`[v`]=
|   283 nnoremap <leader>P P`[v`]=
|   284 
|   285 " repeat the last command and put the cursor to the start of change
|   286 nnoremap . .`[
|   287 
|   288 " Jump to beginning/end of the line
|   289 inoremap <c-a> <c-o>I
|   290 inoremap <c-e> <c-o>A
|   291 cnoremap <c-a> <home>
|   292 cnoremap <c-e> <end>
|   293 
|   294 " make <c-n> <c-p> behave like <up> and <down> in cmdline
|   295 if v:version >= 704
|   296     cnoremap <expr> <C-n> wildmenumode() ? "\<Right>" : "\<Down>"
|   297     cnoremap <expr> <C-p> wildmenumode() ? "\<Left>" : "\<Up>"
|   298 else
|   299     cnoremap <C-n> <Down>
|   300     cnoremap <C-p> <Up>
|   301 endif
|   302 
|   303 " changing tabs
|   304 nnoremap <c-p> :tabprevious<CR>
|   305 nnoremap <c-n> :tabnext<CR>
|   306 
|   307 " toggle nerd-tree (plugin)
|   308 nnoremap <leader>e :NERDTreeToggle<CR>
|   309 
|   310 " git mappings (fugitive plugin)
|   311 nnoremap <leader>gs :Gstatus<CR>
|   312 nnoremap <leader>gd :Gvdiff<CR>
|   313 nnoremap <leader>gc :Gcommit -v<CR>
|   314 nnoremap <leader>gw :Gwrite<CR>
|   315 nnoremap <leader>gr :Gread<CR>
|   316 nnoremap <leader>gp :Gpush<CR>
|   317 nnoremap <leader>gb :Gblame<CR>
|   318 
|   319 " gitv
|   320 nnoremap <leader>gv :Gitv<CR>
|   321 nnoremap <leader>gV :Gitv!<CR>
|   322 
|   323 " UndoTree
|   324 nnoremap <silent> <leader>u :UndotreeToggle<CR>
|   325 
|   326 " pep8 check
|   327 nnoremap <leader>8 :call Pep8()<CR>
|   328 
|   329 " external git viewer
|   330 nnoremap <leader>T :silent !tig<CR> :redraw!<CR>
|   331 
|   332 " open TagBar in one-shot mode
|   333 nnoremap <silent> <leader>t :TagbarOpen fj<CR>
|   334 
|   335 " Ack
|   336 nnoremap <leader>a :Ack!<space>
|   337 
|   338 " FIXME: why the hell do I have this mapping?
|   339 " search for strings
|   340 nnoremap <leader>l :s/['"].*['"]/_\(\0\)/<CR>
|   341 
|   342 " map Y to act like D and C, i.e. to yank until EOL, rather than act as yy,
|   343 " which is the default
|   344 nnoremap Y y$
|   345 
|   346 " visually select the text that was last edited/pasted
|   347 nmap gV `[v`]
|   348 
|   349 " Use Q to execute @q macros
|   350 nnoremap Q @q
|   351 vnoremap Q :norm @q<cr>
|   352 
|   353 " Shortcut to compile stuff (uses dispatch plugin)
|   354 nnoremap <leader>m :Make<CR>
|   355 
|   356 " Update the diff view when it get's messed up
|   357 " TODO: filetype only
|   358 nnoremap du :diffupdate<CR>
|   359 
|   360 " unhighlight the last search result and redraw
|   361 nnoremap <silent> <leader>n :nohls<CR><C-L>
|   362 nnoremap <silent> <leader><C-L> :nohls<CR>:syntax sync fromstart<CR><C-L>
|   363 inoremap <silent> <C-L> <C-O>:nohls<CR>
|   364 
|   365 " moving between windows
|   366 nnoremap <C-h> <C-w>h
|   367 nnoremap <C-j> <C-w>j
|   368 nnoremap <C-k> <C-w>k
|   369 nnoremap <C-l> <C-w>l
|   370 
|   371 " draw some headlines
|   372 nnoremap <leader>h1 yypVr=o
|   373 nnoremap <leader>h2 yypVr-o
|   374 nnoremap <leader>h3 :s/\(.+\)/-\1-/<cr>o
|   375 
|   376 " Use q to close the quickfix window
|   377 nnoremap <silent> <leader>q :cclose<bar>lclose<CR>
|   378 au FileType qf map <buffer> q <C-W>c
|   379 
|   380 " map <C-Space> to <TAB>
|   381 imap <Nul> <TAB>
|   382 
|   383 vnoremap + "+y
|   384 vnoremap * "*y
|   385 
|   386 " use the blackhole register for uppercase C and D in visual mode
|   387 vnoremap C "_c
|   388 vnoremap D "_d
|   389 
|   390 " Initial attempt to match C functions
|   391 vnoremap <silent> if :<C-U>silent! normal! ][vi{<CR>
|   392 vnoremap <silent> af :<C-U>silent! normal! ][va{o{jo}<CR>
|   393 omap if :normal Vif<CR>
|   394 omap af :normal Vaf<CR>
|   395 
|   396 " Toggle signature plugin
|   397 nnoremap com :SignatureToggle<CR>
|   398 
+   -   399 +-- 21 lines: filetype detection
399 " filetype detection {{{1
|   400 augroup FileTypeDetect
|   401     au!
|   402     au BufRead /var/log/kern.log set ft=messages
|   403     au BufRead /var/log/syslog setl ft=messages
|   404     au BufNewFile,BufRead /etc/apache/* setl ft=apache
|   405     au BufNewFile,BufRead /etc/apache2/* setl ft=apache
|   406     au BufNewFile,BufRead /etc/nginx/* setl ft=nginx
|   407     au BufNewFile,BufRead /etc/exim4/* setl ft=exim
|   408     au BufNewFile,BufRead *.txt setl ft=text
|   409     au BufNewFile,BufRead *.tac setl ft=python " .tac files are used in twisted
|   410     au BufNewFile,BufRead *.override setl ft=c " pygobject overrides
|   411     au BufNewFile,BufRead *.defs setl syntax=scheme et " pygobject definitions
|   412     au BufNewFile,BufRead *.vala setl ft=vala
|   413     au BufNewFile,BufRead *.vapi setl ft=vala
|   414     au BufNewFile,BufRead *.qml setl ft=javascript
|   415     au BufNewFile,BufRead *.otl setl ft=votl
|   416     au BufNewFile,BufRead *.jeco setl ft=eco
|   417     au BufNewFile,BufRead *.glsl setl ft=c
|   418 augroup END
|   419 
+   -   420 +-- 74 lines: filetype settings
420 " filetype settings {{{1
|   421 " TODO: Move this stuff to augroups
|+  |-  422 +--- 20 lines: C/C++
422 " C/C++ {{{2
||  423 function! CSettings()
||  424     setlocal cindent
||  425     setlocal cinoptions=>4,n-2,{2,^-2,:2,=2,g0,h2,p5,t0,+2,(0,u0,w1,m1
||  426     setlocal sw=2 ts=5 et
||  427     setlocal synmaxcol=200  " Prevent massive slowdown with large C files
||  428     setlocal foldmethod=marker
||  429     if !&relativenumber
||  430         setlocal number
||  431     endif
||  432     nnoremap <buffer> <silent> <leader>A :GNOMEAlignArguments<CR>
||  433     nnoremap <buffer> <silent> <leader>gq [[=a}:GNOMEAlignArguments<CR>
||  434     " TODO: need a new mapping for this one
||  435     " nnoremap <buffer> <silent> <leader>gD [[}O
||  436     " nnoremap <buffer> <silent> <leader>gd [{}O
||  437     nnoremap <buffer> <silent> <leader>gi ?^#include<CR>:nohlsearch<CR>
||  438     let b:surround_105 = "#if 0\n\r\n#endif"
||  439 endfunction
||  440 au FileType c,h,cpp,gobject call CSettings()
||  441 
|+  |-  442 +--- 17 lines: Python
442 " Python {{{2
||  443 function! PySettings()
||  444     " setlocal omnifunc=pythoncomplete#Complete
||  445     setlocal expandtab
||  446     setlocal foldmethod=indent
||  447     setlocal tabstop=4
||  448     setlocal makeprg=python\ %
||  449     setlocal efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
||  450     if !&relativenumber
||  451         setlocal number
||  452     endif
||  453     let python_highlight_all = 1
||  454     let b:surround_{char2nr("d")} = "\"\"\" \r \"\"\""
||  455 endfunction
||  456 au FileType python call PySettings()
||  457 let python_highlight_all = 1
||  458 
|+  |-  459 +--- 35 lines: Other
459 " Other {{{2
||  460 au FileType c,h,cpp,vala,javascript nnoremap <buffer> <silent> ) :call search('(\\|)\\|{\\|}\\|\[\\|\]')<CR>
||  461 au FileType c,h,cpp,vala,javascript nnoremap <buffer> <silent> ( :call search('(\\|)\\|{\\|}\\|\[\\|\]', 'b')<CR>
||  462 " au FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
||  463 au FileType javascript setlocal sw=2 sts=2 ts=2 et cindent nu rnu
||  464 au FileType javascript inorea <buffer> pt prototype
||  465 au FileType javascript nnoremap gd :TernDef<CR>
||  466 au FileType javascript nnoremap K :TernDoc<CR>
||  467 au FileType html setlocal omnifunc=htmlcomplete#CompleteTags
||  468 au FileType html setlocal foldmethod=syntax et sw=2 sts=2 ts=2 nu rnu
||  469 au FileType html let b:surround_{char2nr("d")} = "<div>\r</div"
||  470 au FileType css setlocal omnifunc=csscomplete#CompleteCSS et sw=2 sts=2 ts=2 nu rnu
||  471 au FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
||  472 au FileType xml setlocal foldmethod=syntax
||  473 au FileType php setlocal omnifunc=phpcomplete#CompletePHP
||  474 au FileType text setlocal tw=78
||  475 au FileType mail setlocal tw=72
||  476 au FileType vala setlocal efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m
||  477 au FileType vala setlocal ts=4 sw=4 et cindent
||  478 au FileType vala setlocal cinwords+=foreach
||  479 au FileType vala setlocal fo=croql nu rnu
||  480 au FileType vala setlocal cinoptions=>4,n0,{2,^-2,:0,=2,g0,h2,p5,t0,+2,(0,u0,w1,m1,N-8,j4
||  481 au FileType config setlocal et
||  482 au FileType coffee setlocal et sw=2 sts=2 fdm=indent
||  483 au FileType vo_base setlocal foldenable
||  484 au FileType votl setlocal foldenable
||  485 au FileType votl hi link VotlCheckBox WarningMsg
||  486 au FileType votl hi link VotlChecked SpecialKey
||  487 au FileType votl hi link VotlPercentage SpecialKey
||  488 au FileType jade setl et sw=2 sts=2
||  489 au FileType stylus setl sw=2 sts=2
||  490 au FileType nginx setl iskeyword-=.,/,: commentstring=#%s noet
||  491 au FileType go setl ts=4 nu rnu
||  492 au Filetype arduino setl commentstring=//%s
||  493 
+   -   494 +-- 13 lines: abbreviations
494 " abbreviations {{{1
|   495 " typos
|   496 iabbr slef self
|   497 iabbr sefl self
|   498 
|   499 " shortcuts (FIXME: use snipmate for this)
|   500 iabbr pynone Py_INCREF (Py_None);<CR>return Py_None;<CR>}
|   501 iabbr pyargs PyArg_ParseTuple (args,
|   502 iabbr pykwargs PyArg_ParseTupleAndKeywords (args, kwargs,
|   503 
|   504 " abbreviate git to fugitives Git
|   505 " cnoreabbrev git Git
|   506 
+   -   507 +--325 lines: plugin settings
507 " plugin settings {{{1
|   508 runtime! ftplugin/man.vim
|+  |-  509 +---  3 lines: Supertab completion
509 " Supertab completion {{{
||  510 let g:SuperTabDefaultCompletionType = "context"
||  511 
|+  |-  512 +--- 65 lines: CtrlP
512 " CtrlP {{{2
||  513 let g:ctrlp_map = '<leader>f'
||  514 let g:ctrlp_match_func = {'match' : 'matcher#cmatch' }
||  515 " Having more results than maximum lines seems to be pretty slow
||  516 let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:20,results:200'
||  517 let g:ctrlp_working_path_mode = 'ra'
||  518 let g:ctrlp_arg_map = 1
||  519 let g:ctrlp_open_multiple_files = '3vjr'
||  520 let g:ctrlp_max_files = 20000
||  521 let g:ctrlp_dotfiles = 0
||  522 let g:ctrlp_root_markers = ['.git', '.hg', '.bzr', 'tags', 'TAGS', 'configure.ac', 'configure.in']
||  523 let g:ctrlp_switch_buffer = 'Et'
||  524 let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'dir', 'line', 'changes']
||  525 let g:ctrlp_custom_ignore = {
||  526         \ 'dir': '\v[\/](node_modules|.*\.egg-info|po)$'
||  527         \ }
||  528 
||  529 " special buffer types
||  530 let g:ctrlp_buftag_types = {}
||  531 if executable('coffeetags')
||  532   let g:ctrlp_buftag_types.coffee = {
||  533         \ 'bin': 'coffeetags',
||  534         \ 'args': '-f -',
||  535         \ }
||  536 endif
||  537 if executable('anjuta-tags')
||  538   let g:ctrlp_buftag_types.vala = {
||  539         \ 'bin': 'anjuta-tags',
||  540         \ 'args': '-f - --sort=no --excmd=pattern --fields=nKs',
||  541         \ }
||  542 endif
||  543 
||  544 let g:ctrlp_buffer_func = { 'enter': 'CtrlPBDelete' }
||  545 
||  546 function! CtrlPBDelete()
||  547   nnoremap <buffer> <silent> <c-@> :call <sid>DeleteMarkedBuffers()<cr>
||  548 endfunction
||  549 
||  550 function! s:DeleteMarkedBuffers()
||  551   " list all marked buffers
||  552   let marked = ctrlp#getmarkedlist()
||  553 
||  554   " the file under the cursor is implicitly marked
||  555   if empty(marked)
||  556     call add(marked, fnamemodify(ctrlp#getcline(), ':p'))
||  557   endif
||  558 
||  559   " call bdelete on all marked buffers
||  560   for fname in marked
||  561     let bufid = fname =~ '\[\d\+\*No Name\]$' ? str2nr(matchstr(fname, '\d\+'))
||  562           \ : fnamemodify(fname[2:], ':p')
||  563     exec "silent! bdelete" bufid
||  564   endfor
||  565 
||  566   " refresh ctrlp
||  567   exec "normal \<F5>"
||  568 endfunction
||  569 
||  570 nnoremap <silent> <leader>F :CtrlP .<CR>
||  571 nnoremap <silent> <leader><space> :CtrlPLastMode<CR>
||  572 nnoremap <silent> <leader>r :CtrlPMRUFiles<CR>
||  573 nnoremap <silent> <leader>b :CtrlPBuffer<CR>
||  574 nnoremap <silent> <leader>/ m':CtrlPBufTag<CR>
||  575 nnoremap <silent> <leader>] :CtrlPTag<CR>
||  576 
|+  |-  577 +---  4 lines: UltiSnips
577 " UltiSnips {{{2
||  578 let g:UltiSnipsEditSplit = 'horizontal'
||  579 " let g:UltiSnipsExpandTrigger = "<Nul>"
||  580 
|+  |-  581 +--- 22 lines: Python-mode
581 " Python-mode {{{2
||  582 let g:pymode = 1
||  583 let g:pymode_options = 0 " don't setup defaults
||  584 let g:pymode_folding = 1
||  585 let g:pymode_motion = 1
||  586 let g:pymode_doc = 1
||  587 let g:pymode_virtualenv = 1
||  588 let g:pymode_run = 0
||  589 let g:pymode_breakpoint = 0
||  590 let g:pymode_breakpoint_bind = '<leader>db'
||  591 let g:pymode_lint = 1 " done by syntastic
||  592 let g:pymode_lint_on_write = 0
||  593 let g:pymode_lint_signs = 0
||  594 let g:pymode_lint_checker = ['pyflakes', 'pep8']
||  595 let g:pymode_rope = 0
||  596 let g:pymode_rope_completion = 0 " we'll use jedi completion
||  597 let g:pymode_rope_complete_on_dot = 0
||  598 let g:pymode_rope_goto_definition_bind = 'gd'
||  599 let g:pymode_syntax = 1
||  600 let g:pymode_syntax_all = 1
||  601 au FileType python nmap <buffer> <leader>l :PymodeLint<CR>
||  602 
|+  |-  603 +--- 19 lines: Tagbar
603 " Tagbar {{{2
||  604 let g:tagbar_compact = 1
||  605 let g:tagbar_autofocus = 1
||  606 if executable('coffeetags')
||  607   let g:tagbar_type_coffee = {
||  608         \ 'ctagsbin' : 'coffeetags',
||  609         \ 'ctagsargs' : '',
||  610         \ 'kinds' : [
||  611         \ 'f:functions',
||  612         \ 'o:object',
||  613         \ ],
||  614         \ 'sro' : ".",
||  615         \ 'kind2scope' : {
||  616         \ 'f' : 'object',
||  617         \ 'o' : 'object',
||  618         \ }
||  619         \ }
||  620 endif
||  621 
|+  |-  622 +--- 99 lines: Unite
622 " Unite {{{2
||+ ||- 623 +---- 14 lines: Mappings
623 " Mappings {{{3
||| 624 " I still don't use Unite for finding files as CtrlP with the cmatcher is a
||| 625 " lot faster for me...
||| 626 nnoremap <silent> <leader>^M :<C-u>UniteResume<CR>
||| 627 nnoremap <silent> <leader>b :<C-u>Unite -buffer-name=buffer -start-insert -default-action=goto buffer<CR>
||| 628 nnoremap <silent> <leader>r :<C-u>Unite -buffer-name=register -start-insert register<CR>
||| 629 nnoremap <silent> <leader>y :<C-u>Unite -buffer-name=yank -start-insert history/yank<CR>
||| 630 nnoremap <silent> <leader>d :<C-u>Unite -buffer-name=cd -start-insert -default-action=cd directory<CR>
||| 631 nnoremap <silent> <leader>G :<C-u>Unite -buffer-name=grep -no-quit grep:.:-i<CR>
||| 632 nnoremap <silent> <leader>x :<C-u>execute 'Unite grep:.:-w:' . expand("<cword>")<CR>
||| 633 nnoremap <silent> <leader>o :<C-u>Unite -buffer-name=outline -start-insert outline<CR>
||| 634 nnoremap <silent> <leader>: :<C-u>Unite -buffer-name=cmd -start-insert command<CR>
||| 635 nnoremap <silent> <leader>gf :<C-u>Unite -buffer-name=files -start-insert file_rec/git<CR>
||| 636 
||+ ||- 637 +---- 65 lines: Settings
637 " Settings {{{3
||| 638 let g:unite_split_rule = 'botright'
||| 639 let g:unite_winheight = 15
||| 640 let g:unite_enable_start_insert = 0
||| 641 let g:unite_source_history_yank_enable = 1
||| 642 let g:unite_prompt = '❯ '
||| 643 let g:unite_marked_icon = '•'
||| 644 
||| 645 let g:unite_source_alias_aliases = {
||| 646     \   'ag': {
||| 647     \       'source': 'grep',
||| 648     \       'args': '.'
||| 649     \   }
||| 650     \ }
||| 651 
||| 652 call unite#custom#profile('default', 'context', {
||| 653     \   'start_insert': 0,
||| 654     \   'winheight': 15,
||| 655     \   'direction': 'botright',
||| 656     \   'prompt': '❯ ',
||| 657     \   'marked_icon': '•',
||| 658     \   'cursor_line_time': '0.01',
||| 659     \ })
||| 660 
||| 661 " We want fuzzy matching by default
||| 662 call unite#filters#matcher_default#use(['matcher_fuzzy'])
||| 663 " TODO: evaluate the different sorters
||| 664 "call unite#filters#sorter_default#use(['sorter_selecta'])
||| 665 
||| 666 " call unite#custom#profile('source/grep', 'context', {
||| 667 " \   'no_quit' : 1
||| 668 " \ })
||| 669 
||| 670 " Use silver-searcher if available
||| 671 if executable('ag')
||| 672     let g:unite_source_grep_command = 'ag'
||| 673     let g:unite_source_grep_default_opts = '--line-numbers --nocolor ' .
||| 674             \ '--nogroup --hidden --ignore ''.hg'' --ignore ''.svn'' ' .
||| 675             \ '--ignore ''.git'' --ignore ''.bzr'''
||| 676     let g:unite_source_grep_recursive_opt = ''
||| 677 endif
||| 678 
||| 679 " Source specific settings
||| 680 
||| 681 " Ignore patterns
||| 682 call unite#custom#source('file,file_rec,file_rec/async', 'ignore_pattern',
||| 683     \ 'bundle\|node_modules\|bower_components\|\.git\|\.hg\|\.svn\|\.hg')
||| 684 call unite#custom#source('file,file_rec,file_rec/async,grep', 'ignore_globs',
||| 685     \ split(&wildignore, ','))
||| 686 
||| 687 " Increase maximum candidates
||| 688 call unite#custom#source('file,file_rec,file_rec/async,grep', 'max_candidates',
||| 689     \ 10000)
||| 690 
||| 691 " Use the fuzzy matcher for grep results and commands
||| 692 call unite#custom#source('grep', 'matchers', ['matcher_fuzzy'])
||| 693 call unite#custom#source('command', 'matchers', ['matcher_fuzzy'])
||| 694 
||| 695 " File sources should only use project files
||| 696 call unite#custom#source('file,file_rec,file_rec/async', 'matchers',
||| 697     \ ['matcher_project_ignore_files', 'converter_relative_word', 'matcher_fuzzy'])
||| 698 call unite#custom#source('file_mru', 'matchers',
||| 699     \ ['matcher_project_files', 'matcher_fuzzy'])
||| 700 call unite#custom#source('buffer', 'matchers', ['matcher_default', 'matcher_hide_current_file'])
||| 701 
||+ ||- 702 +---- 19 lines: Unite buffer settings
702 " Unite buffer settings {{{3
||| 703 function! s:unite_settings()
||| 704     let b:SuperTabDisabled=1 " Make sure SuperTab is disabled
||| 705     " Force exit with <C-c>
||| 706     imap <buffer> <C-c> <Plug>(unite_exit)
||| 707     nmap <buffer> <C-c> <Plug>(unite_exit)
||| 708     nmap <buffer> <Esc> <Plug>(unite_exit)
||| 709     nmap <buffer> <C-p> <Plug>(unite_toggle_auto_preview)
||| 710     " CtrlP style key mappings
||| 711     imap <buffer> <C-j> <Plug>(unite_select_next_line)
||| 712     imap <buffer> <C-k> <Plug>(unite_select_previous_line)
||| 713     nmap <buffer> <c-j> <Plug>(unite_loop_cursor_down)
||| 714     nmap <buffer> <c-k> <Plug>(unite_loop_cursor_up)
||| 715     imap <buffer> <C-z> <Plug>(unite_toggle_mark_current_candidate)
||| 716     imap <buffer><expr> <C-x> unite#do_action('split')
||| 717     imap <buffer><expr> <C-v> unite#do_action('vsplit')
||| 718 endfunction
||| 719 autocmd FileType unite call s:unite_settings()
||| 720 
|+  |-  721 +---  4 lines: Calendar
721 " Calendar {{{2
||  722 let g:calendar_diary = '~/.diary'
||  723 let g:calendar_monday = 1
||  724 
|+  |-  725 +---  3 lines: NERDTree
725 " NERDTree {{{2
||  726 let NERDTreeIgnore = ['\.o$', '\.obj$', '\.la$', '\.lo$', '\.so$', '\.pyc$', '\~$']
||  727 
|+  |-  728 +---  4 lines: EasyMotion
728 " EasyMotion {{{2
||  729 let g:EasyMotion_leader_key = '\'
||  730 nmap s <Plug>(easymotion-s)
||  731 
|+  |-  732 +--- 11 lines: GitGutter
732 " GitGutter {{{2
||  733 let g:gitgutter_enabled = 0
||  734 let g:gitgutter_sign_added = '+'
||  735 let g:gitgutter_sign_modified = '±'
||  736 let g:gitgutter_sign_removed = '-'
||  737 let g:gitgutter_sign_modified_removed = '±-'
||  738 
||  739 nnoremap <silent> cog :GitGutterToggle<CR>
||  740 nnoremap <silent> ]h :<C-U>execute v:count1 . "GitGutterNextHunk"<CR>
||  741 nnoremap <silent> [h :<C-U>execute v:count1 . "GitGutterPrevHunk"<CR>
||  742 
|+  |-  743 +---  4 lines: Ack
743 " Ack {{{2
||  744 let g:ackprg = 'ag --nogroup --nocolor --column'
||  745 let g:ack_use_dispatch = 0
||  746 
|+  |-  747 +--- 14 lines: syntastic
747 " syntastic {{{2
||  748 nnoremap <silent> coq :SyntasticToggleMode<CR>
||  749 let g:syntastic_error_symbol = '✗'
||  750 let g:syntastic_warning_symbol = '⚠'
||  751 let g:syntastic_c_no_include_search = 1
||  752 let g:syntastic_check_on_wq = 0
||  753 let g:syntastic_always_populate_loc_list = 1
||  754 " Use passive mode by default, useful for slow machines
||  755 let g:syntastic_mode_map = {
||  756             \'mode': 'passive',
||  757             \ 'active_filetypes': [],
||  758             \ 'passive_filetypes': []
||  759             \ }
||  760 
|+  |-  761 +---  3 lines: rel-jump
761 " rel-jump {{{2
||  762 let g:rel_jump_first_char = 1
||  763 
|+  |-  764 +--- 21 lines: Completion plugins
764 " Completion plugins {{{2
||  765 " ...still looking for my great love
||  766 
||+ ||- 767 +----  8 lines: Clang complete
767 " Clang complete {{{3
||| 768 let g:clang_complete_auto = 0
||| 769 let g:clang_snippets = 0
||| 770 let g:clang_snippets_engine = 'ultisnips'
||| 771 let g:clang_conceal_snippets = 1
||| 772 let g:clang_debug = 0
||| 773 let g:clang_jumpto_declaration_key = 'gd'
||| 774 
||+ ||- 775 +----  6 lines: jedi completion
775 " jedi completion {{{3
||| 776 let g:jedi#auto_initialization = 1
||| 777 let g:jedi#popup_on_dot = 0
||| 778 let g:jedi#goto_assignments_command = "<leader>g"
||| 779 let g:jedi#goto_definitions_command = "gd"
||| 780 
||+ ||- 781 +----  4 lines: Tern completion
781 " Tern completion {{{3
||| 782 let g:tern_show_signature_in_pum = 1
||| 783 let g:tern_request_timeout = 3
||| 784 
|+  |-  785 +--- 25 lines: airline
785 " airline {{{2
||  786 set laststatus=2
||  787 let g:airline_powerline_fonts = 1
||  788 if !exists('g:airline_symbols')
||  789     let g:airline_symbols = {}
||  790 endif
||  791 
||  792 let g:airline#extensions#syntastic#enabled = 1
||  793 let g:airline#extensions#hunks#enabled = 1
||  794 let g:airline#extensions#hunks#non_zero_only = 1
||  795 let g:airline#extensions#virtualenv#enabled = 1
||  796 let g:airline#extensions#whitespace#enabled = 1
||  797 let g:airline#extensions#tagbar#enabled = 1
||  798 let g:airline#extensions#whitespace#trailing_format = '●[%s]'
||  799 let g:airline#extensions#whitespace#mixed_indent_format = '○[%s]'
||  800 let g:airline#extensions#tabline#enabled = 1
||  801 let g:airline#extensions#tabline#show_buffers = 0
||  802 let g:airline#extensions#tabline#show_tab_type = 0
||  803 let g:airline#extensions#tabline#tab_min_count = 2
||  804 " safe some space
||  805 "let g:airline_section_x = airline#section#create_right(['filetype'])
||  806 let g:airline_section_z = airline#section#create_right(['%p%%:%l:%2c'])
||  807 
||  808 
||  809 
|+  |-  810 +--- 19 lines: vim-go
810 " vim-go {{{2
||  811 let g:go_disable_autoinstall = 1
||  812 
||  813 " more highlighting
||  814 let g:go_highlight_operators = 1
||  815 let g:go_highlight_functions = 1
||  816 let g:go_highlight_methods = 1
||  817 let g:go_highlight_structs = 1
||  818 let g:go_highlight_interfaces = 1
||  819 
||  820 " use goimports instead of gofmt for formatting code on write
||  821 let g:go_fmt_command = "gofmt"
||  822 let g:go_auto_type_info = 0
||  823 
||  824 " some golang specific mappings
||  825 au FileType go nmap <buffer> gd <Plug>(go-def)
||  826 au FileType go nmap <buffer> gD <Plug>(go-def-split)
||  827 au FileType go nmap <buffer> <leader>i <Plug>(go-info)
||  828 
|+  |-  829 +---  3 lines: UndoTree
829 " UndoTree {{{2
||  830 let g:undotree_SetFocusWhenToggle = 1
||  831 
+   -   832 +-- 11 lines: local vimrc
832 " local vimrc {{{1
|   833 " For local machine wide modifications
|   834 if filereadable(expand("~/.vimrc.local"))
|   835     source ~/.vimrc.local
|   836 endif
|   837 " Modifications per git repository. This file even survives a git clean -xdf
|   838 if filereadable(getcwd() . "/.git/vimrc")
|   839     source .git/vimrc
|   840 endif
|   841 
|   842 " vim: foldmethod=marker foldmarker={{{,}}} foldenable