Merge pull request #340 from netj/sort-hidden-first-option

Option for mixing dot files when sorting
This commit is contained in:
Martin Grenfell 2014-06-26 09:18:44 +01:00
commit 47a3a84108
3 changed files with 9 additions and 0 deletions

View File

@ -620,6 +620,10 @@ NERD tree. These options should be set in your vimrc.
|'NERDTreeCaseSensitiveSort'| Tells the NERD tree whether to be case |'NERDTreeCaseSensitiveSort'| Tells the NERD tree whether to be case
sensitive or not when sorting nodes. sensitive or not when sorting nodes.
|'NERDTreeSortHiddenFirst'| Tells the NERD tree whether to take the dot
at the beginning of the hidden file names
into account when sorting nodes.
|'NERDTreeChDirMode'| Tells the NERD tree if/when it should change |'NERDTreeChDirMode'| Tells the NERD tree if/when it should change
vim's current working directory. vim's current working directory.

View File

@ -103,6 +103,10 @@ function! s:Path.compareTo(path)
elseif thisSS > thatSS elseif thisSS > thatSS
return 1 return 1
else else
if !g:NERDTreeSortHiddenFirst
let thisPath = substitute(thisPath, '^[._]', '', '')
let thatPath = substitute(thatPath, '^[._]', '', '')
endif
"if the sort sequences are the same then compare the paths "if the sort sequences are the same then compare the paths
"alphabetically "alphabetically
let pathCompare = g:NERDTreeCaseSensitiveSort ? thisPath <# thatPath : thisPath <? thatPath let pathCompare = g:NERDTreeCaseSensitiveSort ? thisPath <# thatPath : thisPath <? thatPath

View File

@ -49,6 +49,7 @@ call s:initVariable("g:NERDChristmasTree", 1)
call s:initVariable("g:NERDTreeAutoCenter", 1) call s:initVariable("g:NERDTreeAutoCenter", 1)
call s:initVariable("g:NERDTreeAutoCenterThreshold", 3) call s:initVariable("g:NERDTreeAutoCenterThreshold", 3)
call s:initVariable("g:NERDTreeCaseSensitiveSort", 0) call s:initVariable("g:NERDTreeCaseSensitiveSort", 0)
call s:initVariable("g:NERDTreeSortHiddenFirst", 1)
call s:initVariable("g:NERDTreeChDirMode", 0) call s:initVariable("g:NERDTreeChDirMode", 0)
call s:initVariable("g:NERDTreeMinimalUI", 0) call s:initVariable("g:NERDTreeMinimalUI", 0)
if !exists("g:NERDTreeIgnore") if !exists("g:NERDTreeIgnore")