summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTill Höppner2018-04-22 11:09:28 +0200
committerTill Höppner2018-04-22 11:09:28 +0200
commitbe97b387ffa73487055095ca8e0762705bb2ac37 (patch)
tree7435626e0bdd1121e92cfe4bc5c6d9e79256abea
parentbcabb86810b0dd123e5a0447cee389d7d24d376e (diff)
downloadzsh-be97b387ffa73487055095ca8e0762705bb2ac37.tar.gz
zsh-be97b387ffa73487055095ca8e0762705bb2ac37.tar.xz
zsh-be97b387ffa73487055095ca8e0762705bb2ac37.zip
Add fzf aliases
-rw-r--r--conf.d/99-fzf.zsh28
1 files changed, 28 insertions, 0 deletions
diff --git a/conf.d/99-fzf.zsh b/conf.d/99-fzf.zsh
new file mode 100644
index 0000000..5aaf3fa
--- /dev/null
+++ b/conf.d/99-fzf.zsh
@@ -0,0 +1,28 @@
+# cf - fuzzy cd from anywhere
+cf() {
+ local file
+
+ # previously had "grep -z -vE '~$'" in the pipeline
+ file="$(locate -Ai -0 \* | fzf --read0)"
+
+ if [[ -n $file ]]
+ then
+ if [[ -d $file ]]
+ then
+ cd -- $file
+ else
+ cd -- ${file:h}
+ fi
+ fi
+}
+
+rf() {
+ rg --no-heading --no-line-number --color never . | fzf
+}
+
+fh() {
+ print -z $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed 's/ *[0-9]* *//')
+}
+
+# bindkey -s '^f' 'cf\n'
+# bindkey -s '^h' 'fh\n'