Compare commits

...

4 Commits

Author SHA1 Message Date
Eugenij
b4b4130f3c 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>
2025-09-26 10:59:45 +03:30
rzvxa
9b465acb27 chore: bump version to 7.1.3. (#1414) 2024-07-20 08:31:16 +03:30
Lothar Droppelmann
09aec2cfca fix: typo in docs for show file lines setting (#1426)
Co-authored-by: Lothar Droppelmann <lothar.droppelmann@gmail.com>
2024-07-20 08:20:24 +03:30
Ali Rezvani
fbb71fcd90 docs: update FAQ snippets containing quit command. (#1417) 2024-05-14 19:09:02 +03:30
4 changed files with 27 additions and 4 deletions

View File

@@ -13,6 +13,10 @@
- Pull Request Title n (PR Author) [PR Number](Link to PR) - Pull Request Title n (PR Author) [PR Number](Link to PR)
--> -->
#### 7.1 #### 7.1
- **.3**:
- docs: update FAQ snippets containing quit command. (rzvxa) [#1417](https://github.com/preservim/nerdtree/pull/1417)
- feat: jump to bookmark table shortcut. (ds2606, rzvxa) [#1394](https://github.com/preservim/nerdtree/pull/1394)
- fix: typo in docs for show file lines setting. (lothardp) [#1426](https://github.com/preservim/nerdtree/pull/1426)
- **.2**: - **.2**:
- fix: GetWinNum regex pattern. (rzvxa) [#1409](https://github.com/preservim/nerdtree/pull/1409) - fix: GetWinNum regex pattern. (rzvxa) [#1409](https://github.com/preservim/nerdtree/pull/1409)
- fix: session restore for nerdtree buffers. (rzvxa) [#1405](https://github.com/preservim/nerdtree/pull/1405) - fix: session restore for nerdtree buffers. (rzvxa) [#1405](https://github.com/preservim/nerdtree/pull/1405)

View File

@@ -150,6 +150,24 @@ autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in
### How can I close Vim or a tab automatically when NERDTree is the last window? ### How can I close Vim or a tab automatically when NERDTree is the last window?
Because of the changes in how Vim handles its `autocmd` and layout locking `quit` command is no longer available in Vim9 auto commands, Depending on which version you're running select one of these solutions.
__NeoVim users should be able to choose either one of them!__
#### Vim9
```vim
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | call feedkeys(":quit\<CR>:\<BS>") | endif
```
---
```vim
" Close the tab if NERDTree is the only window remaining in it.
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | call feedkeys(":quit\<CR>:\<BS>") | endif
```
#### Vim8 or older
```vim ```vim
" Exit Vim if NERDTree is the only window remaining in the only tab. " Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif

View File

@@ -1073,7 +1073,7 @@ mapping and is useful for drastically shrinking the tree when you are
navigating to a different part of the tree. navigating to a different part of the tree.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*NERDTreeShowFilesLines* *NERDTreeFileLines*
Values: 0 or 1. Values: 0 or 1.
Default: 0. Default: 0.
@@ -1083,8 +1083,8 @@ file.
This setting can be toggled dynamically, per tree, with the |NERDTree-FL| This setting can be toggled dynamically, per tree, with the |NERDTree-FL|
mapping. mapping.
Use one of the follow lines for this setting: > Use one of the follow lines for this setting: >
let NERDTreeShowFilesLines=0 let NERDTreeFileLines=0
let NERDTreeShowFilesLines=1 let NERDTreeFileLines=1
< <
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*NERDTreeShowHidden* *NERDTreeShowHidden*

View File

@@ -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