Merge pull request #1083 from preservim/1076

NERDTree <start-directory> always sets NERDTree root.
This commit is contained in:
Phil Runninger
2020-01-28 03:59:24 -05:00
committed by GitHub
3 changed files with 13 additions and 7 deletions

View File

@@ -7,6 +7,8 @@
in an unordered list. The format is: in an unordered list. The format is:
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR) - **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
--> -->
#### 6.5
- **.0**: `NERDTreeToggle <start-directory>` always sets NERDTree root. (PhilRunninger) [#1083](https://github.com/preservim/nerdtree/pull/1083)
#### 6.4 #### 6.4
- **.6**: NERDTreeFind shows expected message if file doesn't exist e.g. with vim-startify (andys8). [#1081](https://github.com/preservim/nerdtree/pull/1081) - **.6**: NERDTreeFind shows expected message if file doesn't exist e.g. with vim-startify (andys8). [#1081](https://github.com/preservim/nerdtree/pull/1081)
- **.5**: Ensure events are (or aren't) being ignored correctly. (PhilRunninger) [#1080](https://github.com/preservim/nerdtree/pull/1080) - **.5**: Ensure events are (or aren't) being ignored correctly. (PhilRunninger) [#1080](https://github.com/preservim/nerdtree/pull/1080)

View File

@@ -122,8 +122,9 @@ The following features and functionality are provided by the NERDTree:
:NERDTreeToggle [<start-directory> | <bookmark>] *:NERDTreeToggle* :NERDTreeToggle [<start-directory> | <bookmark>] *:NERDTreeToggle*
If a NERDTree already exists for this tab, it is reopened and rendered If a NERDTree already exists for this tab, it is reopened and rendered
again. If no NERDTree exists for this tab then this command acts the again. If <start-directory> or <bookmark> is given, the root of NERDTree
same as the |:NERDTree| command. is set to that path. If no NERDTree exists for this tab then this command
acts the same as the |:NERDTree| command.
:NERDTreeToggleVCS [<start-directory> | <bookmark>] *:NERDTreeToggleVCS* :NERDTreeToggleVCS [<start-directory> | <bookmark>] *:NERDTreeToggleVCS*
Like |:NERDTreeToggle|, but searches up the directory tree to find the top of Like |:NERDTreeToggle|, but searches up the directory tree to find the top of

View File

@@ -355,17 +355,20 @@ function! s:Creator.ToggleTabTree(dir)
endfunction endfunction
" FUNCTION: s:Creator.toggleTabTree(dir) {{{1 " FUNCTION: s:Creator.toggleTabTree(dir) {{{1
" Toggles the NERD tree. I.e the NERD tree is open, it is closed, if it is " Toggles the NERD tree. I.e if the NERD tree is open, it is closed. If it is
" closed it is restored or initialized (if it doesnt exist) " closed, it is restored or initialized. If dir is not empty, it will be set
" as the new root.
" "
" Args: " Args:
" dir: the full path for the root node (is only used if the NERD tree is being " dir: the full path for the root node (is used if the NERD tree is being
" initialized. " initialized, or to change the root to a new dir.)
function! s:Creator.toggleTabTree(dir) function! s:Creator.toggleTabTree(dir)
if g:NERDTree.ExistsForTab() if g:NERDTree.ExistsForTab()
if !g:NERDTree.IsOpen() if !g:NERDTree.IsOpen()
call self._createTreeWin() call self._createTreeWin()
if !&hidden if !empty(a:dir)
call self.createTabTree(a:dir)
elseif !&hidden
call b:NERDTree.render() call b:NERDTree.render()
endif endif
call b:NERDTree.ui.restoreScreenState() call b:NERDTree.ui.restoreScreenState()