Skip to content

Commit ffbc5d0

Browse files
committed
Improve the UI of NERDTree
1 parent 7650cdc commit ffbc5d0

File tree

1 file changed

+11
-41
lines changed

1 file changed

+11
-41
lines changed

Diff for: plugin/NERD_tree.vim

+11-41
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ endif
147147
let s:NERDTreeBufName = 'NERD_tree_'
148148

149149
let s:tree_wid = 2
150-
let s:tree_markup_reg = '^[ `|]*[\-+~]'
150+
let s:tree_markup_reg = '^[ `|▼▶]*[\-+~ ]*'
151151
let s:tree_up_dir_line = '.. (up a dir)'
152152

153153
"the number to add to the nerd tree buffer name to make the buf name unique
@@ -1313,34 +1313,20 @@ function! s:TreeFileNode._renderToString(depth, drawText, vertMap, isLastChild)
13131313
"get all the leading spaces and vertical tree parts for this line
13141314
if a:depth > 1
13151315
for j in a:vertMap[0:-2]
1316-
if j ==# 1
1317-
let treeParts = treeParts . '| '
1318-
else
1319-
let treeParts = treeParts . ' '
1320-
endif
1316+
let treeParts = treeParts . ' '
13211317
endfor
13221318
endif
13231319

1324-
"get the last vertical tree part for this line which will be different
1325-
"if this node is the last child of its parent
1326-
if a:isLastChild
1327-
let treeParts = treeParts . '`'
1328-
else
1329-
let treeParts = treeParts . '|'
1330-
endif
1331-
1332-
1333-
"smack the appropriate dir/file symbol on the line before the file/dir
1334-
"name itself
13351320
if self.path.isDirectory
13361321
if self.isOpen
1337-
let treeParts = treeParts . '~'
1322+
let treeParts = treeParts . ''
13381323
else
1339-
let treeParts = treeParts . '+'
1324+
let treeParts = treeParts . ''
13401325
endif
13411326
else
1342-
let treeParts = treeParts . '-'
1327+
let treeParts = treeParts . ''
13431328
endif
1329+
13441330
let line = treeParts . self.displayString()
13451331

13461332
let output = output . line . "\n"
@@ -3068,9 +3054,9 @@ function! s:getPath(ln)
30683054
endif
30693055

30703056
" in case called from outside the tree
3071-
if line !~ '^ *[|`]' || line =~ '^$'
3072-
return {}
3073-
endif
3057+
"if line !~ '^ *[|`▶▼ ]' || line =~ '^$'
3058+
"return {}
3059+
"endif
30743060

30753061
if line ==# s:tree_up_dir_line
30763062
return b:NERDTreeRoot.path.getParent()
@@ -3628,24 +3614,8 @@ endfunction
36283614
function! s:checkForActivate()
36293615
let currentNode = s:TreeFileNode.GetSelected()
36303616
if currentNode != {}
3631-
let startToCur = strpart(getline(line(".")), 0, col("."))
3632-
let char = strpart(startToCur, strlen(startToCur)-1, 1)
3633-
3634-
"if they clicked a dir, check if they clicked on the + or ~ sign
3635-
"beside it
3636-
if currentNode.path.isDirectory
3637-
if startToCur =~ s:tree_markup_reg . '$' && char =~ '[+~]'
3638-
call s:activateNode(0)
3639-
return
3640-
endif
3641-
endif
3642-
3643-
if (g:NERDTreeMouseMode ==# 2 && currentNode.path.isDirectory) || g:NERDTreeMouseMode ==# 3
3644-
if char !~ s:tree_markup_reg && startToCur !~ '\/$'
3645-
call s:activateNode(0)
3646-
return
3647-
endif
3648-
endif
3617+
call s:activateNode(0)
3618+
return
36493619
endif
36503620
endfunction
36513621

0 commit comments

Comments
 (0)