-" Jump to the next or previous line that has the same level or a lower
-" level of indentation than the current line.
-"
-" exclusive (bool): true: Motion is exclusive
-" false: Motion is inclusive
-" fwd (bool): true: Go to next line
-" false: Go to previous line
-" lowerlevel (bool): true: Go to line with lower indentation level
-" false: Go to line with the same indentation level
-" skipblanks (bool): true: Skip blank lines
-" false: Don't skip blank lines
-function! NextIndent(exclusive, fwd, lowerlevel, skipblanks)
- let line = line('.')
- let column = col('.')
- let lastline = line('$')
- let indent = indent(line)
- let stepvalue = a:fwd ? 1 : -1
- while (line > 0 && line <= lastline)
- let line = line + stepvalue
- if ( ! a:lowerlevel && indent(line) == indent ||
- \ a:lowerlevel && indent(line) < indent)
- if (! a:skipblanks || strlen(getline(line)) > 0)
- if (a:exclusive)
- let line = line - stepvalue
- endif
- exe line
- exe "normal " column . "|"
- return
- endif
- endif
- endwhile
-endfunction
+" reading and writing files {{{1
+set writebackup " write a backup file before overwriting a file
+set backup " keep a backup after owerwriting a file
+set backupdir=$HOME/.vim/backupdir
+
+set undofile " persistent undo history
+set undodir=$HOME/.vim/backupdir
+
+set autowrite " automatically write a file when leaving a modified buffer
+
+" command line editing {{{1
+set history=500 " how many command lines are remembered
+set wildmode=longest:full " specifies how command line completion works
+set wildmenu " command-line completion shows a list of matches
+
+" various {{{1
+set virtualedit=block " let cursor move past last char in <C-V> mode
+set viminfo='100,<50,s10,h,n~/.vim/viminfo " viminfo defaults but save file in .vim
+
+" plugins {{{1
+" airline {{{2
+let g:airline_detect_whitespace=2
+let g:airline_whitespace_symbol = 'Ξ'
+let g:airline_linecolumn_prefix = '␊ '
+let g:airline_left_sep = '▶'
+let g:airline_right_sep = '◀'
+let g:airline#extensions#tabline#enabled = 1
+
+" Gundo {{{2
+nnoremap <F7> :GundoToggle<CR>
+" fugitive {{{2
+nmap <silent> <leader>dd :tab split \| Gdiff \| wincmd h<CR>
+
+" NERDTree {{{2
+" open/close NERDTree with \e
+nmap <Leader>e :NERDTreeToggle<CR>
+nmap <F6> :NERDTreeToggle<CR>
+" <space> to open files/dirs
+let NERDTreeMapActivateNode='<space>'
+" open NERDTree if no files were selected
+autocmd vimenter * if !argc() | NERDTree | endif
+" close vim if only NERDTree is open
+autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
+
+" synastic {{{2
+let g:syntastic_enable_highlighting = 0
+let g:syntastic_error_symbol='E'
+let g:syntastic_style_error_symbol='S'
+let g:syntastic_warning_symbol='W'
+let g:syntastic_style_warning_symbol='S'
+let g:syntastic_always_populate_loc_list=1
+nmap <silent> <leader>y :SyntasticCheck<cr>
+
+if ! &diff
+ let g:syntastic_check_on_open=1
+endif
+
+" tagbar {{{2
+map <F5> :TagbarToggle<cr>
+let g:tagbar_sort = 0
+let g:tagbar_compact = 1
+let g:tagbar_autoshowtag = 1
+let g:tagbar_width = 25
+let g:tagbar_iconchars = ['+', '-']