Skip to content

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

Open
@zhf-0

Description

@zhf-0

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions