浏览代码

[zsh] Add fzf to zsh

Colin Powell 1 年之前
父节点
当前提交
79796f0652
共有 2 个文件被更改,包括 19 次插入1 次删除
  1. 16 0
      zsh/.fzf.zsh
  2. 3 1
      zsh/.zshrc

+ 16 - 0
zsh/.fzf.zsh

@@ -0,0 +1,16 @@
+#!/usr/bin/env zsh
+
+
+# Setup fzf
+# ---------
+if [[ ! "$PATH" == */opt/homebrew/opt/fzf/bin* ]]; then
+  PATH="${PATH:+${PATH}:}/opt/homebrew/opt/fzf/bin"
+fi
+
+# Auto-completion
+# ---------------
+source "/opt/homebrew/opt/fzf/shell/completion.zsh"
+
+# Key bindings
+# ------------
+source "/opt/homebrew/opt/fzf/shell/key-bindings.zsh"

+ 3 - 1
zsh/.zshrc

@@ -5,7 +5,7 @@ export ZSH="$HOME/.oh-my-zsh"
 
 ZSH_THEME="robbyrussell"
 
-plugins=(git z asdf direnv emacs yarn)
+plugins=(git z fzf asdf direnv emacs yarn)
 
 source $ZSH/oh-my-zsh.sh
 
@@ -13,3 +13,5 @@ source $ZSH/oh-my-zsh.sh
 # Example aliases
 alias dj="poetry run python manage.py $argv"
 alias sysu="systemctl --user $argv"
+
+[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh