Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent unneeded tree creation in :NERDTreeToggle[VCS] <path> #1101

Merged
merged 5 commits into from
Apr 13, 2020

Conversation

PhilRunninger
Copy link
Member

@PhilRunninger PhilRunninger commented Apr 13, 2020

Description of Changes

Closes #1100

NERDTreeToggleVCS works by finding the root of the repository and passing it to the NERDTreeToggle <path> function. Pull request #1083 changed the way NERDTreeToggle works, such that when a path is specified, the NERDTree's root is always set to that path. The NERDTree is collapsed as it always is when setting a new root.

This pull request tempers that behavior. If the path given (the repo's root in this case) is the same as the current NERDTree root, then don't recreate the tree.


New Version Info

Author's Instructions

  • Derive a new MAJOR.MINOR.PATCH version number. Increment the:
    • MAJOR version when you make incompatible API changes
    • MINOR version when you add functionality in a backwards-compatible manner
    • PATCH version when you make backwards-compatible bug fixes
  • Update CHANGELOG.md, following the established pattern.

Collaborator's Instructions

  • Review CHANGELOG.md, suggesting a different version number if necessary.
  • After merge, tag the merge commit, e.g. git tag -a 3.1.4 -m "v3.1.4" && git push origin --tags

@@ -366,7 +366,8 @@ function! s:Creator.toggleTabTree(dir)
if g:NERDTree.ExistsForTab()
if !g:NERDTree.IsOpen()
call self._createTreeWin()
if !empty(a:dir)
let l:currentPath = getbufvar(t:NERDTreeBufName,"NERDTree").root.path.str()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[vint] reported by reviewdog 🐶
Prefer single quoted strings (see Google VimScript Style Guide (Strings))

@PhilRunninger PhilRunninger changed the title Don't recreate the NERDTree if its root is the same as being requested. Prevent unneeded tree creation in :NERDTreeToggle[VCS] <path> Apr 13, 2020
@PhilRunninger PhilRunninger merged commit 2d7cb04 into master Apr 13, 2020
@PhilRunninger PhilRunninger deleted the 1100 branch April 13, 2020 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NERDTreeToggleVCS not working as expected
1 participant