filebrowser.vim 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. " Dirvish file browser.
  2. " Use relative paths if there is no `conceal` ability.
  3. let g:dirvish_relative_paths = (v:version <= 703 ? 1 : 0)
  4. augroup dirvishCustomisation
  5. autocmd!
  6. " Allow fugitive.vim commands in dirvish buffers.
  7. autocmd FileType dirvish call fugitive#detect(@%)
  8. " Add/Adjust mappings.
  9. " - Reverse 'o' to (o)pen and 'i' to spl(i)t.
  10. " - `mc` to create a file.
  11. autocmd FileType dirvish let s:nowait = (v:version > 703 ? '<nowait>' : '')
  12. \| execute 'nnoremap '.s:nowait.'<buffer><silent> o :<C-U>.call dirvish#open("edit", 0)<CR>'
  13. \| execute 'nnoremap '.s:nowait.'<buffer><silent> i :<C-U>.call dirvish#open("split", 1)<CR>'
  14. \| execute 'xnoremap '.s:nowait.'<buffer><silent> O :call dirvish#open("edit", 0)<CR>'
  15. \| execute 'xnoremap '.s:nowait.'<buffer><silent> I :call dirvish#open("split", 1)<CR>'
  16. \| execute 'nnoremap '.s:nowait.'<buffer> mc :e %'
  17. augroup END
  18. " CtrlP - Fuzzy Finder in Vimscript
  19. " Use `ag` as fallback if available.
  20. if executable('ag')
  21. let s:fallback = 'ag %s -l --nocolor -g ""'
  22. else
  23. let s:fallback = 'find %s -type f'
  24. endif
  25. let g:ctrlp_user_command = [
  26. \ '.git',
  27. \ 'cd %s && git ls-files . -co --exclude-standard',
  28. \ s:fallback
  29. \]
  30. " Function definition jumping with CtrlP's Funky plugin.
  31. let g:ctrlp_extensions = ['funky']
  32. map <silent> <Leader>f :CtrlPFunky<CR>
  33. " FZF - Fuzzy Finder in Go/Ruby
  34. map <silent> <Leader>p :FZF<CR>