vim-nerdtree-tabs icon indicating copy to clipboard operation
vim-nerdtree-tabs copied to clipboard

Opening a file in background resets cursor position

Open ivanalejandro0 opened this issue 13 years ago • 7 comments
trafficstars

If i open a file in a tab but keeps focus (shortcut T in NERDTree) the cursor goes back to top. It's annoying because i often open many files like this.

ivanalejandro0 avatar Aug 05 '12 07:08 ivanalejandro0

I just spent some time on this. Sadly, Vim doesn't fire TabEnter event when switching back to the original tab after the new tab is set up, so I can't call the view restoration method in the original tab. Not really sure how to tackle this now, but I'm leaving it open for pull requests.

jistr avatar Sep 01 '12 23:09 jistr

NERDtree can do it on it's own -- I assume that's because it does not open a new NERDtree tab. Perhaps the solution is to only open a new nerdtree tab window when the tab is actually selected?

This might make it more responsive too -- if I have multiple tabs open I can see NERDtree open in each tab sequentially, and I can take a second or two. I have this plugin activated by toggling <TAB> (nerdtree is configured to close on TAB, also)

naggie avatar Jul 31 '13 10:07 naggie

NERDtree can do it on it's own -- I assume that's because it does not open a new NERDtree tab. Perhaps the solution is to only open a new nerdtree tab window when the tab is actually selected?

Hmm might be... If we can distinguish between "this tab was selected because NERDTree is opening a new file in it" and "this tab was was selected because user switched to it manually", then it might be a solution.

This might make it more responsive too -- if I have multiple tabs open I can see NERDTree open in each tab sequentially, and I can take a second or two.

Yeah this variant was discussed a already for possibility of speed improvements for users who open/close NERDTree a lot. The speed of nerdtree toggle would increase, but speed of tab switching would decrease, since you would open/close NERDTree upon tab switch. FTR - the speed of toggling was discussed in #3 (and improved a bit), and then resubmitted as #33.

jistr avatar Jul 31 '13 19:07 jistr

I'm open to have vim-nerdtree-tabs refactored into the lazy-toggling mode, if it doesn't break other stuff. Open for pull requests :)

jistr avatar Jul 31 '13 19:07 jistr

sorry to trouble, but now.. any progress of this issue.. how should I record last cursor position..

thanks for the smart plugin :)

regards.

L-Jovi avatar Apr 08 '17 20:04 L-Jovi

interested as well ! Just curious, @jistr if you dont use nerdtree anymore, what do you use instead ?

lpyparmentier avatar Jun 02 '23 18:06 lpyparmentier

@lpyparmentier Heh i use emacs :). The experience with vim scripting was one of the reasons to make the switch. Considering scripting power and plugin robustness, vim and emacs don't even play in the same league. To be fair, emacs' ergonomy is pretty bad. I had to remap the keyboard on all my computers to (hopefully) prevent emacs-induced RSI :).

jistr avatar Jun 05 '23 15:06 jistr