commit e1c4bf17c12efcaad863480c7e77a4d80d512435
parent 0a58798242fad6e9a65d29fc8fe3221d25a7ef28
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Tue, 23 Apr 2019 16:22:05 +0200
fzf config
Former-commit-id: 07a6745f81b991fbc80f437a9281911df50ef304
Diffstat:
3 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/shell/bash_profile b/shell/bash_profile
@@ -2,3 +2,4 @@
source "$HOME/.commonprofile"
PATH=$PATH:/opt/metasploit-framework/bin
export PATH=$PATH:/opt/metasploit-framework/bin
+[ -f ~/.fzf.bash ] && source ~/.fzf.bash
diff --git a/shell/commonprofile b/shell/commonprofile
@@ -284,6 +284,7 @@ unlink() {
unset p
done
}
+
# }}}
# Applescript functions {{{
@@ -309,3 +310,18 @@ if command -v osascript &> /dev/null; then
fi
# }}}
+# fzf functions {{{
+if [ -f ~/.fzf.zsh ] || [ -f ~/.fzf.bash ]; then
+ # fuzzy history search
+ fh() {
+ eval $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed 's/ *[0-9]* *//')
+ }
+ # fd - cd to selected directory
+ fd() {
+ local dir
+ dir=$(find ${1:-.} -path '*/\.*' -prune \
+ -o -type d -print 2> /dev/null | fzf +m) &&
+ cd "$dir"
+ }
+fi
+# }}}
diff --git a/shell/zshrc b/shell/zshrc
@@ -123,3 +123,5 @@ if ! command -v jenv &> /dev/null; then
eval "$(jenv init -)"
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home"
fi
+
+[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh