From c6a68d4b962e747a58450ae03f7f443deb0afddf Mon Sep 17 00:00:00 2001 From: Jason Franklin Date: Sat, 6 Jan 2018 09:02:10 -0500 Subject: [PATCH] Improve the style in a "TreeFileNode" method No functional changes here. --- lib/nerdtree/tree_file_node.vim | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/nerdtree/tree_file_node.vim b/lib/nerdtree/tree_file_node.vim index c7e4895..3ad9fcb 100644 --- a/lib/nerdtree/tree_file_node.vim +++ b/lib/nerdtree/tree_file_node.vim @@ -196,14 +196,18 @@ function! s:TreeFileNode.GetRootForTab() endfunction " FUNCTION: TreeFileNode.GetSelected() {{{1 -" gets the treenode that the cursor is currently over +" If the cursor is currently positioned on a tree node, return the node. +" Otherwise, return the empty dictionary. function! s:TreeFileNode.GetSelected() + try - let path = b:NERDTree.ui.getPath(line(".")) - if path ==# {} + let l:path = b:NERDTree.ui.getPath(line('.')) + + if empty(l:path) return {} endif - return b:NERDTree.root.findNode(path) + + return b:NERDTree.root.findNode(l:path) catch /^NERDTree/ return {} endtry