1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 13:50:05 +08:00

Add key bindings for paste files

This commit is contained in:
wsdjeg 2017-12-01 14:46:42 +08:00
parent 007d3fda9c
commit edba8c1eed

View File

@ -84,6 +84,7 @@ function! s:vimfilerinit()
nnoremap <silent><buffer><expr> sv vimfiler#do_action('split') nnoremap <silent><buffer><expr> sv vimfiler#do_action('split')
nnoremap <silent><buffer><expr> st vimfiler#do_action('tabswitch') nnoremap <silent><buffer><expr> st vimfiler#do_action('tabswitch')
nnoremap <silent><buffer> yY :<C-u>call <SID>copy_to_system_clipboard()<CR> nnoremap <silent><buffer> yY :<C-u>call <SID>copy_to_system_clipboard()<CR>
nnoremap <silent><buffer> P :<C-u>call <SID>paste_to_file_manager()<CR>
nmap <buffer> gx <Plug>(vimfiler_execute_vimfiler_associated) nmap <buffer> gx <Plug>(vimfiler_execute_vimfiler_associated)
nmap <buffer> ' <Plug>(vimfiler_toggle_mark_current_line) nmap <buffer> ' <Plug>(vimfiler_toggle_mark_current_line)
nmap <buffer> v <Plug>(vimfiler_quick_look) nmap <buffer> v <Plug>(vimfiler_quick_look)
@ -96,6 +97,21 @@ function! s:vimfilerinit()
nmap <buffer> <Right> <Plug>(vimfiler_smart_l) nmap <buffer> <Right> <Plug>(vimfiler_smart_l)
endf endf
function! s:paste_to_file_manager() abort
let path = vimfiler#get_filename()
if !isdirectory(path)
let path = fnamemodify(path, ':p:h')
endif
let old_wd = getcwd()
if old_wd == path
call s:VCOP.systemlist(['xclip-pastefile'])
else
noautocmd exe 'cd' fnameescape(path)
call s:VCOP.systemlist(['xclip-pastefile'])
noautocmd exe 'cd' fnameescape(old_wd)
endif
endfunction
function! s:copy_to_system_clipboard() abort function! s:copy_to_system_clipboard() abort
let filename = vimfiler#get_marked_filenames(b:vimfiler) let filename = vimfiler#get_marked_filenames(b:vimfiler)