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

<C-O> doesn't work in NERDTree #250

Closed
qstrahl opened this issue Apr 22, 2013 · 9 comments
Closed

<C-O> doesn't work in NERDTree #250

qstrahl opened this issue Apr 22, 2013 · 9 comments
Labels

Comments

@qstrahl
Copy link

qstrahl commented Apr 22, 2013

Procedure

  1. I am in file /var/www/example
  2. I jump to directory /var/www/derpherper/
  3. I hit <C-O> to go back to /var/www/example

Erroneous Result

The cursor is placed on the last line in NERDTree

Expected Result

Vim jumps back to /var/www/example

@juanibiapina
Copy link
Contributor

juanibiapina commented Sep 26, 2017

There are many bugs involving ctrl+o and nerd tree, it becomes unusable if you're using :e .

@lifecrisis
Copy link
Contributor

I'm unable to replicate this problem right now. If either of you could provide more specific examples, I'd be willing to try and confirm.

@juanibiapina
Copy link
Contributor

juanibiapina commented Sep 26, 2017

Steps:

  • clear jump list
  • create two files called 1 and 2
  • :e 1
  • :e 2
  • :e . (with hijack, opens nerd tree)
  • ctrl+o (goes to end of nerd tree, annoying but fine, maybe keepjumps would help here)
  • ctrl+o (goes to file 1, wrong, end of jumps)
  • ctrl+i (goes to file 2, correct)
  • ctrl+i (goes to beginning of nerd tree, skipping end of nerd tree, wrong)

I just added this line from the documentation which fixes the behavior for this example test:

let NERDTreeCreatePrefix='silent keepalt keepjumps'

Although I still get jumps back to nerd tree and inside of it. I'm not sure I want this behavior. I'll live with my fix for a while and figure out later if I want nerdtree to mess with the jumplist at all.

@lifecrisis
Copy link
Contributor

Very good work, @juanibiapina. This bug is confirmed.

@lifecrisis lifecrisis added the bug label Sep 26, 2017
@lifecrisis
Copy link
Contributor

lifecrisis commented Sep 26, 2017

I discovered another instance of this problem just now:

  1. Position the cursor on a directory node that is not the root.
  2. Press P.
  3. Press R to refresh the tree.
  4. Press <C-O> and notice that the cursor jumps to the end of the NERDTree window.

There is clearly a problem with the way that the NERDTree does not preserve jumps when printing the tree to the tree window.

@juanibiapina
Copy link
Contributor

The worst case is when ctrl+o does not work at all, even though jumplist is full of stuff. I can't reproduce it in isolation, although it happens to me everyday.

@juanibiapina
Copy link
Contributor

I'm working on a different project now because nerdtree is too bloated and I don't use the drawer and per-tab windows anyway, but part of the fix for this is easy enough so you can port from here: juanibiapina/vim-lighttree@2521fe4

@lifecrisis
Copy link
Contributor

Thanks, @juanibiapina! I had played with a similar fix, myself.

@PhilRunninger
Copy link
Member

PhilRunninger commented Jun 26, 2020

There is no single way to define what <C-O> and <C-I> do in the context of NERDTree. Should they jump between the selected roots of NERDTree? Or should they jump between selected files? What constitutes a file selection: selecting it, opening it, collapsing a folder? What happens when a folder is expanded; now <C-O> could jump back to the wrong location.

For all these reasons and more, I'm going to close this issue. If anyone proposes a viable specification for this functionality, I'll entertain it.

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

No branches or pull requests

4 participants