Created
May 24, 2022 05:11
-
-
Save rvighne/99c98080e79cbd2fdf9d4a097c783e9d to your computer and use it in GitHub Desktop.
fzf.vim is great, but its :GFiles always assumes that .git is in a particular place. It can be made more robust to this and other edge cases by integrating with Fugitive, which already abstracts the details of interacting with Git.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Alternative to GFiles: integrate with Fugitive to work better in edge cases | |
" Completion should actually be pathspec, not file, but close enough | |
command -bang -nargs=* -complete=file FugitiveFiles | |
\ call fzf#run(fzf#wrap('gfiles', fzf#vim#with_preview({ | |
\ 'source': FugitiveShellCommand('ls-files', '-z', '--', <f-args>), | |
\ 'options': '--read0 --multi --no-clear --prompt=' . shellescape('FugitiveFiles> ') | |
\ }), <bang>0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment