Skip to content

Keep NERDTree open when first select a file #494

Closed
@tnguyen14

Description

@tnguyen14

I am not sure if this is the right place to ask this kind of question, but I've tried to do some digging around the web and have not seen anything similar to what I have.

I have set up NERDTree to open whenever I open vim with these commands in my .vimrc from the FAQs:

autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTreeToggle | endif

So NERDTree would open when I first open vim. I would then navigate to the file I want, hit <Enter> to open that file. Upon doing that, the NERDTree window closes. When I do NERDTreeToggle again, the NERDTree window opens, but the position of any expanded directory is lost, i.e. it is reset to the original structure.

If I start expanding them now, and toggle NERDTree again, the positions are remembered from this point.

So my question is whether there's a way to not close the window when I first open the file, and also to remember the position of how the folders are expanded?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions