fzf.vim
fzf.vim copied to clipboard
Possible to change mappings while certain FZF buffers open?
Hey all, I really love the fzf plugin, it's totally changed the way I use vim and I love it.
I'm wondering if there's a way to make a remap for the fzf buffer for certain commands?
in my case, I want to make a keybinding, only for the :Files
command (and derivatives) to bind <space>
to /
so that space separating words will produce a proper filepath.
Currently, if I type "outer inner file name .py" - it won't find the file, but the file I wanted was outerdirectory/innerdirectory/files/name.py
I think mapping space to /
should solve, this, as space is never needed in filepaths, and it's so automatic to press ( I use it in every other command so hard to train myself out of)
I did see that we can set autocommands for the fzf
buffer type, but that will be for all fzf buffers; perhaps if there was a way to find out what was used to invoke the fzf command? I could also see the g:fzf_actions
but that also didn't seem to be quite what I was looking for.
- [x] I have fzf 0.23.0 or above
- [x] I have read through https://github.com/junegunn/fzf.vim/blob/master/README.md
- [x] I have read through https://github.com/junegunn/fzf/blob/master/README-VIM.md
- [x] I have read through the manual page of fzf (
man fzf
) - [x] I have searched through the existing issues
Maybe you can use iabbrev
inside of :Files
command, but I'm not sure if it works or not. iabbrev
usually used for typo, for example:
iabbrev <buffer> teh the
will change the word (exactly) teh
to the
, I'm not sure if it will change the <space>
tho but you can exploring that I guess.
Do you really need to add <space>
when you type the keyword? I mean, rather than typing outer inner file name .py
you can type outerinnerfilename
and see if the file you want appear or not. Yeah it's less readable but as long as you find the file, I think it's enough.
The default :Files
command in case you want to do some experiment:
https://github.com/junegunn/fzf.vim/blob/a552e44810ba6f2809f977bd0c5b3a610b81d523/plugin/fzf.vim#L48