From e9cc0e46f7e1eed52c670ac5c5bf97ff309b01b0 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 9 Jun 2024 18:22:17 +0800 Subject: [PATCH] fix(nerdtree): fix `Enter` key binding of nerdtree --- config/plugins/nerdtree.vim | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/config/plugins/nerdtree.vim b/config/plugins/nerdtree.vim index 6838614b1..0cbec66ad 100644 --- a/config/plugins/nerdtree.vim +++ b/config/plugins/nerdtree.vim @@ -94,10 +94,13 @@ function! s:nerdtree_dot() abort endfunction function! s:nerdtree_enter() abort - let path = g:NERDTreeFileNode.GetSelected().path.str() - if isdirectory(path) - silent! exe 'NERDTree' g:NERDTreeFileNode.GetSelected().path.str() - else - call g:NERDTreeKeyMap.Invoke('o') + let node = g:NERDTreeFileNode.GetSelected() + if has_key(node, 'path') + let path = node.path.str() + if isdirectory(path) + silent! exe 'NERDTree' g:NERDTreeFileNode.GetSelected().path.str() + else + call g:NERDTreeKeyMap.Invoke('o') + endif endif endfunction