Chris 4 years ago
parent
commit
f37c162629
2 changed files with 26 additions and 2 deletions
  1. 24 2
      plug-config/coc/coc.vim
  2. 2 0
      vim-plug/plugins.vim

+ 24 - 2
plug-config/coc/coc.vim

@@ -33,11 +33,19 @@ nnoremap <silent> K :call <SID>show_documentation()<CR>
 function! s:show_documentation()
 function! s:show_documentation()
   if (index(['vim','help'], &filetype) >= 0)
   if (index(['vim','help'], &filetype) >= 0)
     execute 'h '.expand('<cword>')
     execute 'h '.expand('<cword>')
+  elseif (coc#rpc#ready())
+    call CocActionAsync('doHover')
   else
   else
-    call CocAction('doHover')
+    execute '!' . &keywordprg . " " . expand('<cword>')
   endif
   endif
 endfunction
 endfunction
 
 
+" set keywordprg=:call\ CocActionAsync('doHover')
+" augroup VimHelp
+"   autocmd!
+"   autocmd Filetype vim,help setlocal keywordprg=:help
+" augroup END
+
 " Highlight the symbol and its references when holding the cursor.
 " Highlight the symbol and its references when holding the cursor.
 autocmd CursorHold * silent call CocActionAsync('highlight')
 autocmd CursorHold * silent call CocActionAsync('highlight')
 
 
@@ -69,6 +77,20 @@ xmap af <Plug>(coc-funcobj-a)
 omap if <Plug>(coc-funcobj-i)
 omap if <Plug>(coc-funcobj-i)
 omap af <Plug>(coc-funcobj-a)
 omap af <Plug>(coc-funcobj-a)
 
 
+" Remap <C-f> and <C-b> for scroll float windows/popups.
+" Note coc#float#scroll works on neovim >= 0.4.3 or vim >= 8.2.0750
+nnoremap <nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
+nnoremap <nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
+inoremap <nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
+inoremap <nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
+
+" NeoVim-only mapping for visual mode scroll
+" Useful on signatureHelp after jump placeholder of snippet expansion
+if has('nvim')
+  vnoremap <nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#nvim_scroll(1, 1) : "\<C-f>"
+  vnoremap <nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#nvim_scroll(0, 1) : "\<C-b>"
+endif
+
 " Add `:Format` command to format current buffer.
 " Add `:Format` command to format current buffer.
 command! -nargs=0 Format :call CocAction('format')
 command! -nargs=0 Format :call CocAction('format')
 
 
@@ -81,7 +103,7 @@ command! -nargs=0 OR   :call     CocAction('runCommand', 'editor.action.organize
 " Add (Neo)Vim's native statusline support.
 " Add (Neo)Vim's native statusline support.
 " NOTE: Please see `:h coc-status` for integrations with external plugins that
 " NOTE: Please see `:h coc-status` for integrations with external plugins that
 " provide custom statusline: lightline.vim, vim-airline.
 " provide custom statusline: lightline.vim, vim-airline.
-set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
+" set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
 
 
 " Mappings using CoCList:
 " Mappings using CoCList:
 " Show all diagnostics.
 " Show all diagnostics.

+ 2 - 0
vim-plug/plugins.vim

@@ -111,6 +111,8 @@ call plug#begin('~/.config/nvim/autoload/plugged')
     " Debugging
     " Debugging
     Plug 'puremourning/vimspector'
     Plug 'puremourning/vimspector'
     Plug 'szw/vim-maximizer'
     Plug 'szw/vim-maximizer'
+    " Neovim in Browser
+    Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
     " Rainbow brackets
     " Rainbow brackets
     " Plug 'luochen1990/rainbow'
     " Plug 'luochen1990/rainbow'
     " Async Linting Engine
     " Async Linting Engine