nvim: init.vim: Switch to vim-clap

vim-clap seems to be much nicer and has better integration
with the floating window feature of neovim.

Use fzf again since we need cscope integration. Eventually
we would like to have a cscope provider for clap. Also fzf
seems to be installed by default on Manjaro i3.

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
Sanchayan Maity 2019-12-02 16:52:42 +05:30
parent 7db7083a37
commit 9dd0ad4e87

View file

@ -8,9 +8,9 @@ Plug 'ervandew/supertab'
" EasyMotion - Allows <leader><leader>(b|e) to jump to (b)eginning or (end) " EasyMotion - Allows <leader><leader>(b|e) to jump to (b)eginning or (end)
" of words. " of words.
Plug 'easymotion/vim-easymotion' Plug 'easymotion/vim-easymotion'
" Fuzzy file search " Fuzzy search
Plug 'lotabout/skim', { 'dir': '~/.skim', 'do': './install' } Plug 'junegunn/fzf.vim'
Plug 'lotabout/skim.vim' Plug 'liuchengxu/vim-clap'
" Remove extraneous whitespace when edit mode is exited " Remove extraneous whitespace when edit mode is exited
Plug 'thirtythreeforty/lessspace.vim' Plug 'thirtythreeforty/lessspace.vim'
" Status bar mods " Status bar mods
@ -193,20 +193,19 @@ nnoremap Q <Nop>
nnoremap <Leader>pg :PlugUpgrade<CR> nnoremap <Leader>pg :PlugUpgrade<CR>
nnoremap <Leader>pd :PlugUpdate<CR> nnoremap <Leader>pd :PlugUpdate<CR>
nnoremap <Leader>pc :PlugClean<CR> nnoremap <Leader>pc :PlugClean<CR>
" For skim " For Clap
nnoremap <Leader>vf :Files<CR> nnoremap <Leader>vf :Clap files<CR>
nnoremap <Leader>vg :GFiles<CR> nnoremap <Leader>vg :Clap gfiles<CR>
nnoremap <Leader>vb :Buffers<CR> nnoremap <Leader>vb :Clap buffers<CR>
nnoremap <Leader>vL :Lines<CR> nnoremap <Leader>vL :Clap lines<CR>
nnoremap <Leader>vl :BLines<CR> nnoremap <Leader>vl :Clap blines<CR>
nnoremap <Leader>vt :BTags<CR> nnoremap <Leader>vc :Clap bcommits<CR>
nnoremap <Leader>vT :Tags<CR> nnoremap <Leader>va :Clap commits<CR>
nnoremap <Leader>vc :BCommits<CR> nnoremap <Leader>vh :Clap history<CR>
nnoremap <Leader>va :Commits<CR> nnoremap <Leader>vm :Clap command<CR>
nnoremap <Leader>vch :History:<CR> nnoremap <Leader>/ :Clap grep<CR>
nnoremap <Leader>vsh :History/<CR> nnoremap <Leader>d :Clap grep ++query=<cword><CR>
" Use ripgrep to search for content in files " Quick buffer switching
nnoremap <Leader>/ :Rg<CR>
nnoremap <Leader>b :ls<CR>:b<Space> nnoremap <Leader>b :ls<CR>:b<Space>
" Undo tree " Undo tree
nnoremap <Leader>u :UndotreeToggle<CR> nnoremap <Leader>u :UndotreeToggle<CR>
@ -221,8 +220,6 @@ nnoremap <Leader>sv <Esc>:vsp<CR>
nnoremap <Leader>x <Esc>:x<CR> nnoremap <Leader>x <Esc>:x<CR>
nnoremap <Leader>q <Esc>:q<CR> nnoremap <Leader>q <Esc>:q<CR>
nnoremap <Leader>qa <Esc>:qa<CR> nnoremap <Leader>qa <Esc>:qa<CR>
" Search for the word under cursor
noremap <Leader>d :exe ':Rg ' . expand('<cword>')<CR>
" Open terminal " Open terminal
nnoremap <Leader>te :vsp<CR> :terminal<CR> nnoremap <Leader>te :vsp<CR> :terminal<CR>
" Tab navigation shortcuts " Tab navigation shortcuts
@ -458,7 +455,7 @@ autocmd BufRead,BufNewFile *.md,*.txt setlocal spell spelllang=en_uk
" Automatically resize the window " Automatically resize the window
autocmd VimResized * wincmd = autocmd VimResized * wincmd =
" CScope & skim integration " CScope & fuzzy integration
" Taken from https://gist.github.com/amitab/cd051f1ea23c588109c6cfcb7d1d5776 " Taken from https://gist.github.com/amitab/cd051f1ea23c588109c6cfcb7d1d5776
" However, the above gist has completely wrong mappings " However, the above gist has completely wrong mappings
function! Cscope(option, query) function! Cscope(option, query)
@ -475,7 +472,7 @@ function! Cscope(option, query)
let file = split(data[0], ":") let file = split(data[0], ":")
execute 'e ' . '+' . file[1] . ' ' . file[0] execute 'e ' . '+' . file[1] . ' ' . file[0]
endfunction endfunction
call skim#run(opts) call fzf#run(opts)
endfunction endfunction
function! CscopeQuery(option) function! CscopeQuery(option)
@ -530,30 +527,6 @@ nnoremap <silent> <Leader><Leader>sf :call CscopeQuery('7')<CR>
nnoremap <silent> <Leader><Leader>si :call CscopeQuery('8')<CR> nnoremap <silent> <Leader><Leader>si :call CscopeQuery('8')<CR>
nnoremap <silent> <Leader><Leader>sa :call CscopeQuery('9')<CR> nnoremap <silent> <Leader><Leader>sa :call CscopeQuery('9')<CR>
" Adapted from https://www.reddit.com/r/neovim/comments/djmehv/im_probably_really_late_to_the_party_but_fzf_in_a/
let g:skim_layout = { 'window': 'call FloatingSkim()' }
function! FloatingSkim()
let buf = nvim_create_buf(v:false, v:true)
call setbufvar(buf, '&signcolumn', 'no')
let height = float2nr(&lines * 0.4)
let width = float2nr(&columns * 0.8)
let horizontal = float2nr((&columns - width) / 2)
let vertical = float2nr((&columns - width) / 2)
let opts = {
\ 'relative': 'editor',
\ 'row': vertical,
\ 'col': horizontal,
\ 'width': width,
\ 'height': height,
\ 'style': 'minimal'
\ }
call nvim_open_win(buf, v:true, opts)
endfunction
function! NvimGdbNoTKeymaps() function! NvimGdbNoTKeymaps()
tnoremap <silent> <buffer> <esc> <c-\><c-n> tnoremap <silent> <buffer> <esc> <c-\><c-n>
endfunction endfunction