function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction inoremap pumvisible() ? coc#_select_confirm() : \"\u\\=coc#on_enter()\" nmap gd (coc-definition) nnoremap K :call show_documentation() function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('') else call CocAction('doHover') endif endfunction function! s:open_as_preview(callstr) " e.g. the string should look like: +call cursor(,) let m = matchlist(a:callstr, '^+call cursor(\(\d\+\),\s*\(\d\+\))\s\+\(.*\)') if len(m) < 4 " TODO: more robust error handling echohl WarningMsg | echom "ERROR: Invalid callstr format" | echohl None return endif let linenr = m[1] let filename = expand(m[3]) call quickui#preview#open(filename, { \ 'cursor': linenr, \ 'number' : 1, \ 'persist': 0, \ }) endfunction command! -nargs=0 PreviewDefinition :call CocActionAsync('jumpDefinition', ':OpenAsPreview') command! -nargs=* OpenAsPreview :call s:open_as_preview("") autocmd CursorHold * silent call CocActionAsync('highlight')