switching to fzf
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
call plug#begin('~/.config/nvim/plugins')
|
call plug#begin('~/.config/nvim/plugins')
|
||||||
Plug 'cloudhead/neovim-fuzzy'
|
|
||||||
Plug 'jnurmine/Zenburn'
|
Plug 'jnurmine/Zenburn'
|
||||||
|
Plug 'junegunn/fzf'
|
||||||
|
Plug 'junegunn/fzf.vim'
|
||||||
Plug 'mhinz/vim-signify'
|
Plug 'mhinz/vim-signify'
|
||||||
Plug 'LnL7/vim-nix'
|
Plug 'LnL7/vim-nix'
|
||||||
call plug#end()
|
call plug#end()
|
||||||
@@ -12,9 +13,6 @@ endif
|
|||||||
|
|
||||||
filetype plugin indent on
|
filetype plugin indent on
|
||||||
|
|
||||||
" https://github.com/cloudhead/neovim-fuzzy/issues/50
|
|
||||||
let g:fuzzy_rootcmds = [["git", "rev-parse", "--show-toplevel"]]
|
|
||||||
|
|
||||||
let g:markdown_fenced_languages = ['python', 'bash=sh', 'go', 'c', 'cpp', 'yaml', 'json', 'sql', 'haskell']
|
let g:markdown_fenced_languages = ['python', 'bash=sh', 'go', 'c', 'cpp', 'yaml', 'json', 'sql', 'haskell']
|
||||||
|
|
||||||
set autowrite
|
set autowrite
|
||||||
@@ -36,9 +34,15 @@ set statusline=\(%n\)\ %<%.99f\ %y\ %w%m%r%=%-14.(%l,%c%V%)\ %P
|
|||||||
set textwidth=120
|
set textwidth=120
|
||||||
set wrapscan
|
set wrapscan
|
||||||
|
|
||||||
nnoremap <silent> <C-o> :FuzzyOpen<CR>
|
" fzf mappings
|
||||||
nnoremap <silent> <C-_> :FuzzyGrep<CR>
|
nnoremap <silent> <C-g> :Buffers<CR>
|
||||||
nnoremap <silent> <C-b> :buffers<CR>:buffer<Space>
|
nnoremap <silent> <C-o> :Files<CR>
|
||||||
|
nnoremap <silent> <C-q> :Bd<CR>
|
||||||
|
if has('mac')
|
||||||
|
nnoremap <silent> <C-/> :Rg<CR>
|
||||||
|
elseif has('linux')
|
||||||
|
nnoremap <silent> <C-_> :Rg<CR>
|
||||||
|
endif
|
||||||
|
|
||||||
nnoremap <silent> <esc><esc> :nohls<CR>
|
nnoremap <silent> <esc><esc> :nohls<CR>
|
||||||
|
|
||||||
@@ -55,6 +59,24 @@ function! s:StripTrailing()
|
|||||||
call cursor(l, c)
|
call cursor(l, c)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" helper functions and command for `:bd` in fzf
|
||||||
|
function! s:ListBuffers()
|
||||||
|
redir => list
|
||||||
|
silent ls
|
||||||
|
redir END
|
||||||
|
return split(list, "\n")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:DeleteBuffers(lines)
|
||||||
|
execute 'bwipeout' join(map(a:lines, {_, line -> split(line)[0]}))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
command! Bd call fzf#run(fzf#wrap({
|
||||||
|
\ 'source': s:ListBuffers(),
|
||||||
|
\ 'sink*': { lines -> s:DeleteBuffers(lines) },
|
||||||
|
\ 'options': '--multi --reverse --bind ctrl-a:select-all+accept --prompt "Bd> "'
|
||||||
|
\ }))
|
||||||
|
|
||||||
augroup vimrc
|
augroup vimrc
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufWritePre * call s:StripTrailing()
|
autocmd BufWritePre * call s:StripTrailing()
|
||||||
|
|||||||
Reference in New Issue
Block a user