summaryrefslogtreecommitdiff
path: root/modules/fzf.vim
diff options
context:
space:
mode:
Diffstat (limited to 'modules/fzf.vim')
-rw-r--r--modules/fzf.vim63
1 files changed, 63 insertions, 0 deletions
diff --git a/modules/fzf.vim b/modules/fzf.vim
new file mode 100644
index 00000000..4466a32f
--- /dev/null
+++ b/modules/fzf.vim
@@ -0,0 +1,63 @@
+" This is the default extra key bindings
+let g:fzf_action = {
+ \ 'ctrl-t': 'tab split',
+ \ 'ctrl-x': 'split',
+ \ 'ctrl-v': 'vsplit' }
+
+" An action can be a reference to a function that processes selected lines
+function! s:build_quickfix_list(lines)
+ call setqflist(map(copy(a:lines), '{ "filename": v:val }'))
+ copen
+ cc
+endfunction
+
+let g:fzf_action = {
+ \ 'ctrl-q': function('s:build_quickfix_list'),
+ \ 'ctrl-t': 'tab split',
+ \ 'ctrl-x': 'split',
+ \ 'ctrl-v': 'vsplit' }
+
+" Default fzf layout
+" - down / up / left / right
+let g:fzf_layout = { 'down': '~40%' }
+
+" You can set up fzf window using a Vim command (Neovim or latest Vim 8 required)
+let g:fzf_layout = { 'window': 'enew' }
+let g:fzf_layout = { 'window': '-tabnew' }
+let g:fzf_layout = { 'window': '10new' }
+
+" Customize fzf colors to match your color scheme
+" - fzf#wrap translates this to a set of `--color` options
+let g:fzf_colors =
+\ { 'fg': ['fg', 'Normal'],
+ \ 'bg': ['bg', 'Normal'],
+ \ 'hl': ['fg', 'Comment'],
+ \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
+ \ 'bg+': ['bg', 'CursorLine', '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'] }
+
+" Enable per-command history
+" - History files will be stored in the specified directory
+" - When set, CTRL-N and CTRL-P will be bound to 'next-history' and
+" 'previous-history' instead of 'down' and 'up'.
+"let g:fzf_history_dir = '~/.local/share/fzf-history'
+
+if has('nvim') && !exists('g:fzf_layout')
+ autocmd! FileType fzf
+ autocmd FileType fzf set laststatus=0 noshowmode noruler
+ \| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
+endif
+
+if has("nvim")
+ au TermOpen * tnoremap <Esc> <c-\><c-n>
+ au FileType fzf tunmap <Esc>
+endif
+
+nnoremap <C-p> :FZF<CR>