mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-02 22:40:06 +08:00
Fix yarked action
This commit is contained in:
parent
5e8a168add
commit
724c73a8cf
@ -121,8 +121,7 @@ function! s:defx_init()
|
||||
\ defx#do_action('remove')
|
||||
nnoremap <silent><buffer><expr> r
|
||||
\ defx#do_action('rename')
|
||||
nnoremap <silent><buffer><expr> yy
|
||||
\ defx#do_action('yank_path')
|
||||
nnoremap <silent><buffer><expr> yy defx#do_action('call', 'DefxYarkPath')
|
||||
nnoremap <silent><buffer><expr> .
|
||||
\ defx#do_action('toggle_ignored_files')
|
||||
nnoremap <silent><buffer><expr> ~
|
||||
@ -144,7 +143,7 @@ function! DefxSmartH(_)
|
||||
if defx#is_opened_tree()
|
||||
return defx#call_action('close_tree')
|
||||
endif
|
||||
|
||||
|
||||
" parent is root?
|
||||
let s:candidate = defx#get_candidate()
|
||||
let s:parent = fnamemodify(s:candidate['action__path'], s:candidate['is_directory'] ? ':p:h:h' : ':p:h')
|
||||
@ -152,14 +151,20 @@ function! DefxSmartH(_)
|
||||
if s:trim_right(s:parent, sep) == s:trim_right(b:defx.paths[0], sep)
|
||||
return defx#call_action('cd', ['..'])
|
||||
endif
|
||||
|
||||
|
||||
" move to parent.
|
||||
call defx#call_action('search', s:parent)
|
||||
|
||||
|
||||
" if you want close_tree immediately, enable below line.
|
||||
call defx#call_action('close_tree')
|
||||
endfunction
|
||||
|
||||
function! DefxYarkPath(_) abort
|
||||
let candidate = defx#get_candidate()
|
||||
let @+ = candidate['action__path']
|
||||
echo 'yarked: ' . @+
|
||||
endfunction
|
||||
|
||||
function! s:trim_right(str, trim)
|
||||
return substitute(a:str, printf('%s$', a:trim), '', 'g')
|
||||
endfunction
|
||||
|
Loading…
Reference in New Issue
Block a user