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

Quickfix window displaces NERDTree #66

Open
jondkinney opened this issue Feb 26, 2013 · 13 comments
Open

Quickfix window displaces NERDTree #66

jondkinney opened this issue Feb 26, 2013 · 13 comments
Labels

Comments

@jondkinney
Copy link

Things get weird when I search with NERDTree open and then open one of the results in a split:

Screen Shot 2013-02-26 at 12 05 40 PM

@kassio
Copy link
Contributor

kassio commented Mar 12, 2014

Could you check if this still happening with master version!? I'll close it for now, but feel free to reopen it if necessary.

@kassio kassio closed this as completed Mar 12, 2014
@jondkinney
Copy link
Author

@kassio this seems to be happening again. Though it is replacing the nerdtree split now instead of going next to it. Any thoughts?

@kassio
Copy link
Contributor

kassio commented Nov 5, 2015

Sorry, but I don't contribute for this project anymore. I hope the new contributors can help you. 😄

@ches
Copy link
Collaborator

ches commented Nov 5, 2015

Are you able to reproduce consistently, and provide exact steps (key sequence, etc.) to do so?

@ches ches reopened this Nov 5, 2015
@olalonde
Copy link

3 years later, I am still scared every time I type :Ack

@QMonkey
Copy link

QMonkey commented Feb 29, 2016

@ches
It always happens after I switch window from NERDTree to Ack quickfix, and then press v to open one of the results in a vsplit window.

@QMonkey
Copy link

QMonkey commented Feb 29, 2016

displaces

@tczf1128
Copy link

tczf1128 commented May 8, 2016

same problem

@ches
Copy link
Collaborator

ches commented Jun 16, 2016

Aha! Well at last… I realized I couldn't reproduce because I use let NERDTreeWinPos = 'right' and that isn't affected 😇

Here's a workaround for now, set this in your vimrc:

" Split rightward so as not to displace a left NERDTree
let g:ack_mappings = {
      \  'v': '<C-W><CR><C-W>L<C-W>p<C-W>J<C-W>p',
      \ 'gv': '<C-W><CR><C-W>L<C-W>p<C-W>J' }

The plugin's defaults get merged with yours if you've set g:ack_mappings. I don't love the way this is done or the way we expose this mappings configuration, but that's a matter for another day. Also, you will probably start to notice #150, but one thing at a time…

ches added a commit that referenced this issue Jun 16, 2016
@ches ches removed the info needed label Jun 16, 2016
@jondkinney
Copy link
Author

jondkinney commented Jun 16, 2016

@ches Thanks for this. I think using v is working for me now (sort of...I have to press j or k after, probably because it's overriding visual select or something). However, I most frequently hit enter after searching which still replaces the NERDTree with the file it's pulling up from quickfix. I'll try to see if I can adapt your mappings to account for <cr>. But just wanted to mention that that is my use case and is still being problematic.

@ches
Copy link
Collaborator

ches commented Jun 16, 2016

I think using v is working for me now (sort of...I have to press j or k after, probably because it's overriding visual select or something)

Odd, I'm not seeing this.

However, I most frequently hit enter after searching which still replaces the NERDTree with the file it's pulling up from quickfix.

This one is just going to be a wontfix for the core plugin I'm afraid, after all NERDTree is just a window and introducing special cases for detecting it and who knows what else would become a total mess. Plain :vimgrep would be the same story, not a fault of ack.vim. Hopefully adding a mapping can work for you though, or training yourself not to start searches with NERDTree focused 😄

I should mention another possibility for anyone following: it sort of sucks to say "use another plugin", but I increasingly feel that something like QFEnter is the right way instead of ack.vim duplicating this functionality and having it not work in other quickfix windows or even when re-opening the same one. See my mini-rant on #170, you might try installing QFEnter, disabling ack.vim's quickfix mappings, and see if that works out better for you. You still might need some tweaking for the NERDTree-was-last-focused case though…

@jondkinney
Copy link
Author

jondkinney commented Jun 17, 2016

Ah, yes, I am already trained to not start searches with NERDTree focused. Learned that one a long time ago :) So here's what I actually want enter to do... leave my current tab alone, put the first result open in a new tab with the quickfix window below so I can ]q through them (with unimpaired). This mapping is a little slow...but definitely does exactly what I want! The third line is my addition to your existing suggestion. If you have any ways to improve this / speed it up I'm all ears! Thanks again for following up on this.

" Split rightward so as not to displace a left NERDTree
let g:ack_mappings = {
      \  'v':  '<C-W><CR><C-W>L<C-W>p<C-W>J<C-W>p',
      \ 'gv': '<C-W><CR><C-W>L<C-W>p<C-W>J',
      \ '<cr>': '<C-W><CR>:cclose<CR><C-W>T:copen<CR>' }

@ches
Copy link
Collaborator

ches commented Jun 17, 2016

Hmm, you might shorten the jumping around slightly with '<C-W><CR>:cclose<CR><C-W>T:copen<CR>'

But what I think I'd do in this case is just define a mapping to start the whole thing off in a new tab:

nnoremap <Leader>a :tabnew <Bar> Ack<Space>

" And/or abbreviation
abbr TAck tabnew <Bar> Ack

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

6 participants