speedup: Path.getSortOrderIndex() optimisation.

This commit is contained in:
Eugenij-W 2024-08-25 01:22:52 +06:00
parent 9b465acb27
commit b98c51aad1

View File

@ -362,9 +362,10 @@ endfunction
" returns the index of the pattern in g:NERDTreeSortOrder that this path matches
function! s:Path.getSortOrderIndex()
let i = 0
let l:lpc = self.getLastPathComponent(1)
while i < len(g:NERDTreeSortOrder)
if g:NERDTreeSortOrder[i] !~? '\[\[-\?\(timestamp\|size\|extension\)\]\]' &&
\ self.getLastPathComponent(1) =~# g:NERDTreeSortOrder[i]
\ l:lpc =~# g:NERDTreeSortOrder[i]
return i
endif
let i = i + 1
@ -373,6 +374,7 @@ function! s:Path.getSortOrderIndex()
return index(g:NERDTreeSortOrder, '*')
endfunction
" FUNCTION: Path._splitChunks(path) {{{1
" returns a list of path chunks
function! s:Path._splitChunks(path)