-
-" Ask what to do when closing unsaved documents
-set confirm
-
-" If using a dark background within the editing area and syntax highlighting
-" turn on this option as well
-set background=dark
-
-" The following are commented out as they cause vim to behave a lot
-" differently from regular Vi. They are highly recommended though.
-set showcmd " Show (partial) command in status line.
-set showmatch " Show matching brackets.
-set ignorecase " Do case insensitive matching
-set smartcase " Do smart case matching
-set incsearch " Incremental search
-set autowrite " Automatically save before commands like :next and :make
-"set hidden " Hide buffers when they are abandoned
-"set mouse=a " Enable mouse usage (all modes)
-
-" expand tabs
-set softtabstop=4
-set shiftwidth=4
-set expandtab
-
-set showbreak=▒▒
-" show these chars for tabs and trailing spaces
-set list listchars=tab:»·,trail:·
-
-set pastetoggle=<F11>
-" split right when using :vsp
-set splitright
-
-set scrolloff=3 " keep at least 3 lines above/below
-" Press i to enter insert mode, and ii to exit.
-imap ii <Esc>
-" Press `` to toggle insert and replace mode (no <Insert> key on Mac keyboard)
-imap `` <Insert>
-
+" }}}
+
+" fold {{{
+set foldmethod=marker
+set foldlevelstart=99
+" space will toggle current fold in normal mode, if not in a fold, normal
+" behaviour
+nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR>
+vnoremap <Space> zf
+" save and restore folds
+autocmd BufWinLeave *.* mkview
+autocmd BufWinEnter *.* silent loadview
+" }}}
+
+function! NextIndent(exclusive, fwd, lowerlevel, skipblanks) " {{{