diff --git a/doc/NERD_tree.txt b/doc/NERD_tree.txt index bf03896..f1abb88 100644 --- a/doc/NERD_tree.txt +++ b/doc/NERD_tree.txt @@ -620,6 +620,10 @@ NERD tree. These options should be set in your vimrc. |'NERDTreeCaseSensitiveSort'| Tells the NERD tree whether to be case 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 vim's current working directory. diff --git a/lib/nerdtree/path.vim b/lib/nerdtree/path.vim index 58bb013..72a230b 100644 --- a/lib/nerdtree/path.vim +++ b/lib/nerdtree/path.vim @@ -103,6 +103,10 @@ function! s:Path.compareTo(path) elseif thisSS > thatSS return 1 else + if !g:NERDTreeSortHiddenFirst + let thisPath = substitute(thisPath, '^[._]', '', '') + let thatPath = substitute(thatPath, '^[._]', '', '') + endif "if the sort sequences are the same then compare the paths "alphabetically let pathCompare = g:NERDTreeCaseSensitiveSort ? thisPath <# thatPath : thisPath