3 " Author:   Samir Benmendil <samir.benmendil[at]gmail[dot]com>
 
   8 set runtimepath& " reset rtp
 
   9 " remove all autocommands
 
  12 set runtimepath+=$XDG_DATA_HOME/vim/vundle
 
  13 call vundle#rc('$XDG_DATA_HOME/vim')
 
  15 Plugin 'gmarik/vundle'
 
  17 Plugin 'airblade/vim-gitgutter'
 
  18 Plugin 'bling/vim-airline'
 
  19 Plugin 'derekwyatt/vim-fswitch'
 
  20 Plugin 'elzr/vim-json'
 
  21 Plugin 'firef0x/pkgbuild.vim'
 
  22 Plugin 'junegunn/vim-easy-align'
 
  23 " Plugin 'kien/ctrlp.vim'
 
  24 " Plugin 'klen/python-mode'
 
  25 Plugin 'wilywampa/python-mode'
 
  26 Plugin 'kshenoy/vim-signature'
 
  27 Plugin 'majutsushi/tagbar'
 
  28 Plugin 'raimondi/delimitmate'
 
  29 " Plugin 'rking/ag.vim'
 
  30 Plugin 'scrooloose/nerdtree'
 
  31 Plugin 'scrooloose/syntastic'
 
  32 Plugin 'shougo/vimproc.vim'
 
  33 Plugin 'shougo/unite.vim'
 
  34 Plugin 'sjl/gundo.vim'
 
  35 Plugin 'tomtom/tcomment_vim'
 
  36 Plugin 'tpope/vim-endwise'
 
  37 Plugin 'tpope/vim-fugitive'
 
  38 Plugin 'tpope/vim-repeat'
 
  39 Plugin 'tpope/vim-surround'
 
  40 Plugin 'tpope/vim-unimpaired'
 
  41 Plugin 'valloric/youcompleteme'
 
  42 Plugin 'vim-scripts/yankring.vim'
 
  45 Plugin 'sirver/ultisnips'
 
  46 Plugin 'honza/vim-snippets'
 
  49 Plugin 'kana/vim-textobj-user'
 
  50 Plugin 'julian/vim-textobj-variable-segment'
 
  51 Plugin 'sgur/vim-textobj-parameter'
 
  54 Plugin 'ompugao/ros.vim'
 
  55 Plugin 'ompugao/ctrlp-ros'
 
  57 " seems to have problems right now... may be add later?
 
  58 " Plugin 'jalcine/cmake.vim'
 
  59 " Plugin 'powerman/vim-plugin-viewdoc'
 
  62 " find an alternative (latex-box? Automatic Latex Plugin?)
 
  63 Plugin 'http://git.code.sf.net/p/vim-latex/vim-latex'
 
  64 " Plugin 'lokaltog/vim-easymotion'
 
  65 Plugin 'justinmk/vim-sneak'
 
  66 Plugin 'chrisbra/checkattach'
 
  67 Plugin 'nathanaelkane/vim-indent-guides'
 
  69 Plugin 'vim-scripts/mediawiki.vim'
 
  70 Plugin 'tpope/vim-abolish'
 
  72 " remove entries first
 
  73 set runtimepath -=$HOME/.vim
 
  74 set runtimepath -=$HOME/.vim/after
 
  75 set runtimepath -=$XDG_CONFIG_HOME/vim
 
  76 set runtimepath -=$XDG_CONFIG_HOME/vim/after
 
  77 " then prepend and append them
 
  78 set runtimepath ^=$XDG_CONFIG_HOME/vim
 
  79 set runtimepath +=$XDG_CONFIG_HOME/vim/after
 
  81 filetype plugin indent on
 
  88 " moving around, searching and patterns {{{2
 
  89 set incsearch           " show match for partly typed search command
 
  90 set ignorecase          " ignore case when using a search pattern
 
  91 set smartcase           " override 'ignorecase' when pattern has upper case characters
 
  92 set hlsearch            " highlight all matches for the last used search pattern
 
  94 set nostartofline       " don't move the cursor to the first non-blank char of a line
 
  95 set path=.,include/,../include/,/usr/include/c++/*,/opt/ros/hydro/include
 
  97 " displaying text {{{2
 
  98 set scrolloff=5                 " number of screen lines to show around the cursor
 
  99 set nowrap                      " long lines wrap
 
 100 set linebreak                   " wrap long lines at a character in 'breakat'
 
 101 set showbreak=↪                 " show these chars for wrapped lines
 
 103 set lazyredraw                  " don't redraw while executing macros
 
 105 set list                        " show chars defined in 'listchars'
 
 106 set listchars=tab:❭\            " list of strings used for list mode
 
 107 set listchars+=extends:❯,precedes:❮
 
 108 " Only shown when not in insert mode
 
 111     au InsertEnter * :set listchars-=trail:·
 
 112     au InsertLeave * :set listchars+=trail:·
 
 115 set sidescroll=1                " number of collumns to scroll
 
 116 set sidescrolloff=1             " don't scroll over the listchars
 
 118 set fillchars=diff:⣿,vert:│
 
 120 set nonumber                    " show the line number for each line
 
 121 set norelativenumber            " show the relative line number for each line
 
 123 " syntax, highlighting and spelling {{{2
 
 124 set synmaxcol=800               " don't highlight long lines
 
 126 set dictionary=spell            " list of dictionary files for keyword completion
 
 130 " multiple windows {{{2
 
 131 set laststatus=2                " 0, 1 or 2; when to use a status line for the last window
 
 133 set previewheight=20            " default height for the preview window
 
 137 " set splitbelow                  " a new window is put below of the current one
 
 138 set splitright                  " a new window is put right of the current one
 
 143 " using the mouse {{{2
 
 144 set mouse=rnv                   " list of flags for using the mouse
 
 145 set ttymouse=xterm              " type of mouse
 
 147 " messages and info {{{2
 
 148 set showcmd                     " Show (partial) command in status line.
 
 149 set ruler                       " show the cursor position all the time
 
 150 set confirm                     " Ask what to do when closing unsaved documents
 
 151 set shortmess=filnxtoOI         " don't show intro message
 
 154 set backspace=indent,eol,start  " allow backspacing over everything in insert mode
 
 156 set showmatch                   " Show matching brackets.
 
 158 set nojoinspaces                " don't use two spaces after '.' when joining a line
 
 159 set formatoptions=jcrnql
 
 161 set nrformats=hex               " number formats recognized for CTRL-A and CTRL-X commands
 
 163 set complete=.,w,b,u,t
 
 164 " whether to use a popup menu for Insert mode completion
 
 165 set completeopt=longest,menuone,preview
 
 167 " tabs and indent {{{2
 
 168 set shiftwidth=4                " number of spaces used for each step of (auto)indent
 
 169 set smarttab                    " a <Tab> in an indent inserts 'shiftwidth' spaces
 
 170 set softtabstop=4               " if non-zero, number of spaces to insert for a <Tab>
 
 171 set shiftround                  " round to 'shiftwidth' for "<<" and ">>"
 
 172 set expandtab                   " expand <Tab> to spaces in Insert mode
 
 175 set pastetoggle=<F11>           " key sequence to toggle paste mode
 
 178 set foldmethod=marker           " folding type
 
 179 set foldlevelstart=0            " value for 'foldlevel' when starting to edit a file
 
 181 " save and restore folds
 
 182 set viewoptions=cursor          " only save cursor position
 
 185 set diffopt=filler,vertical
 
 187 " reading and writing files {{{2
 
 188 set modeline                    " read modelines
 
 189 set modelines=2                 " only check first/last 2 lines
 
 191 set writebackup                 " write a backup file before overwriting a file
 
 192 set backup                      " keep a backup after owerwriting a file
 
 193 set backupdir=$XDG_CACHE_HOME/vim/backup//
 
 195 set backupskip+=.netrc          " skip netrc
 
 196 set backupskip+=/dev/shm/pass*  " skip passwordstore files
 
 198 set undofile                    " persistent undo history
 
 199 set undodir=$XDG_CACHE_HOME/vim/undo//
 
 203     au BufWritePre .netrc         setlocal noundofile
 
 204     au BufWritePre /dev/shm/pass* setlocal noundofile
 
 205     au BufWritePre /tmp/*         setlocal noundofile
 
 208 set autowrite                   " automatically write a file when leaving a modified buffer
 
 209 set autoread                    " automatically read a file that has been modified
 
 213 set directory=$XDG_CACHE_HOME/vim/swap//
 
 215 " command line editing {{{2
 
 216 set history=5000                " how many command lines are remembered
 
 217 set wildmenu                    " command-line completion shows a list of matches
 
 218 set wildmode=longest:full,full  " specifies how command line completion works
 
 220 set wildignore+=.hg,.git,.svn                    " Version control
 
 221 set wildignore+=*.aux,*.out,*.toc                " LaTeX intermediate files
 
 222 set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg   " binary images
 
 223 set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest " compiled object files
 
 224 set wildignore+=*.spl                            " compiled spelling word lists
 
 225 set wildignore+=*.sw?                            " Vim swap files
 
 226 set wildignore+=*.luac                           " Lua byte code
 
 227 set wildignore+=*.pyc                            " Python byte code
 
 228 set wildignore+=*.orig                           " Merge resolution files
 
 231 set virtualedit=block           " let cursor move past last char in <C-V> mode
 
 232 set viminfo='100,<50,s10,h,n$XDG_CACHE_HOME/vim/viminfo " viminfo defaults but save file in .cache
 
 234 set viewdir=$XDG_CACHE_HOME/vim/view//
 
 237 " Resize splits when the window is resized {{{2
 
 240     autocmd VimResized * :wincmd =
 
 243 " Only show cursorline in the current window and in normal mode {{{2
 
 246     au WinLeave,InsertEnter * set nocursorline
 
 247     au WinEnter,InsertLeave * set cursorline
 
 250 " Treat buffers from stdin (e.g.: echo foo | vim -) as scratch {{{2
 
 253     au StdinReadPost * :set buftype=nofile
 
 256 " Jump to last known cursor position {{{2
 
 259     " blacklist certain filetype
 
 260     let blacklist = ['gitcommit']
 
 261     autocmd BufReadPost *
 
 262                 \ if index(blacklist, &ft) < 0 && line("'\"") > 1 && line("'\"") <= line("$") |
 
 263                 \   exe "normal! g`\"" |
 
 269 " allow both <space> and / to be <leader>
 
 273 nnoremap <leader>r :make<cr>
 
 274 nnoremap <leader><cr> :make<cr>
 
 277 nnoremap <silent> <Leader>/ :silent nohl<CR>
 
 280 nnoremap <leader>[ :tabprev<cr>
 
 281 nnoremap <leader>] :tabnext<cr>
 
 283 " paste from selection
 
 284 nnoremap <leader>p* :silent! set paste<CR>"*p:set nopaste<CR>
 
 285 " paste from clipboard
 
 286 nnoremap <leader>p+ :silent! set paste<CR>"+p:set nopaste<CR>
 
 288 " Clean trailing whitespace
 
 289 nnoremap <silent> <leader>ww m':%s/\s\+$//<cr>:let @/=''<cr>``zz
 
 292 vnoremap <leader>S y:execute @@<cr>:echo 'Sourced selection.'<cr>
 
 293 nnoremap <leader>S ^vg_y:execute @@<cr>:echo 'Sourced line.'<cr>
 
 295 " jump to last cursor position
 
 298 " Select (charwise) the contents of the current line, excluding indentation.
 
 302 nnoremap U :syntax sync fromstart<cr>:AirlineRefresh<cr>:redraw!<cr>
 
 305 " nnoremap <leader>r :silent !ranger %:h<cr>:redraw!<cr>
 
 306 " nnoremap <leader>R :silent !ranger<cr>:redraw!<cr>
 
 313 " display the number of matches for the last search
 
 314 nmap <Leader># :%s:<C-R>/::gn<CR>
 
 316 " center cursor after search and open folds
 
 320 " same when jumping around
 
 323 nnoremap <c-o> <c-o>zzzv
 
 324 nnoremap <c-i> <c-i>zzzv
 
 326 " Not using the default mappings of 'To line from top/bottom'
 
 332 " Heresy, emacs insert bindings
 
 333 inoremap <c-a> <esc>I
 
 334 inoremap <c-e> <esc>A
 
 335 cnoremap <c-a> <home>
 
 338 " proper movement when lines are wrapped
 
 339 noremap <expr> j (v:count == 0 ? 'gj' : 'j')
 
 340 noremap <expr> k (v:count == 0 ? 'gk' : 'k')
 
 346 noremap  <Right> <NOP>
 
 348 inoremap <Down>  <NOP>
 
 349 inoremap <Left>  <NOP>
 
 350 inoremap <Right> <NOP>
 
 352 cnoremap <Down>  <NOP>
 
 353 cnoremap <Left>  <NOP>
 
 354 cnoremap <Right> <NOP>
 
 356 cnoremap <C-J>   <Down>
 
 357 cnoremap <C-H>   <Left>
 
 358 cnoremap <C-L>   <Right>
 
 360 " close all folds open fold in cursor
 
 363 map <F1> :ls<CR>:b<space>
 
 365 nnoremap <C-L> <C-W>w
 
 366 nnoremap <C-H> <C-W>W
 
 368 "xterm mouse with middleclick paste
 
 369 nnoremap <MiddleMouse> i<MiddleMouse>
 
 370 vnoremap <MiddleMouse> s<MiddleMouse>
 
 372 " fix legacy vi inconsistency
 
 375 " allow repeat operator on visual
 
 376 vnoremap . :normal .<CR>
 
 378 " add line without changing position or leaving mode
 
 379 noremap <silent> <Leader>o :set paste<CR>m`o<ESC>``:set nopaste<CR>
 
 380 noremap <silent> <Leader>O :set paste<CR>m`O<ESC>``:set nopaste<CR>
 
 382 " Don't use Ex mode, use Q for formatting
 
 385 " break undo sequence before removing word
 
 386 inoremap <C-W> <C-G>u<C-W>
 
 388 nnoremap coe :set <C-R>=&expandtab ? 'noexpandtab' : 'expandtab'<CR><CR>
 
 389 nnoremap [oe :set expandtab<CR>
 
 390 nnoremap ]oe :set noexpandtab<CR>
 
 392 for idt in range(1,8)
 
 393   exe 'nnoremap co'.idt.' :set tabstop='.idt.' shiftwidth='.idt.' softtabstop='.idt.'<CR>'
 
 396 " space will toggle current fold in normal mode
 
 397 nnoremap <leader><Space> za
 
 398 " create folds around visual selection
 
 399 vnoremap <leader><Space> zf
 
 401 autocmd BufWinLeave *.* mkview
 
 402 autocmd BufWinEnter *.* silent loadview
 
 405 cnoremap w!! w !sudo tee % > /dev/null
 
 407 " uppercase previous word
 
 408 inoremap <C-C> <Esc>gUiwgi
 
 410 " plugins options {{{1
 
 412 let g:airline#extensions#whitespace#enabled = 1
 
 413 let g:airline#extensions#tabline#enabled = 1
 
 414 let g:airline_powerline_fonts = 1
 
 417 let g:checkattach_filebrowser = 'ranger'
 
 418 let g:checkattach_once = 'y'
 
 421 let delimitMate_expand_cr = 2
 
 422 let g:delimitMate_expand_space = 1
 
 425 nnoremap <silent> <Leader>ff :FSHere<CR>
 
 426 nnoremap <silent> <Leader>fl :FSRight<CR>
 
 427 nnoremap <silent> <Leader>fh :FSLeft<CR>
 
 428 nnoremap <silent> <Leader>fj :FSBelow<CR>
 
 429 nnoremap <silent> <Leader>fk :FSAbove<CR>
 
 430 nnoremap <silent> <Leader>fL :FSSplitRight<CR>
 
 431 nnoremap <silent> <Leader>fH :FSSplitLeft<CR>
 
 432 nnoremap <silent> <Leader>fJ :FSSplitBelow<CR>
 
 433 nnoremap <silent> <Leader>fK :FSSplitAbove<CR>
 
 436 nmap <silent> <leader>dd :tab split \| Gdiff \| wincmd h<CR>
 
 437 " delete fugitive buffers when closed
 
 438 autocmd BufReadPost fugitive://* set bufhidden=delete
 
 440 nnoremap <silent> <leader>gs :Gstatus<CR>
 
 441 nnoremap <silent> <leader>gd :Gdiff<CR>
 
 442 nnoremap <silent> <leader>gc :Gcommit -v<CR>
 
 443 nnoremap <silent> <leader>ga :Gwrite<cr>
 
 444 nnoremap <silent> <leader>gb :Gblame<cr>
 
 447 nnoremap <F7> :GundoToggle<CR>
 
 450 let g:indent_guides_default_mapping = 0
 
 451 let g:indent_guides_guide_size = 1
 
 452 nmap <silent> cog <Plug>IndentGuidesToggle
 
 453 nmap <silent> [og <Plug>IndentGuidesEnable
 
 454 nmap <silent> ]og <Plug>IndentGuidesDisable
 
 457 " open/close NERDTree with \e
 
 458 nmap <Leader>e :NERDTreeToggle<CR>
 
 459 nmap <F6> :NERDTreeToggle<CR>
 
 460 " <space> to open files/dirs
 
 461 let NERDTreeMapActivateNode='l'
 
 462 " close vim if only NERDTree is open
 
 463 autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
 
 467 let g:pymode_rope_completion = 0
 
 468 let g:pymode_rope = 0
 
 469 let g:pymode_folding = 1
 
 470 let g:pymode_lint_ignore = "E221,E266,E501"
 
 471 let g:pymode_syntax_space_errors = 0    " don't bother me when I'm typing
 
 474 let g:syntastic_enable_highlighting = 0
 
 475 let g:syntastic_error_symbol='E'
 
 476 let g:syntastic_style_error_symbol='S'
 
 477 let g:syntastic_warning_symbol='W'
 
 478 let g:syntastic_style_warning_symbol='S'
 
 479 let g:syntastic_always_populate_loc_list=1
 
 480 nmap <silent> <leader>y :SyntasticCheck<cr>
 
 483   let g:syntastic_check_on_open=1
 
 487 map <F5> :TagbarToggle<cr>
 
 488 let g:tagbar_sort = 0
 
 489 let g:tagbar_compact = 1
 
 490 let g:tagbar_autoshowtag = 1
 
 491 let g:tagbar_width = 25
 
 492 let g:tagbar_iconchars = ['+', '-']
 
 495 let g:UltiSnipsEditSplit = 'vertical'
 
 496 let g:UltiSnipsSnippetsDir = expand("$XDG_CONFIG_HOME/vim/ultisnips")
 
 497 let g:UltiSnipsSnippetDirectories = ["UltiSnips", "ultisnips"]
 
 498 let g:UltiSnipsExpandTrigger       = "<tab>"
 
 499 let g:UltiSnipsJumpForwardTrigger  = "<tab>"
 
 500 let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
 
 502 " UltiSnips completion function that tries to expand a snippet. If there's no
 
 503 " snippet for expanding, it checks for completion window and if it's shown,
 
 504 " selects first element. If there's no completion window it tries to jump to
 
 505 " next placeholder. If there's no placeholder it just returns TAB key
 
 506 " https://github.com/Valloric/YouCompleteMe/issues/36#issuecomment-15451411
 
 507 function! g:UltiSnips_Complete()
 
 508     call UltiSnips#ExpandSnippet()
 
 509     if g:ulti_expand_res == 0
 
 513             call UltiSnips#JumpForwards()
 
 514             if g:ulti_jump_forwards_res == 0
 
 521 au InsertEnter * exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=g:UltiSnips_Complete()<cr>"
 
 522 let g:UltiSnipsListSnippets="<c-e>"
 
 525 call unite#filters#matcher_default#use(['matcher_fuzzy'])
 
 526 call unite#custom#profile('default', 'context', {
 
 528             \ 'direction': 'botright'
 
 531 nnoremap [unite] <Nop>
 
 532 nmap <leader>u [unite]
 
 535 " seems not respected
 
 536 let g:unite_source_grep_max_candidates = 2000
 
 538     " Use ag in unite grep source.
 
 539     let g:unite_source_grep_command = 'ag'
 
 540     let g:unite_source_grep_default_opts = '--smart-case -w --vimgrep --hidden --ignore ''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr'''
 
 541     let g:unite_source_grep_recursive_opt = ''
 
 543 nnoremap <silent> [unite]a :<C-u>Unite grep -input=
\12\17<CR>
 
 544 command! -nargs=1 Ag Unite grep -input=<args>
 
 546 " unite-file_rec {{{3
 
 548     " Use ag in unite rec source
 
 549     let g:unite_source_rec_async_command = 'ag --follow --nocolor --nogroup --hidden -g ""'
 
 551 nnoremap <silent> [unite]f :<C-u>Unite -start-insert file_rec/async<CR>
 
 554 call unite#custom#default_action('buffer', 'goto')
 
 555 nnoremap <silent> [unite]b :<C-u>Unite buffer<CR>
 
 558 let g:unite_source_menu_menus = {}
 
 559 let g:unite_source_menu_menus.fugitive = { 'description' : 'fugitive menu'}
 
 560 let g:unite_source_menu_menus.fugitive.command_candidates = {
 
 561             \ 'Gstatus <Leader>gs' : 'Gstatus',
 
 562             \ 'Gcommit -v <Leader>gc' : 'Gcommit -v',
 
 566 nnoremap <silent> <leader>gg :<C-u>Unite menu:fugitive<CR>
 
 568 let g:unite_source_history_yank_enable = 1
 
 569 nnoremap <silent> [unite]p :<C-u>Unite history/yank<CR>
 
 572 nnoremap <silent> <leader>p :YRShow<cr>
 
 573 let g:yankring_history_dir = expand('$XDG_CACHE_HOME/vim')
 
 574 let g:yankring_replace_n_pkey = ''
 
 575 let g:yankring_replace_n_nkey = ''
 
 577 " map Y to y$ for the yank ring
 
 578 function! YRRunAfterMaps()
 
 579     nnoremap Y   :<C-U>YRYankCount 'y$'<CR>
 
 583 let g:ycm_extra_conf_globlist = ['~/src/*','/mnt/data/src/*']
 
 584 let g:ycm_global_ycm_extra_conf = expand('$XDG_CONFIG_HOME/vim/ycm_extra_conf.py')
 
 585 let g:ycm_extra_conf_vim_data = ['getcwd()']
 
 586 let g:ycm_add_preview_to_completeopt = 1
 
 587 let g:ycm_autoclose_preview_window_after_insertion = 0
 
 588 "let g:ycm_extra_conf_vim_data = ['%:p']
 
 589 nnoremap <leader>jd :YcmCompleter GoTo<CR>
 
 591 " vim-easy-align {{{2
 
 592 " start interactive EasyAlign in visual mode
 
 593 vmap <Enter> <Plug>(EasyAlign)
 
 596 let g:vim_json_syntax_conceal = 0
 
 599 let g:tex_flavor='latex'
 
 600 let g:Tex_DefaultTargetFormat='pdf'
 
 601 let g:Tex_MultipleCompileFormats='pdf'
 
 604 let g:sneak#streak = 1
 
 605 let g:sneak#target_labels = "aoeuisnthdpylrcgfqjkxzmwvz" " dvorak
 
 606 let g:sneak#use_ic_scs = 1  " follow 'ignorecase' and 'smartcase'
 
 624 " Convenient command to see the difference between the current buffer and the
 
 625 " file it was loaded from, thus the changes you made.
 
 626 " Only define it when not defined already.
 
 627 if !exists(":DiffOrig")
 
 628   command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
 
 629                   \ | wincmd p | diffthis
 
 633 function! EditConfig(what)
 
 634     let l:dir = split(&runtimepath,',')[0]
 
 636         let l:file = expand($MYVIMRC)
 
 637     elseif ! isdirectory(globpath(l:dir, a:what))
 
 638         echoe a:what." is not valid!"
 
 639     elseif empty(&filetype)
 
 640         echoe 'filetype is empty!'
 
 642         let l:file = l:dir.'/'.a:what.'/'.&filetype.'.vim'
 
 645     execute ':vsplit '.file
 
 648 nmap <leader>ev :call EditConfig('vimrc')<CR>
 
 649 nmap <leader>ef :call EditConfig('ftplugin')<CR>
 
 650 nmap <leader>es :call EditConfig('syntax')<CR>
 
 651 nmap <leader>ei :call EditConfig('indent')<CR>
 
 652 nmap <leader>eu :UltiSnipsEdit<CR>:lcd %:p:h<CR>
 
 655 " http://tex.stackexchange.com/a/52932
 
 656 let g:myLangList=["en_gb","en_us","de","fr"]
 
 658 function! ToggleSpell()
 
 659   if !exists("b:myLang")
 
 662   execute "setlocal spell!"
 
 664     echo "setlocal spelllang=" g:myLangList[b:myLang]
 
 668 function! SwitchSpell()
 
 669   if !exists("b:myLang")
 
 673     let b:myLang=b:myLang+1
 
 674     if b:myLang>=len(g:myLangList) | let b:myLang=0 | endif
 
 676   execute "setlocal spell spelllang=".get(g:myLangList, b:myLang)
 
 677   echo "setlocal spelllang=" g:myLangList[b:myLang]
 
 680 nnoremap <silent> coS :call SwitchSpell()<CR>
 
 681 " fix spelling with first choice
 
 682 nnoremap <Leader>f 1z=