nerdtree icon indicating copy to clipboard operation
nerdtree copied to clipboard

Make bookmarks remember state of tree

Open qstrahl opened this issue 13 years ago • 35 comments

I often do :NERDTree <bookmark> then manually open the various subdirectories I want. It would be super convenient if NERDTree remembered the open/closed state of the tree when I create a bookmark so I don't have to do it myself.

qstrahl avatar Apr 09 '13 17:04 qstrahl

+1

nomasprime avatar Jul 17 '14 13:07 nomasprime

+1

erichua23 avatar Sep 13 '14 11:09 erichua23

+1

djdarkbeat avatar Oct 21 '14 12:10 djdarkbeat

+1

Yavor-Ivanov avatar Feb 12 '15 10:02 Yavor-Ivanov

+1

jubalh avatar Feb 19 '15 09:02 jubalh

+1

gustavklopp avatar Mar 14 '15 14:03 gustavklopp

+1

protist avatar Mar 19 '15 09:03 protist

+1 sad so see this must have feature is pending from almost two year :(.

hemantmits avatar May 08 '15 10:05 hemantmits

+1

alexandnpu avatar May 09 '15 02:05 alexandnpu

+1

igormoreno avatar May 12 '15 14:05 igormoreno

+1

bitzip avatar May 16 '15 05:05 bitzip

Gentlemen, I hear you and will be implementing this shortly.

scrooloose avatar May 29 '15 16:05 scrooloose

You all can use this plugin: https://github.com/jistr/vim-nerdtree-tabs It works, but also "blinks" on my configuration, but you should try to use it!

UPD: probably it should correctly works with buffers, not tabs.

ghost avatar Jun 05 '15 21:06 ghost

+1

JohnTortugo avatar Sep 30 '15 14:09 JohnTortugo

+1

brodieG avatar Oct 20 '15 00:10 brodieG

Hey all, I have been looking into this and have taken a stab at it here: https://gist.github.com/scrooloose/741b04b0a6dc8c69d043

Things to note:

  1. I have called the idea "projects" instead of "bookmarks" since that is the direction they are heading in.
  2. The concept is implemented as a nerdtree plugin at the moment. When the code/functionality stabilizes I will either add it to the core, or leave it as a plugin and hand it off to someone.
  3. The interface is just :commands at the moment, but this may get more snazzy later according to feedback.
  4. Currently, the only functionality that projects offer over bookmarks is remembering the state of the tree. I have other ideas and feature requests that may be implemented though.

Thoughts/feedback welcome.

scrooloose avatar Nov 20 '15 22:11 scrooloose

Do you have the latest version of nerdtree? (I should have mentioned that)

scrooloose avatar Nov 20 '15 23:11 scrooloose

Do you have the latest version of nerdtree? (I should have mentioned that)

Sorry, I've just updated and it only requires to manually create the "touch ~/.NERDTreeProjects"

ghost avatar Nov 20 '15 23:11 ghost

I can offer this use case (I will add it by myself, but not now). It will give you dynamicaly synchronization between tabs (I hope):

  1. Add to .vimrc
autocmd BufNewFile,BufRead /home/user/projects/project1/* let project_name=project1
  1. Add to NERDTree this functionality:

on_NERDTree_open or on_[tab/buffer/NERDTree]_focus_in:

if (project_name) then NERDTreeProjectLoad project_name

on_NERDTree_close or on_[tab/buffer/NERDTree]_focus_out:

if (project_name)
then NERDTreeProjectSave project_name

And thank you for you job! <3

ghost avatar Nov 20 '15 23:11 ghost

Also now it has a bug with autocomplete of project names:

What I do:

:NERDTreeProjectLoad t<tab>

What I get (but it works!):

:NERDTreeProjectLoad test
test  test  test
:NERDTreeProjectLoad test

ghost avatar Nov 20 '15 23:11 ghost