fzf.vim 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. " This is the default extra key bindings
  2. let g:fzf_action = {
  3. \ 'ctrl-t': 'tab split',
  4. \ 'ctrl-x': 'split',
  5. \ 'ctrl-v': 'vsplit' }
  6. " An action can be a reference to a function that processes selected lines
  7. function! s:build_quickfix_list(lines)
  8. call setqflist(map(copy(a:lines), '{ "filename": v:val }'))
  9. copen
  10. cc
  11. endfunction
  12. let g:fzf_action = {
  13. \ 'ctrl-q': function('s:build_quickfix_list'),
  14. \ 'ctrl-t': 'tab split',
  15. \ 'ctrl-x': 'split',
  16. \ 'ctrl-v': 'vsplit' }
  17. " Default fzf layout
  18. " - down / up / left / right
  19. let g:fzf_layout = { 'down': '~40%' }
  20. " You can set up fzf window using a Vim command (Neovim or latest Vim 8 required)
  21. let g:fzf_layout = { 'window': 'enew' }
  22. let g:fzf_layout = { 'window': '-tabnew' }
  23. let g:fzf_layout = { 'window': '10new' }
  24. " Customize fzf colors to match your color scheme
  25. " - fzf#wrap translates this to a set of `--color` options
  26. let g:fzf_colors =
  27. \ { 'fg': ['fg', 'Normal'],
  28. \ 'bg': ['bg', 'Normal'],
  29. \ 'hl': ['fg', 'Comment'],
  30. \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
  31. \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
  32. \ 'hl+': ['fg', 'Statement'],
  33. \ 'info': ['fg', 'PreProc'],
  34. \ 'border': ['fg', 'Ignore'],
  35. \ 'prompt': ['fg', 'Conditional'],
  36. \ 'pointer': ['fg', 'Exception'],
  37. \ 'marker': ['fg', 'Keyword'],
  38. \ 'spinner': ['fg', 'Label'],
  39. \ 'header': ['fg', 'Comment'] }
  40. " Enable per-command history
  41. " - History files will be stored in the specified directory
  42. " - When set, CTRL-N and CTRL-P will be bound to 'next-history' and
  43. " 'previous-history' instead of 'down' and 'up'.
  44. "let g:fzf_history_dir = '~/.local/share/fzf-history'
  45. if has('nvim') && !exists('g:fzf_layout')
  46. autocmd! FileType fzf
  47. autocmd FileType fzf set laststatus=0 noshowmode noruler
  48. \| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
  49. endif
  50. if has("nvim")
  51. au TermOpen * tnoremap <Esc> <c-\><c-n>
  52. au FileType fzf tunmap <Esc>
  53. endif
  54. nnoremap <C-p> :FZF<CR>