mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-02 22:50:06 +08:00
Fix P key binding in defx (#4207)
This commit is contained in:
parent
7ae88264ee
commit
2fc101d07e
@ -272,6 +272,9 @@ function! s:DefxPasteFile(_) abort
|
|||||||
let path = fnamemodify(path, ':p:h')
|
let path = fnamemodify(path, ':p:h')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" If you have xclip-pastefile in your PATH.
|
||||||
|
" this command will be run on action directory
|
||||||
|
" support paste file which is copied outside of vim.
|
||||||
if executable('xclip-pastefile')
|
if executable('xclip-pastefile')
|
||||||
let old_wd = getcwd()
|
let old_wd = getcwd()
|
||||||
if old_wd == path
|
if old_wd == path
|
||||||
@ -281,11 +284,19 @@ function! s:DefxPasteFile(_) abort
|
|||||||
call s:VCOP.systemlist(['xclip-pastefile'])
|
call s:VCOP.systemlist(['xclip-pastefile'])
|
||||||
noautocmd exe 'cd' fnameescape(old_wd)
|
noautocmd exe 'cd' fnameescape(old_wd)
|
||||||
endif
|
endif
|
||||||
elseif s:SYS.isWindows && !empty(s:copyed_file_path)
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:SYS.isWindows && !empty(s:copyed_file_path)
|
||||||
" in windows, use copy command for paste file.
|
" in windows, use copy command for paste file.
|
||||||
let destination = path . s:FILE.separator . fnamemodify(s:copyed_file_path, ':t')
|
let destination = path . s:FILE.separator . fnamemodify(s:copyed_file_path, ':t')
|
||||||
let cmd = 'cmd /c copy ' . shellescape(s:copyed_file_path) . ' ' . shellescape(destination)
|
let cmd = 'cmd /c copy ' . shellescape(s:copyed_file_path) . ' ' . shellescape(destination)
|
||||||
call s:VCOP.systemlist(cmd)
|
call s:VCOP.systemlist(cmd)
|
||||||
|
elseif !s:SYS.isWindows && !empty(s:copyed_file_path)
|
||||||
|
" in Linux or MacOS, use cp command for paste file.
|
||||||
|
let destination = path . s:FILE.separator . fnamemodify(s:copyed_file_path, ':t')
|
||||||
|
let cmd = 'cp -r ' . shellescape(s:copyed_file_path) . ' ' . shellescape(destination)
|
||||||
|
call s:VCOP.systemlist(cmd)
|
||||||
endif
|
endif
|
||||||
if v:shell_error
|
if v:shell_error
|
||||||
echohl WarningMsg
|
echohl WarningMsg
|
||||||
|
Loading…
Reference in New Issue
Block a user