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

Custom keymaps #113

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

skalidindi3
Copy link

It would be nice to be able to use the same keymaps from ctrlp's fuzzy file search with ag.vim.

The current functionality is kept as the default.

The helper `ag#AgSetDefaultMappings` takes one argument, `matches_window_prefix`,
which is determined by whether the matches window is a location list or quickfix
window. Custom keymaps can now be given by setting the `g:ag_lmapping_func` and
`g:ag_qmapping_func` options.
The option `g:ag_mapping_message_text` can now be used to display
a custom message when the location list / quickfix window opens.


*g:ag_qmapping_func*
A custom command used to set key mappings for the quickfix window. Default:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just use a map, like ctrlp does?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not against doing that, but wouldn't that require two keymaps? One for quickfix window mode and one for location list mode? The current implementation allows for a function that can take arguments and avoid duplicate code.

Again, I'm not against switching over to something like that, since ack.vim seems to do a similar thing. I'm actually interested in the logistics.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could have three optional sections. Global mappings, location list
mappings, and quickfix mappings. The most specific mappings would take
precedence, falling back to default values if we didn't find a specific
mapping or group of mappings.
On Oct 14, 2015 19:27, "Sai Kalidindi" [email protected] wrote:

In doc/ag.txt
#113 (comment):

@@ -138,16 +138,36 @@ window is opened, or what size it is. Example: >
let g:ag_qhandler="copen 20"
<

  •                                                       _g:ag_lmapping_func_
    
    +A custom command used to set key mappings for the location list. Default:
    +"call ag#AgSetDefaultMappings('l')". Example: >
  • let g:ag_qhandler="call AgSetMyCustomMappings()"
    +<
  •                                                       _g:ag_qmapping_func_
    
    +A custom command used to set key mappings for the quickfix window. Default:

I'm not against doing that, but wouldn't that require two keymaps? One for
quickfix window mode and one for location list mode? The current
implementation allows for a function that can take arguments and avoid
duplicate code.

Again, I'm not against switching over to something like that, since
ack.vim seems to do a similar thing. I'm actually interested in the
logistics.


Reply to this email directly or view it on GitHub
https://github.com/rking/ag.vim/pull/113/files#r42071618.

@hasufell
Copy link

5 years later, still can't define key bindings

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

Successfully merging this pull request may close these issues.

3 participants