" if hidden is not set, TextEdit might fail. set hidden " Some servers have issues with backup files, see #649 set nobackup set nowritebackup " Better display for messages set cmdheight=2 " You will have bad experience for diagnostic messages when it's default 4000. set updatetime=300 " don't give |ins-completion-menu| messages. set shortmess+=c " always show signcolumns set signcolumn=yes " python .env-contains-pythonpath support autocmd FileType python let b:coc_root_patterns = ['.cocroot', '.git', '.env'] " useful key shortcuts nmap rn (coc-rename) nmap td (coc-definition) nmap ty (coc-type-definition) nmap ti (coc-implementation) nmap tr (coc-references) nmap te (coc-diagnostic-next-error) nmap tn (coc-diagnostic-next) xmap ,r (coc-format) nmap ,r (coc-format) " Add `:Format` command to format current buffer. command! -nargs=0 Format :call CocAction('format') nmap f (coc-smartf-forward) nmap F (coc-smartf-backward) nmap ; (coc-smartf-repeat) nmap , (coc-smartf-repeat-opposite) augroup Smartf autocmd User SmartfEnter :hi Conceal ctermfg=220 guifg=#6638F0 autocmd User SmartfLeave :hi Conceal ctermfg=239 guifg=#504945 augroup end " Use tab for trigger completion with characters ahead and navigate. " Use command ':verbose imap ' to make sure tab is not mapped by other plugin. inoremap \ pumvisible() ? "\" : \ check_back_space() ? "\" : \ coc#refresh() inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction " Use to trigger completion. inoremap coc#refresh() " Use to confirm completion, `u` means break undo chain at current position. " Coc only does snippet and additional edit on confirm. inoremap pumvisible() ? "\" : "\u\" " Or use `complete_info` if your vim support it, like: " inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" " Use K to show documentation in preview window nnoremap K :call show_documentation() function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('') else call CocAction('doHover') endif endfunction " Highlight symbol under cursor on CursorHold autocmd CursorHold * silent call CocActionAsync('highlight')