Compare commits

..

7 Commits

Author SHA1 Message Date
Max Coplan
690d061b59 chore: fix typo in README (#1439)
Some checks failed
Vint / vint (push) Has been cancelled
2025-09-26 19:37:39 +03:30
rzvxa
0b3c1dc0fa fix: emit init notification on fs menu's add file (#1447) 2025-09-26 19:35:22 +03:30
inzeets
915f64b3be fix: emit init notifications on new and transplanted children (#1438) 2025-09-26 19:29:35 +03:30
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
7 changed files with 36 additions and 24 deletions

View File

@@ -13,6 +13,10 @@
- Pull Request Title n (PR Author) [PR Number](Link to PR)
-->
#### 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**:
- 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)

View File

@@ -87,7 +87,7 @@ After installing NERDTree, the best way to learn it is to turn on the Quick Help
NERDTree can be extended with custom mappings and functions using its built-in API. The details of this API are described in the included documentation. Several plugins have been written, and are available on Github for installation like any other plugin. The plugins in this list are maintained (or not) by their respective owners, and certain combinations may be incompatible.
* [Xuyuanp/nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin): Shows Git status flags for files and folders in NERDTree.
* [ryanoasis/vim-devicons](https://github.com/ryanoasis/vim-devicons): Adds filetype-specific icons to NERDTree files and folders,
* [ryanoasis/vim-devicons](https://github.com/ryanoasis/vim-devicons): Adds filetype-specific icons to NERDTree files and folders.
* [tiagofumo/vim-nerdtree-syntax-highlight](https://github.com/tiagofumo/vim-nerdtree-syntax-highlight): Adds syntax highlighting to NERDTree based on filetype.
* [scrooloose/nerdtree-project-plugin](https://github.com/scrooloose/nerdtree-project-plugin): Saves and restores the state of the NERDTree between sessions.
* [PhilRunninger/nerdtree-buffer-ops](https://github.com/PhilRunninger/nerdtree-buffer-ops): 1) Highlights open files in a different color. 2) Closes a buffer directly from NERDTree.
@@ -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?
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
" 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

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.
------------------------------------------------------------------------------
*NERDTreeShowFilesLines*
*NERDTreeFileLines*
Values: 0 or 1.
Default: 0.
@@ -1083,8 +1083,8 @@ file.
This setting can be toggled dynamically, per tree, with the |NERDTree-FL|
mapping.
Use one of the follow lines for this setting: >
let NERDTreeShowFilesLines=0
let NERDTreeShowFilesLines=1
let NERDTreeFileLines=0
let NERDTreeFileLines=1
<
------------------------------------------------------------------------------
*NERDTreeShowHidden*

View File

@@ -62,11 +62,7 @@ function! s:Path.cacheDisplayString() abort
endif
if self.isSymLink
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' -> '
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . self.symLinkDest
if self.isBroken
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . g:NERDTreeGlyphBroken
endif
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' -> ' . self.symLinkDest
endif
if !self.isDirectory && b:NERDTree.ui.getShowFileLines() != 0
@@ -366,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
@@ -611,33 +608,24 @@ function! s:Path.readInfoFromDisk(fullpath)
let fullpath = s:Path.WinToUnixPath(a:fullpath)
let ftype = getftype(fullpath)
if ftype ==# 'fifo'
if getftype(fullpath) ==# 'fifo'
throw 'NERDTree.InvalidFiletypeError: Cant handle FIFO files: ' . a:fullpath
endif
let self.pathSegments = filter(split(fullpath, '/'), '!empty(v:val)')
let self.isReadOnly = 0
if isdirectory(a:fullpath)
let self.isDirectory = 1
let self.isReadOnly = 0
let self.isBroken = 0
elseif filereadable(a:fullpath)
let self.isDirectory = 0
let self.isReadOnly = filewritable(a:fullpath) ==# 0
let self.isBroken = 0
elseif ftype ==# 'link'
let self.isDirectory = 0
let self.isReadOnly = 0
let self.isBroken = 1
else
call nerdtree#echoWarning('invalid ' . a:fullpath . 'file type: ' . ftype)
throw 'NERDTree.InvalidArgumentsError: Invalid path = ' . a:fullpath
endif
let self.isExecutable = 0
if !self.isDirectory && !self.isBroken
if !self.isDirectory
let self.isExecutable = getfperm(a:fullpath) =~# 'x'
endif

View File

@@ -299,7 +299,7 @@ function! s:TreeDirNode._glob(pattern, all)
" See ':h version7.txt' and ':h version8.txt' for details on the
" development of the glob() and globpath() functions.
if v:version > 704 || (v:version ==# 704 && has('patch654'))
let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1, 1)
let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1, 0)
elseif v:version ==# 704 && has('patch279')
let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1)
elseif v:version > 702 || (v:version ==# 702 && has('patch051'))
@@ -591,6 +591,7 @@ function! s:TreeDirNode.refresh()
let newNode = g:NERDTreeFileNode.New(path, self.getNerdtree())
let newNode.parent = self
call add(newChildNodes, newNode)
call g:NERDTreePathNotifier.NotifyListeners('init', newNode.path, newNode.getNerdtree(), {})
endif
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
let invalidFilesFound += 1
@@ -715,6 +716,7 @@ function! s:TreeDirNode.transplantChild(newNode)
break
endif
endfor
call self.refresh()
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View File

@@ -211,6 +211,7 @@ function! NERDTreeAddNode()
call b:NERDTree.render()
elseif parentNode.isOpen || !empty(parentNode.children)
call parentNode.addChild(newTreeNode, 1)
call g:NERDTreePathNotifier.NotifyListeners('init', newTreeNode.path, newTreeNode.getNerdtree(), {})
call NERDTreeRender()
call newTreeNode.putCursorHere(1, 0)
endif

View File

@@ -71,7 +71,6 @@ let g:NERDTreeSortOrder = get(g:, 'NERDTreeSortOrder', ['\/$', '*', '\.swp$',
let g:NERDTreeOldSortOrder = []
let g:NERDTreeGlyphReadOnly = get(g:, 'NERDTreeGlyphReadOnly', 'RO')
let g:NERDTreeGlyphBroken = get(g:, 'NERDTreeGlyphBroken', ' [*broken]')
if has('conceal')
let g:NERDTreeNodeDelimiter = get(g:, 'NERDTreeNodeDelimiter', "\x07")