Last active
November 12, 2015 18:03
-
-
Save chanux/9411092 to your computer and use it in GitHub Desktop.
Fish shell port of za
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function za | |
## Fish shell port of za https://gist.github.com/chanux/1119556 | |
## What The Fish? : http://wp.me/p1rVu-bO | |
## | |
## To use za as a Fish function, just copy paste the script and enter | |
## Then run func_save za | |
## Now you can use za on your Fish <">< | |
if [ -z $argv[1] ] | |
set za_mark 1 | |
else | |
set za_mark $argv[1] | |
end | |
set za_dir $PWD | |
# When in home, do nothing | |
[ $za_dir = $HOME ]; and return | |
while [ $za_mark -gt 0 -a $za_dir != $HOME ] | |
set za_dir (dirname $za_dir) | |
set za_mark (math $za_mark - 1) | |
end | |
cd $za_dir | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment