mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
perf: optimize Path.getSortOrderIndex() method. (#1429)
Some checks failed
Vint / vint (push) Has been cancelled
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user