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

If a file's already open in the window, don't edit it again. #1103

Merged
merged 3 commits into from
Apr 15, 2020

Conversation

PhilRunninger
Copy link
Member

@PhilRunninger PhilRunninger commented Apr 15, 2020

Description of Changes

Closes #1102

The issue can be recreated without NERDTree using these commands that simulate what NERDTree does:

$ echo "hello" > world.txt
$ vim
:set noconfirm
:e world.txt
:copy 0
:vsplit
:e world.txt

The solution is to skip the second :e world.txt command if the file is already open in the new window. This fixes a regression introduced in #1098.


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

@PhilRunninger PhilRunninger merged commit 0257d64 into master Apr 15, 2020
@PhilRunninger PhilRunninger deleted the 1102 branch April 15, 2020 04:55
@scrawld
Copy link

scrawld commented Apr 15, 2020

Hello, I can't open the file after upgrading nerdtree to 6.7.6

Error detected while processing function nerdtree#ui_glue#invokeKeyMap[1]..80[18]..79[3]..30_customOpenFile[1]..109[1]..125[3]..181[6]..182[17]..16:
line 2:
E119: Not enough arguments for function: bufname
E15: Invalid expression: bufname() !=# l:bufname

@scrawld
Copy link

scrawld commented Apr 15, 2020

avatar

@thomasvm
Copy link

Upgrading to vim 8.2 fixed the problem for me personally, but I guess this plugin wants to maintain some kind of backwards compatibility for older vim versions.

@PhilRunninger
Copy link
Member Author

Yes, the bufname() implementation changed in 8.2, such that the argument is optional. I fixed this in #1105

@btjanaka
Copy link

This is awesome; I just encountered this error from installing NERDTree last night and it's already fixed. Thanks!

@scrawld
Copy link

scrawld commented Apr 16, 2020

Thanks, I upgraded vim to 8.2 and the problem was solved

@scrawld
Copy link

scrawld commented Apr 16, 2020

Today I have a new problem.
When use NERDTree to open a file in a directory, it opens a directory instead.
The cause of this problem is that I moved the directory of the file.

avatar

@PhilRunninger
Copy link
Member Author

@scrawld, can you open a new issue for this and provide more detail about how to recreate it?

Thanks!

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.

Error detected while processing function nerdtree#ui_glue#invokeKeyMap
4 participants