diff --git a/after/ftplugin/vim.vim b/after/ftplugin/vim.vim index 96667a8..45f8943 100644 --- a/after/ftplugin/vim.vim +++ b/after/ftplugin/vim.vim @@ -1,47 +1,32 @@ " Mapping for Vim help of the word under cursor. nnoremap K :help +" Set custom fold expression setlocal foldmethod=expr -setlocal foldexpr=GetVimFold(v:lnum) +setlocal foldexpr=VimFold(v:lnum) -" Regex for vim script blocks & markers {{{ -let s:vim_funciton_start = '^\s*fun\(c\(tion\)\=\)\=!\=\s\+.*#\=\w*(.*).*$' -let s:vim_function_end = '^\s*endfun\(c\(tion\)\=\)\=\s*$' - -let s:vim_if_start = '^\s*if\s*.*$' -let s:vim_if_end = '\s*en\(dif\)\=\s*$' - -let s:vim_while_start = '^\s*wh\(ile)\=\s*.*$' -let s:vim_while_end = '\s*endw\(hile\)\=\s*$' - -let s:vim_for_start = '^\s*for\s*.*$' -let s:vim_for_end = '\s*endfo\(r\)\=\s*$' - -let s:vim_try_start = '^\s*try\s*.*$' -let s:vim_try_end = '\s*endt\(ry\)\=\s*$' - -let s:vim_augroup_start = '^\s*aug\(roup\)\=\s*.*\(END\)\@'.string((indent(a:lnum) / &shiftwidth) + 1) + elseif l:line =~ '^\s*endfun\(c\(tion\)\=\)\=\s*$' + \ || l:line =~ '^\s*en\(dif\)\=\s*$' + \ || l:line =~ '^\s*endw\(hile\)\=\s*$' + \ || l:line =~ '^\s*endfor\=\s*$' + \ || l:line =~ '^\s*endt\(ry\)\=\s*$' + \ || l:line =~ '\s*".*}}}\s*$' + return '<'.string((indent(a:lnum) / &shiftwidth) + 1) endif return '='