Skip to content

Commit ad786b6

Browse files
committed
update coc settings, fix quick-fix
1 parent 85832e9 commit ad786b6

File tree

1 file changed

+4
-75
lines changed

1 file changed

+4
-75
lines changed

.vimrc

Lines changed: 4 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -667,9 +667,9 @@ else
667667
inoremap <silent><expr> <c-@> coc#refresh()
668668
endif
669669

670-
" Make <CR> auto-select the first completion item and notify coc.nvim to
671-
" format on enter, <cr> could be remapped by other vim plugin
672-
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
670+
" Make <CR> to accept selected completion item or notify coc.nvim to format
671+
" <C-g>u breaks current undo, please make your own choice.
672+
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
673673
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
674674
675675
" Use `[g` and `]g` to navigate diagnostics
@@ -942,8 +942,7 @@ map <leader><F7> :call CleanBuild()<CR>
942942
" Simple hexify/unhexify
943943
noremap <F8> :call <sid>Hexify()<CR>
944944
" Apply CoC FixIt
945-
map <F9> <Plug>(coc-fix-current)
946-
"map <F9> :make run<CR>
945+
nmap <F9> <Plug>(coc-fix-current)
947946
" remove trailing spaces
948947
map <F10> :%s/\s\+$//<CR>
949948
" goto definition with F12
@@ -1107,76 +1106,6 @@ nmap <silent> <expr> zu FS_FoldAroundTarget('^\s*use\s\+\S.*;',{'context':1})
11071106
au BufRead /var/tmp/mutt-* source ~/.mutt/mutt-aliases.vim
11081107
let g:mutt_aliases_file="~/.mutt/aliases.generated"
11091108

1110-
"==============[ CoC Config ]======================
1111-
1112-
" Don't pass messages to |ins-completion-menu|.
1113-
set shortmess+=c
1114-
1115-
" Always show the signcolumn, otherwise it would shift the text each time
1116-
" diagnostics appear/become resolved.
1117-
if has("nvim-0.5.0") || has("patch-8.1.1564")
1118-
" Recently vim can merge signcolumn and number column into one
1119-
set signcolumn=number
1120-
else
1121-
set signcolumn=yes
1122-
endif
1123-
1124-
" Use tab for trigger completion with characters ahead and navigate.
1125-
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
1126-
" other plugin before putting this into your config.
1127-
inoremap <silent><expr> <TAB>
1128-
\ pumvisible() ? "\<C-n>" :
1129-
\ <SID>check_back_space() ? "\<TAB>" :
1130-
\ coc#refresh()
1131-
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
1132-
1133-
function! s:check_back_space() abort
1134-
let col = col('.') - 1
1135-
return !col || getline('.')[col - 1] =~# '\s'
1136-
endfunction
1137-
1138-
" Use <c-space> to trigger completion.
1139-
if has('nvim')
1140-
inoremap <silent><expr> <c-space> coc#refresh()
1141-
else
1142-
inoremap <silent><expr> <c-@> coc#refresh()
1143-
endif
1144-
1145-
" Make <CR> auto-select the first completion item and notify coc.nvim to
1146-
" format on enter, <cr> could be remapped by other vim plugin
1147-
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
1148-
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
1149-
1150-
" Use `[g` and `]g` to navigate diagnostics
1151-
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
1152-
"nmap <silent> [g <Plug>(coc-diagnostic-prev)
1153-
"nmap <silent> ]g <Plug>(coc-diagnostic-next)
1154-
1155-
" GoTo code navigation.
1156-
nmap <silent> gd <Plug>(coc-definition)
1157-
nmap <silent> gy <Plug>(coc-type-definition)
1158-
nmap <silent> gi <Plug>(coc-implementation)
1159-
nmap <silent> gr <Plug>(coc-references)
1160-
1161-
" Use K to show documentation in preview window.
1162-
nnoremap <silent> <leader>K :call <SID>show_documentation()<CR>
1163-
1164-
function! s:show_documentation()
1165-
if (index(['vim','help'], &filetype) >= 0)
1166-
execute 'h '.expand('<cword>')
1167-
elseif (coc#rpc#ready())
1168-
call CocActionAsync('doHover')
1169-
else
1170-
execute '!' . &keywordprg . " " . expand('<cword>')
1171-
endif
1172-
endfunction
1173-
1174-
" Highlight the symbol and its references when holding the cursor.
1175-
autocmd CursorHold * silent call CocActionAsync('highlight')
1176-
1177-
" Symbol renaming.
1178-
nmap <leader>rn <Plug>(coc-rename)
1179-
11801109
"=====[ Vimspector ]=====================
11811110
"nmap <F5> <Plug>VimspectorContinue
11821111
"nmap <S-F5> <Plug>VimspectorReset

0 commit comments

Comments
 (0)