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

[Feature Request] History syntax highlighting #3836

Open
5 of 10 tasks
l-deniau opened this issue Jun 3, 2024 · 4 comments · May be fixed by #3936
Open
5 of 10 tasks

[Feature Request] History syntax highlighting #3836

l-deniau opened this issue Jun 3, 2024 · 4 comments · May be fixed by #3936

Comments

@l-deniau
Copy link

l-deniau commented Jun 3, 2024

Checklist

  • I have read through the manual page (man fzf)
  • I have searched through the existing issues
  • 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

  • Linux
  • macOS
  • Windows
  • Etc.

Shell

  • bash
  • 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

@l-deniau
Copy link
Author

l-deniau commented Jun 4, 2024

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)

@junegunn
Copy link
Owner

junegunn commented Jun 5, 2024

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: sharkdp/bat#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?

@l-deniau
Copy link
Author

l-deniau commented Jun 6, 2024

Maybe you can load fzf --zsh first, then the other plugin so that the latter overrides CTRL-R binding 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 ?

@junegunn
Copy link
Owner

junegunn commented Jun 6, 2024

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.

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 a pull request may close this issue.

2 participants