Ver a proveniência

Merge commit 'simon/master'

pull/18/head
elcerdo há 15 anos
ascendente
cometimento
dc4c63c9ea
6 ficheiros alterados com 69 adições e 7 eliminações
  1. +8
    -3
      README.rst
  2. +11
    -0
      _j
  3. +3
    -2
      autojump
  4. +3
    -2
      autojump.sh
  5. +7
    -0
      autojump.zsh
  6. +37
    -0
      install.zsh

+ 8
- 3
README.rst Ver ficheiro

@ -62,20 +62,25 @@ run::
./install.sh
or::
./install.zsh
depending on your shell.
Enter your root password if it asks.
Add the line::
source /etc/profile
to ``~/.bashrc`` if it isn't already there.
to ``~/.bashrc`` or ``~/.zshrc`` if it isn't already there.
Troubleshoot
------------
If the script fails, you may need to do::
chmod +x install.sh
chmod +x install.(z)sh
before the first step.
@ -86,7 +91,7 @@ Manual installation of autojump is very simple: copy
- autojump.sh to /etc/profile.d,
- autojump.1 to /usr/share/man/man1.
Make sure to source ``/etc/profile`` in your ``.bashrc``::
Make sure to source ``/etc/profile`` in your ``.bashrc`` or ``.zshrc`` ::
source /etc/profile

+ 11
- 0
_j Ver ficheiro

@ -0,0 +1,11 @@
#compdef j
cur=${words[2, -1]}
ret=$(autojump --completion "${cur[*]}")
if [ "$ret" != "" ]; then # if at least one answer
for i in $(echo "$ret"); do
compadd -U $i # add all of them as possible completion
done
fi

+ 3
- 2
autojump Ver ficheiro

@ -75,8 +75,9 @@ except IOError:
path_dict={}
if ('-a','') in optlist:
dicadd(path_dict,args[-1])
save(path_dict,dic_file)
if(args[-1] != os.path.expanduser("~")): # home dir can be reached quickly by "cd" and may interfere with other directory
dicadd(path_dict,args[-1])
save(path_dict,dic_file)
elif ('--stat','') in optlist:
a=path_dict.items()
a.sort(key=lambda e:e[1])

+ 3
- 2
autojump.sh Ver ficheiro

@ -1,5 +1,6 @@
#Source autojump.bashrc only if we're on bash, as it is
#not compatible with other shells
# Source autojump on BASH or ZSH depending on the shell
if [ "$BASH_VERSION" ] && [ -n "$PS1" ] && echo $SHELLOPTS | grep -v posix >>/dev/null; then
. /etc/profile.d/autojump.bash
elif [ "$ZSH_VERSION" ] && [ -n "$PS1" ]; then
. /etc/profile.d/autojump.zsh
fi

+ 7
- 0
autojump.zsh Ver ficheiro

@ -0,0 +1,7 @@
function preexec() {
(autojump -a "$(pwd -P)"&)>/dev/null
}
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 }

+ 37
- 0
install.zsh Ver ficheiro

@ -0,0 +1,37 @@
#! /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/
sudo cp autojump.sh /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

Carregando…
Cancelar
Guardar