From 91cc7ea6e1690feebc154f7d47c5c582d1a7a451 Mon Sep 17 00:00:00 2001 From: punkfairie <23287005+punkfairie@users.noreply.github.com> Date: Sun, 14 Apr 2024 20:14:07 -0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(fish):=20cd=20up=20on=20sterio?= =?UTF-8?q?ds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dot_config/fish/conf.d/20-aliases.fish | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dot_config/fish/conf.d/20-aliases.fish b/dot_config/fish/conf.d/20-aliases.fish index 198e6d6..00ea263 100644 --- a/dot_config/fish/conf.d/20-aliases.fish +++ b/dot_config/fish/conf.d/20-aliases.fish @@ -8,6 +8,23 @@ abbr -a c --position command clear abbr -a e --position command "$EDITOR" abbr -a v --position command "$EDITOR" +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# CD up on steriods. +function _cd_up_func --argument-names dots + set -f dots (string sub --start 3 "$dots") + set -f cmd "cd .." + + while string length -q "$dots" + set cmd "$cmd/.." + set dots (string sub --start 2 "$dots") + end + + echo "$cmd" +end + +abbr -a _cd_up --position command --regex "\.{2,}" --function _cd_up_func + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Default command options.