mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
fixes for ubuntu
This commit is contained in:
parent
f5c39308eb
commit
220a8da7aa
17
autojump.bash
Normal file
17
autojump.bash
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#This shell snippet sets the prompt command and the necessary aliases
|
||||||
|
#Only excecute if the shell is bash and it is interactive
|
||||||
|
if [ $SHELL = "/bin/bash" ] && [ -n "$PS1" ]; then
|
||||||
|
_autojump()
|
||||||
|
{
|
||||||
|
local cur
|
||||||
|
COMPREPLY=()
|
||||||
|
unset COMP_WORDS[0] #remove "j" from the array
|
||||||
|
cur=${COMP_WORDS[*]}
|
||||||
|
IFS=$'\n' read -d '' -a COMPREPLY < <(autojump --completion "$cur")
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
complete -F _autojump j
|
||||||
|
export PROMPT_COMMAND='autojump -a "$(pwd -P)"'
|
||||||
|
alias jumpstat="autojump --stat"
|
||||||
|
function j { new_path="$(autojump $@)";if [ -n "$new_path" ]; then echo -e "\\033[31m${new_path}\\033[0m"; echo; cd "$new_path";fi }
|
||||||
|
fi
|
18
autojump.sh
18
autojump.sh
@ -1,17 +1,5 @@
|
|||||||
#This shell snippet sets the prompt command and the necessary aliases
|
#Source autojump.bashrc only if we're on bash, as it is
|
||||||
#Only excecute if the shell is bash and it is interactive
|
#not compatible with other shells
|
||||||
if [ $SHELL = "/bin/bash" ] && [ -n "$PS1" ]; then
|
if [ $SHELL = "/bin/bash" ] && [ -n "$PS1" ]; then
|
||||||
_autojump()
|
source /etc/profile.d/autojump.bash
|
||||||
{
|
|
||||||
local cur
|
|
||||||
COMPREPLY=()
|
|
||||||
unset COMP_WORDS[0] #remove "j" from the array
|
|
||||||
cur=${COMP_WORDS[*]}
|
|
||||||
IFS=$'\n' read -d '' -a COMPREPLY < <(autojump --completion "$cur")
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
complete -F _autojump j
|
|
||||||
export PROMPT_COMMAND='autojump -a "$(pwd -P)"'
|
|
||||||
alias jumpstat="autojump --stat"
|
|
||||||
function j { new_path="$(autojump $@)";if [ -n "$new_path" ]; then echo -e "\\033[31m${new_path}\\033[0m"; echo; cd "$new_path";fi }
|
|
||||||
fi
|
fi
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
sudo cp autojump /usr/bin/
|
sudo cp autojump /usr/bin/
|
||||||
sudo cp autojump.1 /usr/share/man/man1/
|
sudo cp autojump.1 /usr/share/man/man1/
|
||||||
if [ -d "/etc/profile.d" ]; then
|
if [ -d "/etc/profile.d" ]; then
|
||||||
|
sudo cp autojump.bash /etc/profile.d/
|
||||||
sudo cp autojump.sh /etc/profile.d/
|
sudo cp autojump.sh /etc/profile.d/
|
||||||
echo "Remember to add the line"
|
echo "Remember to add the line"
|
||||||
echo " source /etc/profile"
|
echo " source /etc/profile"
|
||||||
@ -13,7 +14,7 @@ else
|
|||||||
if [ $ans = "y" -o $ans = "Y" -o $ans = "yes" -o $ans = "Yes" ]; then
|
if [ $ans = "y" -o $ans = "Y" -o $ans = "yes" -o $ans = "Yes" ]; then
|
||||||
echo "" >> ~/.bashrc
|
echo "" >> ~/.bashrc
|
||||||
echo "#autojump" >> ~/.bashrc
|
echo "#autojump" >> ~/.bashrc
|
||||||
cat autojump.sh >> ~/.bashrc
|
cat autojump.bash >> ~/.bashrc
|
||||||
else
|
else
|
||||||
echo "Then you need to put autojump.sh, or the code from it, somewhere where it will get read. Good luck!"
|
echo "Then you need to put autojump.sh, or the code from it, somewhere where it will get read. Good luck!"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user