item2+FZF + Oh My Zsh 历史命令搜索加强

2019-03-01  本文已影响0人  zhjwang

1.安装fzf

brew install fzf

2.安装插件

在~/.oh-my-zsh/plugins下面创建文件夹fzf, 在fzf创建文件fzf.plugin.zsh。
添加如下脚本:

# Exit if fzf is not installed
if ! builtin type fzf >/dev/null 2>&1; then
  return
fi

# Setup fzf
if [[ ! "$PATH" == */usr/local/opt/fzf/bin* ]]; then
  export PATH="$PATH:/usr/local/opt/fzf/bin"
fi

# Man path
if [[ ! "$MANPATH" == */usr/local/opt/fzf/man* && -d "/usr/local/opt/fzf/man" ]]; then
  export MANPATH="$MANPATH:/usr/local/opt/fzf/man"
fi

# Auto-completion
[[ $- == *i* ]] && source "/usr/local/opt/fzf/shell/completion.zsh" 2> /dev/null

# Key bindings
source "/usr/local/opt/fzf/shell/key-bindings.zsh"

3. 修改~/.zshrc

plugins=(fzf)

4.ctrl+r

image.png
上一篇下一篇

猜你喜欢

热点阅读