mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
Merge pull request #103 from wting/bash_install_path
Fix bash local install
This commit is contained in:
commit
8fb8e8001f
54
README.rst
54
README.rst
@ -79,42 +79,24 @@ Installation
|
|||||||
Auto Installation
|
Auto Installation
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
run::
|
run::
|
||||||
|
|
||||||
./install.sh
|
./install.sh [ --local ] [ --zsh ]
|
||||||
|
|
||||||
or::
|
and follow on screen instructions.
|
||||||
|
|
||||||
./install.zsh
|
|
||||||
|
|
||||||
depending on your shell.
|
Use --local to install into current user's home directory.
|
||||||
Enter your root password if it asks.
|
|
||||||
|
|
||||||
Add the line::
|
Use --zsh to install for Z shell.
|
||||||
|
|
||||||
source /etc/profile
|
|
||||||
|
|
||||||
to ``~/.bashrc`` or ``~/.zshrc`` if it isn't already there.
|
|
||||||
|
|
||||||
Troubleshoot
|
Troubleshoot
|
||||||
------------
|
------------
|
||||||
|
|
||||||
If the script fails, you may need to do::
|
If the script fails, you may need to do::
|
||||||
|
|
||||||
chmod +x install.(z)sh
|
chmod +x install.sh
|
||||||
|
|
||||||
before the first step.
|
before the first step.
|
||||||
|
|
||||||
|
|
||||||
Manual installation of autojump is very simple: copy
|
|
||||||
|
|
||||||
- autojump to /usr/bin,
|
|
||||||
- autojump.sh to /etc/profile.d,
|
|
||||||
- autojump.1 to /usr/share/man/man1.
|
|
||||||
|
|
||||||
Make sure to source ``/etc/profile`` in your ``.bashrc`` or ``.zshrc`` ::
|
|
||||||
|
|
||||||
source /etc/profile
|
|
||||||
|
|
||||||
Packaging
|
Packaging
|
||||||
=========
|
=========
|
||||||
@ -126,7 +108,7 @@ For now gcarrier and I have packaged autojump for Arch Linux. It is available in
|
|||||||
Autojump is now officially a part of Debian Sid, thanks to Tanguy Ortolo’s work (for policy reasons, it requires manual activation after installing, see /usr/share/doc/autojump/README.Debian). To install, type::
|
Autojump is now officially a part of Debian Sid, thanks to Tanguy Ortolo’s work (for policy reasons, it requires manual activation after installing, see /usr/share/doc/autojump/README.Debian). To install, type::
|
||||||
|
|
||||||
apt-get install autojump
|
apt-get install autojump
|
||||||
|
|
||||||
Autojump is also available on the OSX Homebrew package manager::
|
Autojump is also available on the OSX Homebrew package manager::
|
||||||
|
|
||||||
brew install autojump
|
brew install autojump
|
||||||
@ -136,24 +118,10 @@ Autojump is also packaged for a number of other distros. Check the wiki for an u
|
|||||||
Uninstallation
|
Uninstallation
|
||||||
==============
|
==============
|
||||||
|
|
||||||
To completely remove autojump you should remove these files:
|
run::
|
||||||
|
|
||||||
``/etc/profile.d/autojump.bash``
|
./uninstall.sh
|
||||||
|
|
||||||
``/etc/profile.d/autojump.sh``
|
and follow on screen instructions.
|
||||||
|
|
||||||
``/etc/profile.d/autojump.zsh``
|
|
||||||
|
|
||||||
``/usr/bin/autojump``
|
|
||||||
|
|
||||||
``/usr/bin/jumpapplet``
|
|
||||||
|
|
||||||
``/usr/share/autojump/icon.png``
|
|
||||||
|
|
||||||
``/usr/share/autojump/``
|
|
||||||
|
|
||||||
``/usr/share/man/man1/autojump.1``
|
|
||||||
|
|
||||||
Remove any mention of autojump in your ``.bashrc`` or ``.zshrc``, then in currently running shells do:``source /etc/profile``.
|
|
||||||
|
|
||||||
If you keep getting ``autojump: command not found`` at the Bash prompt, do:``unset PROMPT_COMMAND``. You can also restart your shell.
|
If you keep getting ``autojump: command not found`` at the Bash prompt, do:``unset PROMPT_COMMAND``. You can also restart your shell.
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#along with autojump. If not, see <http://www.gnu.org/licenses/>.
|
#along with autojump. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#This shell snippet sets the prompt command and the necessary aliases
|
#This shell snippet sets the prompt command and the necessary aliases
|
||||||
_autojump()
|
_autojump()
|
||||||
{
|
{
|
||||||
local cur
|
local cur
|
||||||
cur=${COMP_WORDS[*]:1}
|
cur=${COMP_WORDS[*]:1}
|
||||||
@ -29,10 +29,9 @@ EOF
|
|||||||
}
|
}
|
||||||
complete -F _autojump j
|
complete -F _autojump j
|
||||||
|
|
||||||
_autojump_files()
|
_autojump_files()
|
||||||
{
|
{
|
||||||
if [[ ${COMP_WORDS[COMP_CWORD]} == *__* ]]
|
if [[ ${COMP_WORDS[COMP_CWORD]} == *__* ]]; then
|
||||||
then
|
|
||||||
local cur
|
local cur
|
||||||
#cur=${COMP_WORDS[*]:1}
|
#cur=${COMP_WORDS[*]:1}
|
||||||
cur=${COMP_WORDS[COMP_CWORD]}
|
cur=${COMP_WORDS[COMP_CWORD]}
|
||||||
@ -48,21 +47,24 @@ EOF
|
|||||||
complete -o default -o bashdefault -F _autojump_files cp mv meld diff kdiff3
|
complete -o default -o bashdefault -F _autojump_files cp mv meld diff kdiff3
|
||||||
|
|
||||||
#determine the data directory according to the XDG Base Directory Specification
|
#determine the data directory according to the XDG Base Directory Specification
|
||||||
if [ -n "$XDG_DATA_HOME" ]
|
if [ -n "$XDG_DATA_HOME" ]; then
|
||||||
then
|
|
||||||
export AUTOJUMP_DATA_DIR="$XDG_DATA_HOME/autojump"
|
export AUTOJUMP_DATA_DIR="$XDG_DATA_HOME/autojump"
|
||||||
else
|
else
|
||||||
export AUTOJUMP_DATA_DIR=~/.local/share/autojump
|
export AUTOJUMP_DATA_DIR=~/.local/share/autojump
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e "${AUTOJUMP_DATA_DIR}" ]
|
if [ ! -e "${AUTOJUMP_DATA_DIR}" ]; then
|
||||||
then
|
|
||||||
mkdir -p "${AUTOJUMP_DATA_DIR}"
|
mkdir -p "${AUTOJUMP_DATA_DIR}"
|
||||||
mv ~/.autojump_py "${AUTOJUMP_DATA_DIR}/autojump_py" 2>>/dev/null #migration
|
mv ~/.autojump_py "${AUTOJUMP_DATA_DIR}/autojump_py" 2>>/dev/null #migration
|
||||||
mv ~/.autojump_py.bak "${AUTOJUMP_DATA_DIR}/autojump_py.bak" 2>>/dev/null
|
mv ~/.autojump_py.bak "${AUTOJUMP_DATA_DIR}/autojump_py.bak" 2>>/dev/null
|
||||||
mv ~/.autojump_errors "${AUTOJUMP_DATA_DIR}/autojump_errors" 2>>/dev/null
|
mv ~/.autojump_errors "${AUTOJUMP_DATA_DIR}/autojump_errors" 2>>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# set paths if necessary for local installations
|
||||||
|
if [ -d ~/.autojump/ ]; then
|
||||||
|
export PATH=~/.autojump/bin:"${PATH}"
|
||||||
|
fi
|
||||||
|
|
||||||
export AUTOJUMP_HOME=${HOME}
|
export AUTOJUMP_HOME=${HOME}
|
||||||
AUTOJUMP='{ [[ "$AUTOJUMP_HOME" == "$HOME" ]] && (autojump -a "$(pwd -P)"&)>/dev/null 2>>"${AUTOJUMP_DATA_DIR}/.autojump_errors";} 2>/dev/null'
|
AUTOJUMP='{ [[ "$AUTOJUMP_HOME" == "$HOME" ]] && (autojump -a "$(pwd -P)"&)>/dev/null 2>>"${AUTOJUMP_DATA_DIR}/.autojump_errors";} 2>/dev/null'
|
||||||
|
|
||||||
|
12
autojump.sh
12
autojump.sh
@ -15,7 +15,15 @@
|
|||||||
#You should have received a copy of the GNU General Public License
|
#You should have received a copy of the GNU General Public License
|
||||||
#along with autojump. If not, see <http://www.gnu.org/licenses/>.
|
#along with autojump. If not, see <http://www.gnu.org/licenses/>.
|
||||||
if [ "$BASH_VERSION" ] && [ -n "$PS1" ] && echo $SHELLOPTS | grep -v posix >>/dev/null; then
|
if [ "$BASH_VERSION" ] && [ -n "$PS1" ] && echo $SHELLOPTS | grep -v posix >>/dev/null; then
|
||||||
. /etc/profile.d/autojump.bash
|
if [ -f ~/.autojump/etc/profile.d/autojump.bash ]; then
|
||||||
|
source ~/.autojump/etc/profile.d/autojump.bash
|
||||||
|
elif [ -f /etc/profile.d/autojump.bash ]; then
|
||||||
|
source /etc/profile.d/autojump.bash
|
||||||
|
fi
|
||||||
elif [ "$ZSH_VERSION" ] && [ -n "$PS1" ]; then
|
elif [ "$ZSH_VERSION" ] && [ -n "$PS1" ]; then
|
||||||
. /etc/profile.d/autojump.zsh
|
if [ -f ~/.autojump/etc/profile.d/autojump.zsh ]; then
|
||||||
|
source ~/.autojump/etc/profile.d/autojump.zsh
|
||||||
|
elif [ -f /etc/profile.d/autojump.zsh ]; then
|
||||||
|
source /etc/profile.d/autojump.zsh
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -23,7 +23,7 @@ function add_msg {
|
|||||||
if [ "${1}" == "global" ]; then
|
if [ "${1}" == "global" ]; then
|
||||||
echo -e "\tsource /etc/profile.d/autojump.${2}"
|
echo -e "\tsource /etc/profile.d/autojump.${2}"
|
||||||
elif [ "${1}" == "local" ]; then
|
elif [ "${1}" == "local" ]; then
|
||||||
echo -e "\tsource ~/etc/profile.d/autojump.${2}"
|
echo -e "\tsource ~/.autojump/etc/profile.d/autojump.${2}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
@ -26,7 +26,7 @@ function remove_msg {
|
|||||||
if [ "${1}" == "global" ]; then
|
if [ "${1}" == "global" ]; then
|
||||||
echo -e "\tsource /etc/profile.d/autojump.${2}"
|
echo -e "\tsource /etc/profile.d/autojump.${2}"
|
||||||
elif [ "${1}" == "local" ]; then
|
elif [ "${1}" == "local" ]; then
|
||||||
echo -e "\tsource ~/etc/profile.d/autojump.${2}"
|
echo -e "\tsource ~/.autojump/etc/profile.d/autojump.${2}"
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user