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:
parent
7db7083a37
commit
9dd0ad4e87
1 changed files with 18 additions and 45 deletions
|
@ -8,9 +8,9 @@ Plug 'ervandew/supertab'
|
|||
" EasyMotion - Allows <leader><leader>(b|e) to jump to (b)eginning or (end)
|
||||
" of words.
|
||||
Plug 'easymotion/vim-easymotion'
|
||||
" Fuzzy file search
|
||||
Plug 'lotabout/skim', { 'dir': '~/.skim', 'do': './install' }
|
||||
Plug 'lotabout/skim.vim'
|
||||
" Fuzzy search
|
||||
Plug 'junegunn/fzf.vim'
|
||||
Plug 'liuchengxu/vim-clap'
|
||||
" Remove extraneous whitespace when edit mode is exited
|
||||
Plug 'thirtythreeforty/lessspace.vim'
|
||||
" Status bar mods
|
||||
|
@ -193,20 +193,19 @@ nnoremap Q <Nop>
|
|||
nnoremap <Leader>pg :PlugUpgrade<CR>
|
||||
nnoremap <Leader>pd :PlugUpdate<CR>
|
||||
nnoremap <Leader>pc :PlugClean<CR>
|
||||
" For skim
|
||||
nnoremap <Leader>vf :Files<CR>
|
||||
nnoremap <Leader>vg :GFiles<CR>
|
||||
nnoremap <Leader>vb :Buffers<CR>
|
||||
nnoremap <Leader>vL :Lines<CR>
|
||||
nnoremap <Leader>vl :BLines<CR>
|
||||
nnoremap <Leader>vt :BTags<CR>
|
||||
nnoremap <Leader>vT :Tags<CR>
|
||||
nnoremap <Leader>vc :BCommits<CR>
|
||||
nnoremap <Leader>va :Commits<CR>
|
||||
nnoremap <Leader>vch :History:<CR>
|
||||
nnoremap <Leader>vsh :History/<CR>
|
||||
" Use ripgrep to search for content in files
|
||||
nnoremap <Leader>/ :Rg<CR>
|
||||
" For Clap
|
||||
nnoremap <Leader>vf :Clap files<CR>
|
||||
nnoremap <Leader>vg :Clap gfiles<CR>
|
||||
nnoremap <Leader>vb :Clap buffers<CR>
|
||||
nnoremap <Leader>vL :Clap lines<CR>
|
||||
nnoremap <Leader>vl :Clap blines<CR>
|
||||
nnoremap <Leader>vc :Clap bcommits<CR>
|
||||
nnoremap <Leader>va :Clap commits<CR>
|
||||
nnoremap <Leader>vh :Clap history<CR>
|
||||
nnoremap <Leader>vm :Clap command<CR>
|
||||
nnoremap <Leader>/ :Clap grep<CR>
|
||||
nnoremap <Leader>d :Clap grep ++query=<cword><CR>
|
||||
" Quick buffer switching
|
||||
nnoremap <Leader>b :ls<CR>:b<Space>
|
||||
" Undo tree
|
||||
nnoremap <Leader>u :UndotreeToggle<CR>
|
||||
|
@ -221,8 +220,6 @@ nnoremap <Leader>sv <Esc>:vsp<CR>
|
|||
nnoremap <Leader>x <Esc>:x<CR>
|
||||
nnoremap <Leader>q <Esc>:q<CR>
|
||||
nnoremap <Leader>qa <Esc>:qa<CR>
|
||||
" Search for the word under cursor
|
||||
noremap <Leader>d :exe ':Rg ' . expand('<cword>')<CR>
|
||||
" Open terminal
|
||||
nnoremap <Leader>te :vsp<CR> :terminal<CR>
|
||||
" Tab navigation shortcuts
|
||||
|
@ -458,7 +455,7 @@ autocmd BufRead,BufNewFile *.md,*.txt setlocal spell spelllang=en_uk
|
|||
" Automatically resize the window
|
||||
autocmd VimResized * wincmd =
|
||||
|
||||
" CScope & skim integration
|
||||
" CScope & fuzzy integration
|
||||
" Taken from https://gist.github.com/amitab/cd051f1ea23c588109c6cfcb7d1d5776
|
||||
" However, the above gist has completely wrong mappings
|
||||
function! Cscope(option, query)
|
||||
|
@ -475,7 +472,7 @@ function! Cscope(option, query)
|
|||
let file = split(data[0], ":")
|
||||
execute 'e ' . '+' . file[1] . ' ' . file[0]
|
||||
endfunction
|
||||
call skim#run(opts)
|
||||
call fzf#run(opts)
|
||||
endfunction
|
||||
|
||||
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>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()
|
||||
tnoremap <silent> <buffer> <esc> <c-\><c-n>
|
||||
endfunction
|
||||
|
|
Loading…
Reference in a new issue