perf: optimize Path.getSortOrderIndex() method. (#1429)
Some checks failed
Vint / vint (push) Has been cancelled

* speedup: Path.getSortOrderIndex() optimisation.

* refactor: remove the redundant new line

---------

Co-authored-by: rzvxa <3788964+rzvxa@users.noreply.github.com>
This commit is contained in:
Eugenij
2025-09-26 13:29:45 +06:00
committed by GitHub
parent 9b465acb27
commit b4b4130f3c

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