summaryrefslogtreecommitdiffstats
path: root/vimrc
diff options
context:
space:
mode:
authorJesse Luehrs <doy@stripe.com>2018-03-05 10:37:25 -0800
committerJesse Luehrs <doy@tozt.net>2018-03-05 10:38:21 -0800
commit5c6c8399fee5261f7f213f36547940d06fffc8c1 (patch)
tree0b0550bbc72d09ecd6c8041498dc3a9641567e18 /vimrc
parentae4bb459bcb00b5818286f56cfdcd320296e7b57 (diff)
downloadconf-5c6c8399fee5261f7f213f36547940d06fffc8c1.tar.gz
conf-5c6c8399fee5261f7f213f36547940d06fffc8c1.zip
better fzf handling for git repos
Diffstat (limited to 'vimrc')
-rw-r--r--vimrc10
1 files changed, 9 insertions, 1 deletions
diff --git a/vimrc b/vimrc
index a801dfe..18df9c5 100644
--- a/vimrc
+++ b/vimrc
@@ -78,13 +78,21 @@ else
let s:horiz_preview_layout = 'right:50%:hidden'
endif
let s:ag_opts = {"options": ["-d:", "-n4"]}
+function! s:fzf_files()
+ silent let out = system("git rev-parse --show-toplevel 2>/dev/null")
+ if strlen(out)
+ exe "GFiles -co --exclude-standard"
+ else
+ exe "Files"
+ endif
+endfunction
command! -bang -nargs=* Ag
\ call fzf#vim#ag(<q-args>,
\ "--hidden",
\ <bang>0 ? fzf#vim#with_preview(s:ag_opts, 'up:60%')
\ : fzf#vim#with_preview(s:ag_opts, s:horiz_preview_layout, '?'),
\ <bang>0)
-nnoremap <silent> t :Files<CR>
+nnoremap <silent> t :call <SID>fzf_files()<CR>
nnoremap <silent> ff :Ag<CR>
nnoremap <silent> fh :Helptags<CR>
nnoremap <silent> ft :Filetypes<CR>