commit c6a68d4b962e747a58450ae03f7f443deb0afddf parent d745e11b42201e4cdec2b98ca51011ffcaf1236b Author: Jason Franklin <j_fra@fastmail.us> Date: Sat, 6 Jan 2018 09:02:10 -0500 Improve the style in a "TreeFileNode" method No functional changes here. Diffstat:
| M | 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 @@ -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
