Fix various little fzf annoyances: Implement good coloring of floating window. Make it use fd by default, search through hidden files but ignore the git directory itself. Also, let it split the window on s and vertical split on v.
49 lines
1.8 KiB
VimL
49 lines
1.8 KiB
VimL
" PLUGIN: fzf.vim
|
|
" set some fzf defaults
|
|
" any Fzf command is prefixed with Fzf
|
|
" this groups them nicely together, and avoids confusion when suddenly :Buffer
|
|
" or :Files would appear as a command otherwise
|
|
let g:fzf_command_prefix = 'Fzf'
|
|
" let the colors come from our colorscheme
|
|
let g:fzf_colors =
|
|
\ { 'fg': ['fg', 'Normal'],
|
|
\ 'bg': ['bg', 'Normal'],
|
|
\ 'gutter': ['bg', 'Normal'],
|
|
\ 'hl': ['fg', 'Comment'],
|
|
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
|
|
\ 'bg+': ['bg', 'Normal', 'CursorColumn'],
|
|
\ 'hl+': ['fg', 'Statement'],
|
|
\ 'info': ['fg', 'PreProc'],
|
|
\ 'border': ['fg', 'Ignore'],
|
|
\ 'prompt': ['fg', 'Conditional'],
|
|
\ 'pointer': ['fg', 'Exception'],
|
|
\ 'marker': ['fg', 'Keyword'],
|
|
\ 'spinner': ['fg', 'Label'],
|
|
\ 'header': ['fg', 'Comment'] }
|
|
|
|
let g:fzf_action = {
|
|
\ 'ctrl-t': 'tab split',
|
|
\ 'ctrl-s': 'split',
|
|
\ 'ctrl-v': 'vsplit' }
|
|
|
|
" FzfRg but also search through hidden files
|
|
command! -bang -nargs=* FzfRgHidden
|
|
\ call fzf#vim#grep(
|
|
\ "rg --column --line-number --no-heading --color=always --smart-case --hidden --glob '!.git' ".shellescape(<q-args>), 1,
|
|
\ fzf#vim#with_preview(), <bang>0)
|
|
|
|
" make fzf use the nvim floating window globally. (weee, technology!)
|
|
"
|
|
let $FZF_DEFAULT_OPTS="--layout=reverse --ansi"
|
|
let $FZF_DEFAULT_COMMAND="fd --type f --hidden --color=always -E '.git/'"
|
|
" to use fzf in a floating window only conditionally, the best approach would
|
|
" every command we want to floatize
|
|
if has('nvim-0.4.0') || has("patch-8.2.0191")
|
|
let g:fzf_layout = { 'window': {
|
|
\ 'width': 0.7,
|
|
\ 'height': 0.7,
|
|
\ 'highlight': 'PreProc',
|
|
\ 'border': 'rounded' } }
|
|
else " Fallback to a split window
|
|
let g:fzf_layout = { "window": "silent botright 16split enew" }
|
|
endif
|