在 Mac 上将 fzf 与 tmux 和 zsh 结合使用

Using fzf with tmux and zsh on Mac

我用的时候很喜欢fzf,但是实际用起来很难。例如,我不想每次要模糊查找文件时都必须键入 vim $(fzf)。理想情况下,我希望能够只键入 ctrl-E 以输入 fzf 并在按回车键选择文件后开始编辑文件。

我不知道要按什么键来完成 github 页面 (https://github.com/junegunn/fzf) 视频中的操作。按 T​​ab 键只是正常的自动完成(我不想做 ** 样式的自动完成。我想输入 fzf-tmux 并将结果粘贴到我的命令中)

谁能帮帮我?

install script of fzf will setup such key bindings for you, CTRL-T, CTRL-R, and ALT-C. Refer to the the project home page for the details. The code for the key bindings can be found here.

如果您不喜欢 fzf 提供的默认设置,您可以尝试自己编写。

# A simple widget for dictionary words
fzf-dict-widget() {
  LBUFFER="$LBUFFER$(cat /usr/share/dict/words | fzf-tmux -m | paste -sd" " -) "
  zle reset-prompt
}
bindkey '^E' fzf-dict-widget
zle     -N   fzf-dict-widget