Bind to send CTRL_T result without confirming? #3780
Replies: 1 comment 2 replies
-
Assuming you are using One solution could be to modify the Lines 68 to 73 in bcda25a # .zshrc
eval "$(fzf --zsh)"
modified-fzf-file-widget() {
local temporary_file="/tmp/file_ctrl_t_state"
LBUFFER="${LBUFFER}$(__fzf_select)"
if [[ -s $temporary_file ]]; then
zle accept-line
: > $temporary_file # clear the file
fi
local ret=$?
zle reset-prompt
return $ret
}
zle -N modified-fzf-file-widget
bindkey '^T' modified-fzf-file-widget EDIT: Added the missing
The key combination ⇧ Shift + ⏎ Enter is not supported. man fzf | less --pattern "AVAILABLE KEYS" Let's try using ⌃ Control + Space for the demo. # .zshrc
export FZF_CTRL_T_OPTS="--bind 'ctrl-space:execute-silent(echo 1 >/tmp/file_ctrl_t_state)+accept'" Pressing ⏎ Enter will place the file path in the command line buffer as usual, and ⌃ Control + Space will execute the entire command. Unsatisfied with the solution, the maintainer used the |
Beta Was this translation helpful? Give feedback.
-
Currently pressing enter on a result on ctrl+t puts the path into the terminal and you have to press enter again to send the command.
This is reasonable because you could be selecting multiple paths.
But in cases where you're not, is there a keybind (or a way to set one) to just send it straight up? The same way alt+c does.
To be clear I'm not looking to replace the behavior, but to enhance it. The bind could be something like shift+enter.
Beta Was this translation helpful? Give feedback.
All reactions