rking / ag.vim

Vim plugin for the_silver_searcher, 'ag', a replacement for the Perl module / CLI script 'ack'
1.74k stars 131 forks source link

Mappings for quickfix shortcuts #131

Closed hahnzilla closed 3 years ago

hahnzilla commented 8 years ago

To qualify this entire issue, I'm trying to map to q, but only when this plugin's quickfix window is open. Some vim plugins have the mapping built in let g:ctrlp_map = '<c-p>'. This might be because I'm new to vim plugin diving, but I couldn't find a way to do that.

Here is the alternative I came up with (most likely because I read it somewhere):

autocmd BufReadPost quickfix map <esc> q
autocmd BufReadPost quickfix map <c-v> v
autocmd BufReadPost quickfix map <c-s> h

The issue with this is it applies these maps to my other buffers as well (not just locally to the quickfix window).

Is there some built in way for me to map these keys?

losingkeys commented 8 years ago

You might be able to do something sneaky with g:ag_qhandler or g:ag_lhandler, but this would be better as a separate option. There's nothing special about our use of the quickfix buffer, so I don't think you can tell when it was launched by :Ag vs by something else. However I think we can add buffer local mappings as a part of the :Ag command, so we should be able to get this into an option.

hahnzilla commented 8 years ago

I'd love to be able to help out with this, if it's something I can do. I have absolutely no experience in making vim plugins.

Do you have a summary about how to contribute to this project?

losingkeys commented 8 years ago

@dhahn we don't have a CONTRIBUTING file yet, but I've added an issue for it: https://github.com/rking/ag.vim/issues/140.

I'm using vim-plug as my plugin manager, which means I've just replaced this line:

Plug 'rking/ag.vim'

With this line:

Plug '/home/josh/projects/ag.vim' 

To do local development. Then I just restart vim when I make changes to the plugin.