0

I do this,

$ tree
.
├── dir1
│   ├── dir11
│   │   └── hello
│   └── dir12
│       └── hello
└── dir2
    ├── dir21
    │   └── hello
    └── dir22
        └── hello
$ cd dir1/dir11
$ vim

then I open NERDTree, and see it shows

  [  ]hello

then I press Shift+U twice, and NERDTree shows this:

▾ [  ]dir1/
  ▸ [  ]dir11/
  ▸ [  ]dir12/
▸ [  ]dir2/

whereas I expected this:

▾ [  ]dir1/
  ▾ [  ]dir11/
      [  ]hello
  ▸ [  ]dir12/
▸ [  ]dir2/

Unless someone tells me it has always worked the former way, I'm pretty sure I relied on it working the latter way.

EDIT:

When I'm in the NERDTree window, :map U gives back this:

n  U           *@:call nerdtree#ui_glue#invokeKeyMap("U")<CR>
9
  • Probably the NERDTree maintainers would know – D. Ben Knoble Sep 18 '20 at 19:34
  • Works the way you expect for me. In fact the help says "Like |NERDTree-u| except that the old tree root is kept open." So, if I'm reading that right, you would have to have overridden the default behavior to NOT see 'hello'. It's like you are actually using u. Are you sure you are using all default settings? – B Layer Sep 18 '20 at 22:39
  • An example of a setting that might inhibit expected behavior is NerdTreeShowFiles (mapped to F), i.e. to demonstrate directly you can hit F then UU (not saying you did that, just demonstrating how it would replicate your unexpected result). Check all mappings and settings is my final comment for now. :) – B Layer Sep 18 '20 at 22:49
  • @BLayer, no the result I get and show in the question is not what I would obtain by using u, but the one I'd get by using uU. I'll check the mappings, however. – Enlico Sep 18 '20 at 23:11
  • 1
    Yeah, there's no way in hell I would have guessed THAT one. Sounds like someone might not be using key map scoping appropriately in their plugin. – B Layer Sep 18 '20 at 23:27
0

As suggested by BLayer in the comments, the problem comes from the settings.

However, it's not a NERDTree setting, but a vim-devicons setting which breaks the U command of NERDTree!

Indeed, this is the culprit in my ~/.vimrc:

let g:DevIconsEnableFoldersOpenClose = 1

This setting is meant to use a special symbol for open folder, and it works, in that sense. However I have to comment it to take advantage of NERDTree's U mapping.

I've opened an issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.