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

Option to use keys other than CTRL-A/CTRL-D for select/deselect with Ag? #54

Closed
chaoren opened this issue Dec 14, 2015 · 17 comments
Closed

Comments

@chaoren
Copy link

chaoren commented Dec 14, 2015

I use CTRL-D to exit prompts by habit.

@junegunn
Copy link
Owner

Yeah, in my case I was constantly annoyed by CTRL-A not moving my cursor to the front, which I do frequently to prepend ' to the query. The keys are not currently configurable, but I'm just going to change them to ALT-A and ALT-D.

@chaoren
Copy link
Author

chaoren commented Dec 14, 2015

Cool, thanks!

@rainerborene
Copy link

ALT-A and ALT-D generates áã characters respectively. Any ideas?

@chaoren
Copy link
Author

chaoren commented Dec 14, 2015

Do alt keys work in your terminal at all (e.g., ALT-C)? Check your
terminal settings, there should be a setting for sending meta keys.

@junegunn
Copy link
Owner

neovim/neovim#2440

It's a known issue of neovim and it doesn't look like it's going to be fixed soon-ish. Hmm, maybe I should make the keys configurable for nvim users.

@rainerborene
Copy link

Yes, that is a neovim issue indeed. Most options on fzf#vim functions are hardcoded, even for ag and fzf itself. How can we make those options configurable?

@junegunn
Copy link
Owner

Excerpt from README:

This repository is a bundle of fzf-based commands and mappings extracted from my .vimrc to address such needs. They are not designed to be flexible or configurable, and there's no guarantee of backward-compatibility.

:)

This repository simply provides too many features and trying to make every aspect of it configurable will inevitably make it a big mess. I currently encourage the users to fork it and bend it to their needs. But I do know that many users are not familiar with Vimscript, and I'll think about the options. (and that's the reason I left this issue open.)

@junegunn
Copy link
Owner

By the way, you can already override the default options as each function will append the extra options provided to the default set of options:

call fzf#vim#ag('query', {'options': '--bind ctrl-a:select-all,ctrl-d:deselect-all'})

@rainerborene
Copy link

I agree with you. But at least explain users how they should override current behavior i.e.

command! Search call fzf#vim#ag(<-qargs>, {
  \ 'ag_command': 'ag --hidden %s',
  \ 'fzf_command': 'fzf -m'
  \ })

Better defaults and more flexible overriding instead of a bunch of options.

@junegunn
Copy link
Owner

fzf#vim#ag in particular takes a variable number of arguments, and ag options can be also given as follows:

call fzf#vim#ag('query', '--hidden', {'options': '--bind ctrl-a:select-all,ctrl-d:deselect-all'})

Note that overriding some default options can break the feature as they may affect the sink implementation.

@rainerborene
Copy link

I see. Only problem of fzf#vim#ag function is that escapes the <q-args> by default. If there were an option to disable that it would solve issue #27

@rainerborene
Copy link

Nevermind. I'll use your :Grep command ;)

@wwwdata
Copy link

wwwdata commented Jul 26, 2016

If anybody else still has this problem and is using iTerm2 and neovim. You can also configure iTerm2 to send an escape sequence, then alt+a and alt+d will also work, see my screenshot! That's how I did it 😄

screen shot 2016-07-26 at 16 14 17

@junegunn junegunn mentioned this issue Dec 9, 2017
9 tasks
@junegunn junegunn closed this as completed Dec 9, 2017
@junegunn
Copy link
Owner

junegunn commented Dec 9, 2017

screen shot 2017-12-09 at 11 25 34 am

  • Esc+

@Abdullah-F
Copy link

screen shot 2017-12-09 at 11 25 34 am
  • Esc+

It is not working macOS 11.5, I opened the key settings in iterm2 profiles, then checked the two Esc+ buttons but still Alt-a does not select all when running Rg query

@Abdullah-F
Copy link

screen shot 2017-12-09 at 11 25 34 am
  • Esc+

It is not working macOS 11.5, I opened the key settings in iterm2 profiles, then checked the two Esc+ buttons but still Alt-a does not select all when running Rg query

let $FZF_DEFAULT_OPTS = '--bind ctrl-a:select-all,ctrl-d:deselect-all' doing this made it work with ctrl key binding, but the option key is not working.

wata00913 added a commit to wata00913/dotfiles that referenced this issue Jan 31, 2023
rgアクションに対応させる予定だったが、オプション指定が面倒のためagアクションに代替。
`select-all`のバインディングはg:fzf_actionで設定できないため注意。
実装方法は下記リンクを参考にした。
junegunn/fzf.vim#54 (comment)
@panosl
Copy link

panosl commented Aug 14, 2023

screen shot 2017-12-09 at 11 25 34 am
* `Esc+`

I enabled this and still opt+a don't seem to be working for :Rg select all. Has anyone found a workaround?

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

6 participants