mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 10:20:05 +08:00
Fix SPC j d/D key binding (#2753)
This commit is contained in:
parent
456ad32bf2
commit
c2228a6db9
@ -11,7 +11,7 @@ let s:SYS = SpaceVim#api#import('system')
|
||||
function! SpaceVim#layers#core#plugins() abort
|
||||
let plugins = []
|
||||
if g:spacevim_filemanager ==# 'nerdtree'
|
||||
call add(plugins, ['scrooloose/nerdtree', { 'on_cmd' : 'NERDTreeToggle',
|
||||
call add(plugins, ['scrooloose/nerdtree', { 'merged' : 0,
|
||||
\ 'loadconf' : 1}])
|
||||
elseif g:spacevim_filemanager ==# 'vimfiler'
|
||||
call add(plugins, ['Shougo/vimfiler.vim',{'merged' : 0, 'loadconf' : 1 , 'loadconf_before' : 1, 'on_cmd' : ['VimFiler', 'VimFilerBufferDir']}])
|
||||
@ -100,14 +100,12 @@ function! SpaceVim#layers#core#config() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['j', 'f'], '<C-i>', 'jump forward', 0)
|
||||
|
||||
" file tree key bindings
|
||||
if g:spacevim_filemanager ==# 'vimfiler'
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['j', 'd'], 'VimFiler -no-split', 'Explore current directory', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['j', 'D'], 'VimFiler', 'Explore current directory (other window)', 1)
|
||||
elseif g:spacevim_filemanager ==# 'nerdtree'
|
||||
elseif g:spacevim_filemanager ==# 'defx'
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['j', 'd'], 'let g:_spacevim_autoclose_defx = 0 | Defx -split=no | let g:_spacevim_autoclose_defx = 1', 'Explore current directory', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['j', 'D'], 'Defx', 'Explore current directory (other window)', 1)
|
||||
endif
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['j', 'd'], 'call call('
|
||||
\ . string(s:_function('s:explore_current_dir')) . ', [0])',
|
||||
\ 'Explore current directory', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['j', 'D'], 'call call('
|
||||
\ . string(s:_function('s:explore_current_dir')) . ', [1])',
|
||||
\ 'Explore current directory(other windows)', 1)
|
||||
|
||||
call SpaceVim#mapping#space#def('nmap', ['j', 'j'], '<Plug>(easymotion-overwin-f)', 'jump to a character', 0)
|
||||
call SpaceVim#mapping#space#def('nmap', ['j', 'J'], '<Plug>(easymotion-overwin-f2)', 'jump to a suite of two characters', 0)
|
||||
@ -663,3 +661,31 @@ endfunction
|
||||
function! s:restart_neovim_qt() abort
|
||||
call system('taskkill /f /t /im nvim.exe')
|
||||
endfunction
|
||||
|
||||
|
||||
let g:_spacevim_autoclose_filetree = 1
|
||||
function! s:explore_current_dir(cur) abort
|
||||
if g:spacevim_filemanager ==# 'vimfiler'
|
||||
if !a:cur
|
||||
let g:_spacevim_autoclose_filetree = 0
|
||||
VimFilerCurrentDir -no-split -no-toggle
|
||||
let g:_spacevim_autoclose_filetree = 1
|
||||
else
|
||||
VimFilerCurrentDir -no-toggle
|
||||
endif
|
||||
elseif g:spacevim_filemanager ==# 'nerdtree'
|
||||
if !a:cur
|
||||
exe 'e ' . getcwd()
|
||||
else
|
||||
NERDTreeCWD
|
||||
endif
|
||||
elseif g:spacevim_filemanager ==# 'defx'
|
||||
if !a:cur
|
||||
let g:_spacevim_autoclose_filetree = 0
|
||||
Defx -no-toggle -no-resume -split=no `getcwd()`
|
||||
let g:_spacevim_autoclose_filetree = 1
|
||||
else
|
||||
Defx -no-toggle
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
@ -34,14 +34,12 @@ call defx#custom#column('filename', {
|
||||
\ 'opened_icon': '',
|
||||
\ })
|
||||
|
||||
let g:_spacevim_autoclose_defx = 1
|
||||
|
||||
augroup vfinit
|
||||
au!
|
||||
autocmd FileType defx call s:defx_init()
|
||||
" auto close last defx windows
|
||||
autocmd BufEnter * nested if
|
||||
\ (!has('vim_starting') && winnr('$') == 1 && g:_spacevim_autoclose_defx
|
||||
\ (!has('vim_starting') && winnr('$') == 1 && g:_spacevim_autoclose_filetree
|
||||
\ && &filetype ==# 'defx') |
|
||||
\ call s:close_last_vimfiler_windows() | endif
|
||||
augroup END
|
||||
|
@ -68,7 +68,7 @@ call vimfiler#custom#profile('default', 'context', {
|
||||
augroup vfinit
|
||||
au!
|
||||
autocmd FileType vimfiler call s:vimfilerinit()
|
||||
autocmd BufEnter * nested if (!has('vim_starting') && winnr('$') == 1 && &filetype ==# 'vimfiler') |
|
||||
autocmd BufEnter * nested if (!has('vim_starting') && winnr('$') == 1 && &filetype ==# 'vimfiler' && g:_spacevim_autoclose_filetree) |
|
||||
\ call s:close_last_vimfiler_windows() | endif
|
||||
augroup END
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user