diff --git a/config/plugins/vimfiler.vim b/config/plugins/vimfiler.vim index 373a56a32..513b6c9f2 100644 --- a/config/plugins/vimfiler.vim +++ b/config/plugins/vimfiler.vim @@ -84,6 +84,7 @@ function! s:vimfilerinit() nnoremap sv vimfiler#do_action('split') nnoremap st vimfiler#do_action('tabswitch') nnoremap yY :call copy_to_system_clipboard() + nnoremap P :call paste_to_file_manager() nmap gx (vimfiler_execute_vimfiler_associated) nmap ' (vimfiler_toggle_mark_current_line) nmap v (vimfiler_quick_look) @@ -96,6 +97,21 @@ function! s:vimfilerinit() nmap (vimfiler_smart_l) 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 let filename = vimfiler#get_marked_filenames(b:vimfiler)