Skip to content

Instantly share code, notes, and snippets.

@drasill
Created November 19, 2015 09:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drasill/ff9b94025dc8aa7e404f to your computer and use it in GitHub Desktop.
Save drasill/ff9b94025dc8aa7e404f to your computer and use it in GitHub Desktop.
vim : git ls-file + fzf
function! s:escape(path)
return substitute(a:path, ' ', '\\ ', 'g')
endfunction
function! GitLsHandler(line)
execute 'e '. s:escape(a:line)
endfunction
command! -nargs=* Fgl call fzf#run({
\ 'source': 'git ls-files -o -c --exclude-standard "<args>"',
\ 'sink': function('GitLsHandler'),
\ 'options': '+m',
\ 'tmux_height': '60%'
\ })
@drasill
Copy link
Author

drasill commented Nov 19, 2015

To use it with vim-plug :

Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'https://gist.github.com/drasill/ff9b94025dc8aa7e404f',
    \ { 'dir': g:plug_home.'/vim-fzf-git-ls-files/plugin', 'rtp': '..' }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment