summaryrefslogtreecommitdiff
path: root/conf.d
diff options
context:
space:
mode:
Diffstat (limited to 'conf.d')
-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'