1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-13 02:05:40 +08:00

Add feature for copy/paste file

This commit is contained in:
wsdjeg 2017-12-01 14:05:46 +08:00
parent d81c440947
commit 77823ecd4f

View File

@ -1,4 +1,7 @@
scriptencoding utf-8
let s:VCOP = SpaceVim#api#import('vim#compatible')
let g:vimfiler_as_default_explorer = get(g:, 'vimfiler_as_default_explorer', 1)
let g:vimfiler_restore_alternate_file = get(g:, 'vimfiler_restore_alternate_file', 1)
let g:vimfiler_tree_indentation = get(g:, 'vimfiler_tree_indentation', 1)
@ -80,6 +83,7 @@ function! s:vimfilerinit()
nnoremap <silent><buffer><expr> sg vimfiler#do_action('vsplit')
nnoremap <silent><buffer><expr> sv vimfiler#do_action('split')
nnoremap <silent><buffer><expr> st vimfiler#do_action('tabswitch')
nnoremap <silent><buffer> yY :<C-u>call <SID>copy_to_system_clipboard()<CR>
nmap <buffer> gx <Plug>(vimfiler_execute_vimfiler_associated)
nmap <buffer> ' <Plug>(vimfiler_toggle_mark_current_line)
nmap <buffer> v <Plug>(vimfiler_quick_look)
@ -92,4 +96,20 @@ function! s:vimfilerinit()
nmap <buffer> <Right> <Plug>(vimfiler_smart_l)
endf
function! s:copy_to_system_clipboard() abort
let filename = vimfiler#get_marked_filenames(b:vimfiler)
if empty(filename)
" Use cursor filename.
let filename = vimfiler#get_filename()
if filename == '..' || empty(vimfiler#get_file(b:vimfiler))
let filename = b:vimfiler.current_dir
else
let filename = vimfiler#get_file(b:vimfiler).action__path
endif
endif
" we need xclip-copyfile
call s:VCOP.systemlist(['xclip-copyfile', filename])
endfunction
" vim:set et sw=2: