Skip to content
Snippets Groups Projects
Commit 46374cfb authored by Henrik Tjäder's avatar Henrik Tjäder
Browse files

FZF tuning

parent f16213ae
Branches
No related tags found
No related merge requests found
...@@ -1136,7 +1136,7 @@ let $FZF_DEFAULT_COMMAND='rg --vimgrep --no-heading --color=never --smart-case - ...@@ -1136,7 +1136,7 @@ let $FZF_DEFAULT_COMMAND='rg --vimgrep --no-heading --color=never --smart-case -
" Ripgrep advanced " Ripgrep advanced
function! RipgrepFzf(query, fullscreen) function! RipgrepFzf(query, fullscreen)
let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case --hidden %s || true' let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case --hidden -g\!.git -g\!.pijul -g\!.ccls-cache %s || true'
let initial_command = printf(command_fmt, shellescape(a:query)) let initial_command = printf(command_fmt, shellescape(a:query))
let reload_command = printf(command_fmt, '{q}') let reload_command = printf(command_fmt, '{q}')
let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]} let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
...@@ -1145,12 +1145,29 @@ endfunction ...@@ -1145,12 +1145,29 @@ endfunction
command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0) command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0)
" Pijul
function! RipgrepPijulFzf(query, fullscreen)
let command_fmt = 'pijul log || %s || true'
let initial_command = printf(command_fmt, shellescape(a:query))
let reload_command = printf(command_fmt, '{q}')
let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
endfunction
command! -nargs=* -bang PJ call RipgrepPijulFzf(<q-args>, <bang>0)
" Git grep " Git grep
command! -bang -nargs=* GGrep command! -bang -nargs=* GGrep
\ call fzf#vim#grep( \ call fzf#vim#grep(
\ 'git grep --line-number '.shellescape(<q-args>), 0, \ 'git grep --line-number '.shellescape(<q-args>), 0,
\ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), <bang>0) \ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), <bang>0)
" Pijul grep
command! -bang -nargs=* PGrep
\ call fzf#vim#grep(
\ 'pijul log'.shellescape(<q-args>), 0,
\ fzf#vim#with_preview(), <bang>0)
" Enable Ag and Rg for fzf plugin " Enable Ag and Rg for fzf plugin
"command! -bang -nargs=* Ag call fzf#vim#ag_interactive(<q-args>, fzf#vim#with_preview('right:50%:hidden', 'alt-h')) "command! -bang -nargs=* Ag call fzf#vim#ag_interactive(<q-args>, fzf#vim#with_preview('right:50%:hidden', 'alt-h'))
...@@ -1162,18 +1179,18 @@ command! -bang -nargs=* GGrep ...@@ -1162,18 +1179,18 @@ command! -bang -nargs=* GGrep
let g:rg_command = ' let g:rg_command = '
\ rg --files --column --line-number --no-heading --fixed-strings --ignore-case --no-ignore --hidden --follow --color "always" \ rg --files --column --line-number --no-heading --fixed-strings --ignore-case --no-ignore --hidden --follow --color "always"
\ -g "*.{js,json,php,md,styl,jade,html,config,py,cpp,c,go,hs,rb,conf,robot,rs}" \ -g "*.{js,json,php,md,styl,jade,html,config,py,cpp,c,go,hs,rb,conf,robot,rs}"
\ -g "!{.git,node_modules,vendor}/*" ' \ -g "!{.git,.pijul,node_modules,vendor}/*" '
"command! -bang -nargs=* F call fzf#vim#grep(g:rg_command .shellescape(<q-args>), 1, <bang>0) "command! -bang -nargs=* F call fzf#vim#grep(g:rg_command .shellescape(<q-args>), 1, <bang>0)
command! -bang -nargs=* Rgrust command! -bang -nargs=* Rgrust
\ call fzf#vim#grep( \ call fzf#vim#grep(
\ 'rg -g!target -g!book -g!docs --column --line-number --no-heading --smart-case -- '.shellescape(<q-args>), 1, \ 'rg -g!target -g!book -g!docs --column --line-number --no-heading --smart-case --hidden -g\!.git -g\!.pijul -g\!.ccls-cache -- '.shellescape(<q-args>), 1,
\ fzf#vim#with_preview(), <bang>0) \ fzf#vim#with_preview(), <bang>0)
command! -bang -nargs=* Rgg command! -bang -nargs=* Rgg
\ call fzf#vim#grep( \ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=always '.shellescape(<q-args>), 1, \ 'rg --column --line-number --no-heading --color=always --hidden -g\!.git -g\!.pijul -g\!.ccls-cache '.shellescape(<q-args>), 1,
\ <bang>0 ? fzf#vim#with_preview('up:60%') \ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('up:50%', '?'), \ : fzf#vim#with_preview('up:50%', '?'),
\ <bang>0) \ <bang>0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment