From 3bfaaa4f11ad429cfd03f6488dbc701124d825c8 Mon Sep 17 00:00:00 2001 From: Simon Marache-Francisco Date: Sun, 29 Mar 2009 22:47:15 +0200 Subject: [PATCH] First working version of autoJ for zsh --- autojump.zsh | 3 +++ install.zsh | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100755 autojump.zsh create mode 100755 install.zsh diff --git a/autojump.zsh b/autojump.zsh new file mode 100755 index 0000000..c686535 --- /dev/null +++ b/autojump.zsh @@ -0,0 +1,3 @@ +alias jumpstat="autojump --stat" + +function j { new_path="$(autojump $@)";if [ -n "$new_path" ]; then echo -e "\\033[31m${new_path}\\033[0m"; cd "$new_path";fi } diff --git a/install.zsh b/install.zsh new file mode 100755 index 0000000..7a412cc --- /dev/null +++ b/install.zsh @@ -0,0 +1,36 @@ +#! /bin/zsh +# applet icon +sudo mkdir -p /usr/share/autojump/ +sudo cp icon.png /usr/share/autojump/ + +# scripts +sudo cp jumpapplet /usr/bin/ +sudo cp autojump /usr/bin/ + +# man pages +sudo cp autojump.1 /usr/share/man/man1/ + +# autocompletion file in the first directory of the FPATH variable +cp _j $(echo $FPATH | cut -d":" -f 1) + + +if [ -d "/etc/profile.d" ]; then + sudo cp autojump.zsh /etc/profile.d/ + echo "Remember to add the line" + echo " source /etc/profile" + echo "to your ~/.zshrc if it's not there already" +else + echo "Your distribution does not have a /etc/profile.d directory, the default that we install one of the scripts to. Would you like us to copy it into your ~/.zshrc file to make it work? (If you have done this once before, delete the old version before doing it again.) [y/n]" + read ans + if [ ${#ans} -gt 0 ]; then + if [ $ans = "y" -o $ans = "Y" -o $ans = "yes" -o $ans = "Yes" ]; then + echo "" >> ~/.zshrc + echo "#autojump" >> ~/.zshrc + cat autojump.zsh >> ~/.zshrc + else + echo "Then you need to put autojump.zsh, or the code from it, somewhere where it will get read. Good luck!" + fi + else + echo "Then you need to put autojump.zsh, or the code from it, somewhere where it will get read. Good luck!" + fi +fi