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

Open a mirrored NERDTree with correct width #1177

Merged
merged 5 commits into from
Oct 14, 2020
Merged

Open a mirrored NERDTree with correct width #1177

merged 5 commits into from
Oct 14, 2020

Conversation

PhilRunninger
Copy link
Member

@PhilRunninger PhilRunninger commented Oct 6, 2020

Description of Changes

Closes #1176. {lib/nerdtree/creator.vim}

When mirroring a NERDTree buffer on another tab, it was being displayed with the default width, even if the original NERDTree window was zoomed (with the Shift+A key). This PR fixes that issue, by restoring the window's size and position after displaying the NERDTree buffer in the tab's new window.

To recreate the issue:

:let NERDTreeQuitOnOpen=1
:NERDTree
    Shift+A   - to zoom the NERDTree window
    t         - to open a file in a new tab
:NERDTreeMirror    - to open the same NERDTree buffer in the new tab

There was some cleanup done in the PR as well.

  1. An unused variable was removed; it was referenced, but never set anywhere. {lib/nerdtree/opener.vim, lib/nerdtree/ui.vim}
  2. The variable initialization code was updated to use the get() function for more direct assignment of values. {plugin/NERD_tree.vim}

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 merging, tag the commit using these (Mac-compatible) bash commands:
    git checkout master
    git pull
    sed -n "$(grep -n -m2 '####' CHANGELOG.md | cut -f1 -d: | sed 'N;s/\n/,/')p" CHANGELOG.md | sed '$d'
    git tag -a $(read -p "Tag Name: " tag;echo $tag) -m"$(git show --quiet --pretty=%s)";git push origin --tags

b:NERDTreeOldWindowSize was referenced, but never set anywhere. No need
to keep it around.
Using the get() function allows us to "let" variables more directly,
without using the execute command or requiring strings to be escaped.
This also eliminates the s:initVariable function. The new format is
shown below, and defines a default value if the user didn't provide a
value in the vimrc file.

  let g:var = get(g: 'var', 'default value')
@PhilRunninger PhilRunninger merged commit 14af897 into master Oct 14, 2020
@PhilRunninger PhilRunninger deleted the i1176 branch October 14, 2020 22:08
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.

Just updated. Every tab I close shrinks the file explorer to the default width
1 participant