Hello,
is there way how to print output of reversed searched command in stodut and save it into clipboard (use _xclip_) when I type CTRL+Y key?
I imagine that this option will be saved in FZF_CTRL_R_OPTS variable.
Thx for your answer!
Here is my FZF_CTRL_R_OPTS
export FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview' --bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort' --header 'Press CTRL-Y to copy command into clipboard' --border"
CTRL-Y to copy the command to clipboard using pbcopy and exit (abort)? key to open preview window on the bottom to see long commands that don't fit in one line--border for cosmetic reasonsI was looking for this same functionality, lucky to find it here!
I enabled it in bash as:
export FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview' --bind 'ctrl-y:execute-silent(echo -n {2..} | xclip -selection clipboard; sleep 0.35s)+abort' --header 'Press CTRL-Y to copy command into clipboard'"
NOTE however I had this weird issue where I need to sleep after the xclip pipe, or otherwise the clipboard is not populated due to the abort :/
I tried different times, and anything below 0.35s fails (e.g. with sleep 0.3s it doesn't work). Which is quite a delay and a tiny bit annoying, but that's a workaround for now...
Any ideas on this?
Most helpful comment
Here is my FZF_CTRL_R_OPTS
CTRL-Yto copy the command to clipboard usingpbcopyand exit (abort)?key to open preview window on the bottom to see long commands that don't fit in one line--borderfor cosmetic reasons