vim/after/ftplugin/vim.vim
Kenneth Benzie (Benie) 3a2337cd63 Add do#show_documentation() using coc.nvim
Change the `K` normal mode overrides to use the example given in the
coc.nvim README file which uses Vim's builtin help when in `vim` or
`help` files, or checks if coc.nvim is ready and invokes
`CocActionAsync('doHover')`, otherwise fallback to using `keywordprg`.
2021-04-18 14:42:33 +01:00

44 lines
1.3 KiB
VimL

" Add omnifunc completion package.
packadd vimomni
" Set custom fold expression
setlocal foldmethod=expr
setlocal foldexpr=VimFold(v:lnum)
" Custom fold expresson folds control flow keywords and fold markers
function! VimFold(lnum)
let l:line = getline(a:lnum)
if l:line =~ '^python\s\+<<\s\+\w\+\s*$'
let b:vim_python_end = substitute(l:line, '^python\s\+<<\s\+\(\w\+\)\s*$', '\1', '')
return 'a1'
endif
if exists('b:vim_python_end')
if l:line =~ '^'.b:vim_python_end.'\s*$'
unlet b:vim_python_end
return 's1'
endif
else
if l:line =~ '^\s*fun\(c\(tion\)\=\)\=!\=\s\+.*#\=\w*(.*).*$'
\ || l:line =~ '^\s*if\s*.*$'
\ || l:line =~ '^\s*el\(se\)\=\s*.*$'
\ || l:line =~ '^\s*elseif\=\s*.*$'
\ || l:line =~ '^\s*wh\(ile\)\=\s*.*$'
\ || l:line =~ '^\s*for\s*.*$'
\ || l:line =~ '^\s*try\s*$'
\ || l:line =~ '^\s*cat\(ch\)\=\s*.*$'
\ || l:line =~ '^\s*fina\(lly\)\=\s*$'
return '>'.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*$'
return '<'.string((indent(a:lnum) / &shiftwidth) + 1)
endif
endif
return '='
endfunction