UsePlug 'coc.nvim' "======================= "'neoclide/coc.nvim' "======================= "coc command nnoremap ; CocCommand nmap gd (coc-definition) nmap gi (coc-implementation) nmap gy (coc-type-definition) nmap gr (coc-references) nnoremap gh call show_documentation() function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('') elseif (coc#rpc#ready()) call CocActionAsync('doHover') else execute '!' . &keywordprg . " " . expand('') endif endfunction augroup vimrc_coc autocmd! autocmd CursorHold * silent call CocActionAsync('highlight') augroup END if has("patch-8.1.1564") " Recently vim can merge signcolumn and number column into one set signcolumn=number else set signcolumn=yes endif inoremap ;; pumvisible() ? coc#_select_confirm() : coc#refresh() " ========================= " coc-snippets " ========================= " imap ;; (coc-snippets-expand) let g:coc_snippet_next = '' let g:coc_snippet_prev = '' " ========================= " coc-fzf-preview " ========================= nnoremap ;l CocCommand fzf-preview.Lines nnoremap ;z CocCommand fzf-preview.OldFiles nnoremap ;p CocCommand fzf-preview.ProjectFiles nnoremap ;d CocCommand fzf-preview.DirectoryFiles nnoremap ;; CocCommand fzf-preview.Buffers nnoremap ;q CocCommand fzf-preview.QuickFix nnoremap ;c CocCommand fzf-preview.CommandPalette nnoremap ;t CocCommand fzf-preview.TodoComments nnoremap ;ff :CocCommand fzf-preview.ProjectGrep nnoremap ;f; CocCommand fzf-preview.ProjectGrepRecall nnoremap ;gl CocCommand fzf-preview.GitLogs nnoremap ;ga CocCommand fzf-preview.GitActions set viminfo='1000 let g:fzf_preview_floating_window_rate = 0.9 " fzf window position settings let g:fzf_preview_direct_window_option = '' " fzf command default options let g:fzf_preview_default_fzf_options = { '--reverse': v:true, '--preview-window': 'wrap' } " Add fzf quit mapping let g:fzf_preview_quit_map = 1 " jump to the buffers by default, when possible let g:fzf_preview_buffers_jump = 0 if executable('bat') let g:fzf_preview_command = 'bat --color=always --plain {-1}' let g:fzf_preview_lines_command = 'bat --color=always --plain --number' else let g:fzf_preview_command = 'cat' let g:fzf_preview_lines_command = 'cat -n' let $FZF_PREVIEW_PREVIEW_BAT_THEME = 'ansi' endif if executable('rg') " Commands used for project grep " let g:fzf_preview_grep_cmd = 'rg --line-number --no-heading --color=never' let g:fzf_preview_grep_cmd = 'rg --line-number --no-heading --color=never' " Commands used to get the file list from current directory let g:fzf_preview_directory_files_command = 'rg --files --hidden --follow --no-messages -g \!"* *"' endif " g:fzf_binary_preview_command is executed if this command succeeds, and g:fzf_preview_command is executed if it fails let g:fzf_preview_if_binary_command = '[[ "$(file --mime {})" =~ binary ]]' " Commands used for binary file let g:fzf_binary_preview_command = 'echo "{} is a binary file"' " Commands used to get the file list from project let g:fzf_preview_filelist_command = 'git ls-files --exclude-standard' " Not Installed ripgrep " let g:fzf_preview_filelist_command = 'rg --files --hidden --follow --no-messages -g \!"* *"' " Installed ripgrep " Commands used to get the file list from git repository let g:fzf_preview_git_files_command = 'git ls-files --exclude-standard' " Commands used to get the git status file list let g:fzf_preview_git_status_command = 'git -c color.status=always status --short --untracked-files=all' " Commands used for git status preview. let g:fzf_preview_git_status_preview_command = "[[ $(git diff --cached -- {-1}) != \"\" ]] && git diff --cached --color=always -- {-1} || " . \ "[[ $(git diff -- {-1}) != \"\" ]] && git diff --color=always -- {-1} || " . \ g:fzf_preview_command " MRU and MRW cache directory let g:fzf_preview_cache_directory = expand('~/.cache/vim/fzf_preview') " If this value is not 0, disable mru and mrw let g:fzf_preview_disable_mru = 0 " Limit of the number of files to be saved by mru let g:fzf_preview_mru_limit = 1000 " Commands used for current file lines " Commands used for preview of the grep result let g:fzf_preview_grep_preview_cmd = expand(':h:h') . '/bin/preview_fzf_grep' " Cache directory for mru and mrw let g:fzf_preview_cache_directory = expand('~/.cache/vim/fzf_preview') " Keyboard shortcuts while fzf preview is active let g:fzf_preview_preview_key_bindings = '' " let g:fzf_preview_preview_key_bindings = 'ctrl-d:preview-page-down,ctrl-u:preview-page-up,?:toggle-preview' " Specify the color of fzf let g:fzf_preview_fzf_color_option = '' " Set the processes when selecting an element with fzf let g:fzf_preview_custom_processes = {} " For example, set split to ctrl-s " let g:fzf_preview_custom_processes['open-file'] = fzf_preview#remote#process#get_default_processes('open-file') " on coc extensions " let g:fzf_preview_custom_processes['open-file'] = fzf_preview#remote#process#get_default_processes('open-file', 'coc') " let g:fzf_preview_custom_processes['open-file']['ctrl-s'] = g:fzf_preview_custom_processes['open-file']['ctrl-x'] " call remove(g:fzf_preview_custom_processes['open-file'], 'ctrl-x') " Use as fzf preview-window option let g:fzf_preview_fzf_preview_window_option = '' " let g:fzf_preview_fzf_preview_window_option = 'up:30%' " Use vim-devicons let g:fzf_preview_use_dev_icons = 1 " Use fzf history option " let g:fzf_preview_history_dir = false " let g:fzf_preview_history_dir = '~/.fzf' " devicons character width let g:fzf_preview_dev_icon_prefix_string_length = 3 " Devicons can make fzf-preview slow when the number of results is high " By default icons are disable when number of results is higher that 5000 let g:fzf_preview_dev_icons_limit = 5000