Skip to content

Commit b4b4130

Browse files
Eugenij-Wrzvxa
andauthored
perf: optimize Path.getSortOrderIndex() method. (#1429)
* speedup: Path.getSortOrderIndex() optimisation. * refactor: remove the redundant new line --------- Co-authored-by: rzvxa <[email protected]>
1 parent 9b465ac commit b4b4130

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/nerdtree/path.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,10 @@ endfunction
362362
" returns the index of the pattern in g:NERDTreeSortOrder that this path matches
363363
function! s:Path.getSortOrderIndex()
364364
let i = 0
365+
let l:lpc = self.getLastPathComponent(1)
365366
while i < len(g:NERDTreeSortOrder)
366367
if g:NERDTreeSortOrder[i] !~? '\[\[-\?\(timestamp\|size\|extension\)\]\]' &&
367-
\ self.getLastPathComponent(1) =~# g:NERDTreeSortOrder[i]
368+
\ l:lpc =~# g:NERDTreeSortOrder[i]
368369
return i
369370
endif
370371
let i = i + 1

0 commit comments

Comments
 (0)