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

Keyboard shortcuts don't work for me #197

Open
lzzluca opened this issue Nov 11, 2016 · 24 comments
Open

Keyboard shortcuts don't work for me #197

lzzluca opened this issue Nov 11, 2016 · 24 comments

Comments

@lzzluca
Copy link

lzzluca commented Nov 11, 2016

Hi!
For some reasons that I cannot understand, the keyboard shortcuts don't work at all for me, in the quicklist window.

I can press any key on the result list but nothing happen (no file gets opened).

I have no variable set up in my .vimrc: am I missing something?

Opening the plugin and checking the vars defined in there, doesn't feel like I am missing configurations, I can the default mappings defined as:

let s:ack_mappings = {
      \ "t": "<C-W><CR><C-W>T",
      \ "T": "<C-W><CR><C-W>TgT<C-W>j",
      \ "o": "<CR>",
      \ "O": "<CR><C-W>p<C-W>c",
      \ "go": "<CR><C-W>p",
      \ "h": "<C-W><CR><C-W>K",
      \ "H": "<C-W><CR><C-W>K<C-W>b",
      \ "v": "<C-W><CR><C-W>H<C-W>b<C-W>J<C-W>t",
      \ "gv": "<C-W><CR><C-W>H<C-W>b<C-W>J" }

if exists("g:ack_mappings")
  let g:ack_mappings = extend(s:ack_mappings, g:ack_mappings)
else
  let g:ack_mappings = s:ack_mappings
endif

(file .vim/bundle/ack.vim/plugin/ack.vim)

my .vimrc: https://github.com/lzzluca/vim/blob/master/.vimrc

Any idea will be appreciated!

Thank you

@ches
Copy link
Collaborator

ches commented Nov 12, 2016

Hi,

I'm not immediately sure why you're having trouble with the shortcuts, it's hard to surmise without minimizing your config like not loading other plugins to rule out conflicts.

But first, can you confirm:

  1. You're expecting that the shortcuts work after you run an :Ack search, not for any arbitrary quickfix list opened anytime (say, by :make).
  2. You're observing that the shortcuts don't work the first time you open the quickfix list when invoking ack.vim? Just skimming your vimrc, I see your QFtoggle function/mappings—if you use that, it's likely the shortcuts aren't going to work after closing and re-opening the quickfix window.

These are known shortcomings and you can find my advice on #170.

@lzzluca
Copy link
Author

lzzluca commented Nov 12, 2016

  1. I usually press Leader-a to start :Ack! (my Leader is comma)

  2. those are the steps I make to run a search:

  • I press Leader-a to get :Ack! in the command line
  • I type the string I want to search for and press Enter
  • then the quickfix window opens up and I have to click on it, to type on it
  • I can move up and down using j and k, on the list of result
  • when I am on the file that I want to open, I usually press t and nothing happens, the same for any other button in the list I pasted in my first message. Only pressing Enter , I can open files from the result list, and that keeps working even toggling the quickfix window (Enter is a recent discovery).

Is that the default behaviour?

Thanks for the help and for the interesting link.

@ches
Copy link
Collaborator

ches commented Nov 14, 2016

No, the default behavior with ack.vim loaded should be that the quickfix list is focused automatically after invoking the search, and the plugin's quickfix key bindings should be working as you expect in that window.

I don't use Vundle so it's a bit too much work for me to try to reproduce your exact setup, I would suggest disabling as many other plugins as possible to try to deduce where a problem is coming in. I don't believe I've heard of anyone having an issue with the bindings not working at all like in your case, I'm inclined to assume it isn't a bug in ack.vim.

If you do figure out the cause, let us know, maybe there is something we can do to avoid a conflict or find what is responsible in another plugin.

@lzzluca
Copy link
Author

lzzluca commented Nov 15, 2016

That sounds fair.

Thank you for the help so far, going to provide more info soon!

@robinfehr
Copy link

robinfehr commented Feb 17, 2017

any update on this? - just experiencing the same and looking for hints so that in don't have to check everything :)

@lzzluca
Copy link
Author

lzzluca commented Feb 17, 2017

@robinfehr sorry I have disappeared, have been much more busy than I planned!

I am happy to give it a look in the weekend and post here, I am glad to know I am not the only one experiencing the same behaviour.

@lzzluca
Copy link
Author

lzzluca commented Apr 19, 2017

I have just tried the plugin in a clean installation (only vim and the plugin, in the .vim/plugin/ack.vim folder): the shortcuts work as expected and finally I was able to see their use. :)

I am sorry it took me so long.

I also broke my configuration, so - trying to move the original .vimrc and .vim back - I wasn't able to make vim working as before the test (!!). Not sure how I did that.
Since when I post my first message, I think vim got an update, so I cannot be 100% sure that the vim update doesn't matter for the plugin to work in the clean installation (I don't think so though). What I can tell for sure is that the shortcuts work as expected in a clean installation.

I am going to fix my vim configuration and test more.

UPDATE: brought my configuration back to work and the plugin shortcuts are broken again :( So it is definitely something in my configuration.

@lzzluca
Copy link
Author

lzzluca commented Apr 19, 2017

For who has got the same problem: could you please paste a link to your .vimrc?
I would like to check if our .vimrc have got some suspicious line in common, before any further step.

This is mine.

Thank you.
Luca

@ches
Copy link
Collaborator

ches commented Apr 19, 2017

@lzzluca @danielgatis So I see jistr/vim-nerdtree-tabs and mhinz/vim-startify in common between the two of you—I'd be curious to know if disabling those one at a time reveals a culprit.

(Well, a few others too like airline and ctrlp, but I use those myself so I'm not too suspicious of them).

@lzzluca
Copy link
Author

lzzluca commented Apr 19, 2017

@ches Just removed every NERDTree plugin (both NERDTree and NERDTreeTabs) and the shortcuts magically do work!

@danielgatis can you please confirm is the same for you?

UPDATE: I was missing to list one plugin in this comment; posted the diff in the next comment, sorry for the confusion.

@lzzluca
Copy link
Author

lzzluca commented Apr 19, 2017

This is the output of git diff:

diff --git a/.vimrc b/.vimrc
index 78ed75c..63d0efe 100644
--- a/.vimrc
+++ b/.vimrc
@@ -302,13 +302,6 @@ Bundle 'gmarik/vundle'
 " handy screen at the vim startup
 Bundle 'mhinz/vim-startify'

-" file browser
-Bundle 'scrooloose/nerdtree'
-" makes NerdTree work with tabs
-Bundle 'jistr/vim-nerdtree-tabs'
-" NERDTree highlight + icon (by vim-devicons)
-Bundle 'tiagofumo/vim-nerdtree-syntax-highlight'
-
 " fancy bottom bar
 Bundle 'bling/vim-airline'

@vonpupp
Copy link

vonpupp commented May 9, 2017

I am having the same problem here. I have disabled NerdTree but it is still not working as expected. I also use Plug for installing the plugins. Herewith my vim dotfiles. And here is the ack config part.

Thanks.

@robinfehr
Copy link

removing vim-nerdtree-tabs worked for me.

@lzzluca
Copy link
Author

lzzluca commented May 10, 2017

@vonpupp can you post your .vimrc?

Would be nice to know what, inside vim-nerdtree-tabs is causing the problem. An easy guess would be a global var gets overridden, as a cause of the weird behaviour(?)

@vonpupp
Copy link

vonpupp commented May 10, 2017

Thank you @lzzluca. My config is not straight forward; I split it into different files. Please check the hyperlinks on my first comment and you will find my dotfiles. I don't use vim-nerdtree-tabs.

@RiderSargent
Copy link

I had this same issue, but removing let g:ack_use_dispatch = 1 fixed it. I removed all my plugins except Ack.vim and Dispatch.vim and reproduced the bug with g:ack_use_dispatch set to 1 and the keyboard shortcuts worked properly without using Dispatch. It also worked without Dispatch after re-enabling all my other plugins.

Can anyone corroborate that not using Dispatch worked for them? @lzzluca, @vonpupp, have you set g:ack_use_dispatch?

@lzzluca
Copy link
Author

lzzluca commented Jul 27, 2017

@RiderSargent can't find that variable in my .vimrc.

@sheinz
Copy link

sheinz commented Aug 16, 2017

I experienced similar issue but it was just my mistake.
Make sure you are calling Ack and not grep.

@RiderSargent
Copy link

@lzzluca, can you disable all your plugins other than Ack.vim and see if you still have the issue?

If not, I recommend re-enabling a few plugins at a time and see if you can't narrow down which is causing the issue.

If so, then it's not a conflict with another plugin, so maybe try a blank .vimrc and install Ack.vim on top of that. Basically, just try to narrow it down as to what is causing the conflict.

@lzzluca
Copy link
Author

lzzluca commented Aug 16, 2017

@RiderSargent For me, disabling vim-nerdtree-tabs fixed the problem already, as I wrote here:
#197 (comment)
I think that was not clear :) But thanks for the support!

@RiderSargent
Copy link

Not at all, glad it's sorted!

@thallada
Copy link

thallada commented Sep 18, 2017

So, mappings don't work if g:ack_use_dispatch is set to 1? Does anyone have a fix for that?

Edit: actually... with that option removed the mappings still don't work for me.

@thallada
Copy link

I had defined let g:ack_qhandler="copen 5" in my .vimrc. If I remove that, mappings work in the ack.vim quickfix window again.

Seems like there is a bug with the g:ack_qhandler option.

@LeResKP
Copy link

LeResKP commented Jan 15, 2018

@thallada: you need to add let g:ack_apply_qmappings = 1 in your conf

I don't know why but when you define g:ack_qhandler the mapping is not defined:
https://github.com/mileszs/ack.vim/blob/master/plugin/ack.vim#L21-L23

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

No branches or pull requests

8 participants