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

the cursor jump back to the former file after opening a new tab #1427

Open
zhf-0 opened this issue Jul 23, 2024 · 0 comments
Open

the cursor jump back to the former file after opening a new tab #1427

zhf-0 opened this issue Jul 23, 2024 · 0 comments

Comments

@zhf-0
Copy link

zhf-0 commented Jul 23, 2024

Description

When I open a new file in a new tab by t, the NERDTree will open a tab, but leave the former tab with the name NRED_tree_tab_1, whose name is meaningless and sometimes inconvenient. I have to go back to the former tab and use CTRL+w+l command to change the cursor to the file.

Taking the picture below as an example, the cursor is now on the file a.cpp, and I want to open b.h in a new tab.
Screenshot from 2024-07-23 21-19-25

When I move the cursor to the left column and open the file b.h in a new tab by t, the result is as follow:
Screenshot from 2024-07-23 21-23-45

The name of the first tab (a.cpp) is now NRED_tree_tab_1. The issue is the same as issue #774 and I don't think changing the name by hand is a good idea.

I come up with an idea: when a new tab is opened by t, the cursor in the old tab should jump back to the location in the former file, not staying in the NERDTree anymore. Then the name of the old tab will become the name of the file.

Taking the picture upper as an example, after I open b.h by t in the tab containing a.cpp, the cursor in the first tab should jump back to the file a.cpp automatically, not staying in the NERDTree column. The name of the first tab will change back to a.cpp.

I think this is a natural way to fix the name issue. But I don't know how to implement the idea in NERDTree effectively, can you help me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant