mirror of
https://github.com/preservim/nerdtree.git
synced 2024-10-18 13:50:21 +03:00
speedup: Path.getSortOrderIndex() optimisation.
This commit is contained in:
parent
9b465acb27
commit
b98c51aad1
@ -362,9 +362,10 @@ endfunction
|
|||||||
" returns the index of the pattern in g:NERDTreeSortOrder that this path matches
|
" returns the index of the pattern in g:NERDTreeSortOrder that this path matches
|
||||||
function! s:Path.getSortOrderIndex()
|
function! s:Path.getSortOrderIndex()
|
||||||
let i = 0
|
let i = 0
|
||||||
|
let l:lpc = self.getLastPathComponent(1)
|
||||||
while i < len(g:NERDTreeSortOrder)
|
while i < len(g:NERDTreeSortOrder)
|
||||||
if g:NERDTreeSortOrder[i] !~? '\[\[-\?\(timestamp\|size\|extension\)\]\]' &&
|
if g:NERDTreeSortOrder[i] !~? '\[\[-\?\(timestamp\|size\|extension\)\]\]' &&
|
||||||
\ self.getLastPathComponent(1) =~# g:NERDTreeSortOrder[i]
|
\ l:lpc =~# g:NERDTreeSortOrder[i]
|
||||||
return i
|
return i
|
||||||
endif
|
endif
|
||||||
let i = i + 1
|
let i = i + 1
|
||||||
@ -373,6 +374,7 @@ function! s:Path.getSortOrderIndex()
|
|||||||
return index(g:NERDTreeSortOrder, '*')
|
return index(g:NERDTreeSortOrder, '*')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" FUNCTION: Path._splitChunks(path) {{{1
|
" FUNCTION: Path._splitChunks(path) {{{1
|
||||||
" returns a list of path chunks
|
" returns a list of path chunks
|
||||||
function! s:Path._splitChunks(path)
|
function! s:Path._splitChunks(path)
|
||||||
|
Loading…
Reference in New Issue
Block a user