From 7a421da536c1472ef508447b47092a7c5553e374 Mon Sep 17 00:00:00 2001 From: "flyingscorpio@clevo" Date: Sun, 3 Jul 2022 22:55:43 +0200 Subject: [PATCH] Make fcd alias for fuzzy cd --- roles/shell/files/shell_aliases.ansible | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/roles/shell/files/shell_aliases.ansible b/roles/shell/files/shell_aliases.ansible index 74928df..4bb2669 100644 --- a/roles/shell/files/shell_aliases.ansible +++ b/roles/shell/files/shell_aliases.ansible @@ -42,7 +42,15 @@ if [ -x /usr/bin/nvim ]; then alias vim='nvim' fi -# fuzzy open a file +# fuzzy cd +fcd() { + if [ -x /usr/bin/fzf ]; then + local target + target=$(fzf) + cd "${target%/*}" || return + fi +} +# fuzzy vim if [ -x /usr/bin/fzf ]; then alias fvim='vim $(fzf)' fi