initial commit
This commit is contained in:
commit
c687d085bb
24
plugin/ranger.vim
Normal file
24
plugin/ranger.vim
Normal file
|
@ -0,0 +1,24 @@
|
|||
function! RangeChooser()
|
||||
let temp = tempname()
|
||||
exec 'silent !ranger --choosefiles=' . shellescape(temp)
|
||||
if !filereadable(temp)
|
||||
" Nothing to read.
|
||||
redraw!
|
||||
return
|
||||
endif
|
||||
let names = readfile(temp)
|
||||
if empty(names)
|
||||
" Nothing to open.
|
||||
redraw!
|
||||
return
|
||||
endif
|
||||
" Edit the first item.
|
||||
exec 'edit ' . fnameescape(names[0])
|
||||
" Add any remaning items to the arg list/buffer list.
|
||||
for name in names[1:]
|
||||
exec 'argadd ' . fnameescape(name)
|
||||
endfor
|
||||
redraw!
|
||||
endfunction
|
||||
command! -bar RangerChooser call RangeChooser()
|
||||
nnoremap <leader>f :<C-U>RangerChooser<CR>
|
Loading…
Reference in New Issue
Block a user