[Feature Request] History syntax highlighting
Checklist
- [X] I have read through the manual page (
man fzf) - [X] I have searched through the existing issues
- [X] For bug reports, I have checked if the bug is reproducible in the latest version of fzf
Output of fzf --version
0.52.1 (6432f00)
OS
- [X] Linux
- [ ] macOS
- [ ] Windows
- [ ] Etc.
Shell
- [ ] bash
- [X] zsh
- [ ] fish
Problem / Steps to reproduce
I just started to use fzf and i love it. But i've got one problem about the history backsearch with key bidings. I was using https://github.com/zdharma-continuum/history-search-multi-word to have a similar features of fuzzy search with Ctrl-R and it has syntax highlighting wich make it visualy more attractive. So i was wondering if it would be possible to get syntax highlighting like zdharma-continuum/history-search-multi-word for history backsearch with fzf ? Or add an option to disable only the Ctrl-R key biding so i'm able to use fzf with Ctrl-T and Alt-C and zdharma-continuum/history-search-multi-word with Ctrl-R
For now i built fzf myself with a modification in key-bindings.zsh like this :
if [[ "${FZF_CTRL_R_COMMAND-x}" != "" ]]; then
zle -N fzf-history-widget
bindkey -M emacs '^R' fzf-history-widget
bindkey -M vicmd '^R' fzf-history-widget
bindkey -M viins '^R' fzf-history-widget
fi
and sourcing fzf like this in my zshrc
FZF_CTRL_R_COMMAND= source <(fzf --zsh)
if it would be possible to get syntax highlighting like zdharma-continuum/history-search-multi-word for history backsearch with fzf ?
I'm not sure. We would have to use bat for syntax highlighting, but our recent change to support multi-line display will probably make it difficult to incorporate that into our script.
Related: https://github.com/sharkdp/bat/issues/2974
Or add an option to disable only the Ctrl-R key biding
Maybe you can load fzf --zsh first, then the other plugin so that the latter overrides CTRL-R binding of fzf?
Maybe you can load
fzf --zshfirst, then the other plugin so that the latter overridesCTRL-Rbinding of fzf?
Yes, it works. But I don't find it very convenient.
Is there a specific reason that CTRL-R is the only binding where the command can't be overridden, like CTRL-T and ALT-C ?
Yes, it works. But I don't find it very convenient.
Thanks for the confirmation, so we do have a workaround.
Is there a specific reason that CTRL-R is the only binding where the command can't be overridden
Mainly because no one has asked for it. Opting out of the other keys was a recent addition (see #3678); we didn't include CTRL-R in the patch because there is no FZF_CTRL_R_COMMAND.