lf/etc/lf.vim
2016-09-07 01:47:08 +03:00

35 lines
863 B
VimL

" Use lf to select and open a file in vim (adapted from ranger).
"
" You need to either copy the content of this file to your ~/.vimrc or source
" this file directly using something like:
"
" let lfvim = $GOPATH . "/src/github.com/gokcehan/lf/etc/lf.vim"
" if filereadable(lfvim)
" exec "source " . lfvim
" endif
"
" You may also like to assign a key to this command:
"
" nnoremap <leader>l :<c-u>LF<cr>
"
function! LF()
let temp = tempname()
exec 'silent !lf -selection-path=' . shellescape(temp)
if !filereadable(temp)
redraw!
return
endif
let names = readfile(temp)
if empty(names)
redraw!
return
endif
exec 'edit ' . fnameescape(names[0])
for name in names[1:]
exec 'argadd ' . fnameescape(name)
endfor
redraw!
endfunction
command! -bar LF call LF()