Remove AddDefaultGroupToSortOrder check from startup.
The call to AddDefaultGroupToSortOrder in NERD_tree.vim is redundant because it's also done every time sortChildren is called. And since the check is done only once, there's no need for a function either. sortChildren now just contains the needed if statement.
This commit is contained in:
parent
6ef3213cd0
commit
1e2b7ef98d
@ -607,7 +607,9 @@ endfunction
|
|||||||
" FUNCTION: TreeDirNode.sortChildren() {{{1
|
" FUNCTION: TreeDirNode.sortChildren() {{{1
|
||||||
" Sort "self.children" by alphabetical order and directory priority.
|
" Sort "self.children" by alphabetical order and directory priority.
|
||||||
function! s:TreeDirNode.sortChildren()
|
function! s:TreeDirNode.sortChildren()
|
||||||
call AddDefaultGroupToSortOrder()
|
if count(g:NERDTreeSortOrder, '*') < 1
|
||||||
|
call add(g:NERDTreeSortOrder, '*')
|
||||||
|
endif
|
||||||
let CompareFunc = function("nerdtree#compareNodesBySortKey")
|
let CompareFunc = function("nerdtree#compareNodesBySortKey")
|
||||||
call sort(self.children, CompareFunc)
|
call sort(self.children, CompareFunc)
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -24,15 +24,6 @@ let loaded_nerd_tree = 1
|
|||||||
let s:old_cpo = &cpo
|
let s:old_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
"Function: AddDefaultGroupToSortOrder() function {{{2
|
|
||||||
"This function adds the default grouping '*' to the sort sequence if it's not
|
|
||||||
"already in the list.
|
|
||||||
function! AddDefaultGroupToSortOrder()
|
|
||||||
if count(g:NERDTreeSortOrder, '*') < 1
|
|
||||||
call add(g:NERDTreeSortOrder, '*')
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"Function: s:initVariable() function {{{2
|
"Function: s:initVariable() function {{{2
|
||||||
"This function is used to initialise a given variable to a given value. The
|
"This function is used to initialise a given variable to a given value. The
|
||||||
"variable is only initialised if it does not exist prior
|
"variable is only initialised if it does not exist prior
|
||||||
@ -90,8 +81,6 @@ call s:initVariable("g:NERDTreeCascadeSingleChildDir", 1)
|
|||||||
|
|
||||||
if !exists("g:NERDTreeSortOrder")
|
if !exists("g:NERDTreeSortOrder")
|
||||||
let g:NERDTreeSortOrder = ['\/$', '*', '\.swp$', '\.bak$', '\~$']
|
let g:NERDTreeSortOrder = ['\/$', '*', '\.swp$', '\.bak$', '\~$']
|
||||||
else
|
|
||||||
call AddDefaultGroupToSortOrder()
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call s:initVariable("g:NERDTreeGlyphReadOnly", "RO")
|
call s:initVariable("g:NERDTreeGlyphReadOnly", "RO")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user