Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' into linux

* master:
  Squashed '.zsh.d/external/autojump/' changes from fd16ecb..a74ef31
  Let vim guess the background color.
  Tweaked zsh keybindings.
  • Loading branch information...
commit 4b8c2145405f48394df2d5961dd1384bd44efb99 2 parents a903167 + 691c8d3
@sudish authored
View
2  .vimrc
@@ -7,7 +7,7 @@ if has("syntax")
syntax enable
endif
-set background=light
+"set background=light
set t_Co=256
"let g:solarized_termcolors=16
colorscheme solarized
View
59 .zsh.d/external/autojump/README.rst
@@ -73,48 +73,35 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with autojump. If not, see <http://www.gnu.org/licenses/>.
+Requirements
+============
+
+Python v2.6+ or 3.0+
+
Installation
============
Auto Installation
-----------------
-run::
-
- ./install.sh
-
-or::
-
- ./install.zsh
+run::
-depending on your shell.
-Enter your root password if it asks.
+ ./install.sh [ --local ] [ --zsh ]
-Add the line::
+and follow on screen instructions.
- source /etc/profile
+Use --local to install into current user's home directory.
-to ``~/.bashrc`` or ``~/.zshrc`` if it isn't already there.
+Use --zsh to install for Z shell.
Troubleshoot
------------
If the script fails, you may need to do::
- chmod +x install.(z)sh
-
-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.
+ chmod +x install.sh
-Make sure to source ``/etc/profile`` in your ``.bashrc`` or ``.zshrc`` ::
-
- source /etc/profile
+before the first step.
Packaging
=========
@@ -126,7 +113,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::
apt-get install autojump
-
+
Autojump is also available on the OSX Homebrew package manager::
brew install autojump
@@ -136,24 +123,10 @@ Autojump is also packaged for a number of other distros. Check the wiki for an u
Uninstallation
==============
-To completely remove autojump you should remove these files:
-
-``/etc/profile.d/autojump.bash``
-
-``/etc/profile.d/autojump.sh``
-
-``/etc/profile.d/autojump.zsh``
-
-``/usr/bin/autojump``
-
-``/usr/bin/jumpapplet``
-
-``/usr/share/autojump/icon.png``
-
-``/usr/share/autojump/``
+run::
-``/usr/share/man/man1/autojump.1``
+ ./uninstall.sh
-Remove any mention of autojump in your ``.bashrc`` or ``.zshrc``, then in currently running shells do:``source /etc/profile``.
+and follow on screen instructions.
If you keep getting ``autojump: command not found`` at the Bash prompt, do:``unset PROMPT_COMMAND``. You can also restart your shell.
View
36 .zsh.d/external/autojump/autojump
@@ -85,15 +85,23 @@ def save(path_dict, dic_file):
for path,weight in sorted(path_dict.items(),key=itemgetter(1),reverse=True):
# the db is stored in utf-8
temp.write((unico("%s\t%s\n")%(weight,path)).encode("utf-8"))
- #cf. http://thunk.org/tytso/blog/2009/03/15/dont-fear-the-fsync/
- temp.flush()
- os.fsync(temp)
- temp.close()
+
+ # Catching disk errors and skipping save since file handle can't be closed.
+ try:
+ #cf. http://thunk.org/tytso/blog/2009/03/15/dont-fear-the-fsync/
+ temp.flush()
+ os.fsync(temp)
+ temp.close()
+ except IOError as ex:
+ print("Error while saving autojump database (disk full?)" %
+ ex, file=stderr)
+ return
+
# Use shutil.move instead of os.rename because windows doesn't support
# using rename to overwrite files
shutil.move(temp.name, dic_file)
try: #backup file
- import time
+ import time
if (not os.path.exists(dic_file+".bak") or
time.time()-os.path.getmtime(dic_file+".bak")>86400):
shutil.copy(dic_file, dic_file+".bak")
@@ -147,14 +155,14 @@ def open_dic(dic_file, error_recovery=False):
def forget(path_dict, dic_file):
"""Gradually forget about directories. Only call
from the actual jump since it can take time"""
- keyweight = sum(path_dict.values())
- if keyweight > MAX_KEYWEIGHT:
+ keyweight = sum(path_dict.values())
+ if keyweight > MAX_KEYWEIGHT:
for k in path_dict.keys():
path_dict[k] *= 0.9 * MAX_KEYWEIGHT / keyweight
save(path_dict, dic_file)
def clean_dict(sorted_dirs, path_dict):
- """Limits the sized of the path_dict to MAX_STORED_PATHS.
+ """Limits the sized of the path_dict to MAX_STORED_PATHS.
Returns True if keys were deleted"""
if len(sorted_dirs) > MAX_STORED_PATHS:
#remove 25 more than needed, to avoid doing it every time
@@ -183,7 +191,7 @@ def match(path, pattern, ignore_case=False, only_end=False):
return (does_match, eaten_path)
def find_matches(dirs, patterns, result_list, ignore_case, max_matches, current_dir):
- """Find max_matches paths that match the pattern,
+ """Find max_matches paths that match the pattern,
and add them to the result_list"""
for path, count in dirs:
# Don't jump to where we alread are
@@ -222,7 +230,7 @@ def shell_utility():
if ('-a', '') in optlist:
# The home dir can be reached quickly by "cd"
# and may interfere with other directories
- if(args[-1] != os.path.expanduser("~")):
+ if(args[-1] != os.path.expanduser("~")):
dicadd(path_dict, decode(args[-1]))
save(path_dict, dic_file)
elif ('--stat', '') in optlist:
@@ -241,7 +249,7 @@ def shell_utility():
import re
completion = False
#userchoice is i if the pattern is __pattern__i, otherwise -1
- userchoice = -1
+ userchoice = -1
results = []
if ('--completion', '') in optlist:
completion = True
@@ -286,10 +294,10 @@ def shell_utility():
find_matches(dirs, patterns, results, False, max_matches, current_dir)
# If not found, try ignoring case.
# On completion always show all results
- if completion or not results:
+ if completion or not results:
find_matches(dirs, patterns, results,
ignore_case=True,
- max_matches=max_matches, current_dir=current_dir)
+ max_matches=max_matches, current_dir=current_dir)
# Keep the database to a reasonable size
if not completion and clean_dict(dirs, path_dict):
save(path_dict, dic_file)
@@ -298,7 +306,7 @@ def shell_utility():
else: quotes = ""
if userchoice != -1:
- if len(results) > userchoice-1 :
+ if len(results) > userchoice-1 :
output(unico("%s%s%s") % (quotes,results[userchoice-1],quotes))
elif len(results) > 1 and completion:
output("\n".join(("%s%s%d%s%s" % (patterns[-1],
View
27 .zsh.d/external/autojump/autojump.bash
@@ -15,7 +15,7 @@
#along with autojump. If not, see <http://www.gnu.org/licenses/>.
#This shell snippet sets the prompt command and the necessary aliases
-_autojump()
+_autojump()
{
local cur
cur=${COMP_WORDS[*]:1}
@@ -29,10 +29,9 @@ EOF
}
complete -F _autojump j
-_autojump_files()
+_autojump_files()
{
- if [[ ${COMP_WORDS[COMP_CWORD]} == *__* ]]
- then
+ if [[ ${COMP_WORDS[COMP_CWORD]} == *__* ]]; then
local cur
#cur=${COMP_WORDS[*]:1}
cur=${COMP_WORDS[COMP_CWORD]}
@@ -48,23 +47,32 @@ EOF
complete -o default -o bashdefault -F _autojump_files cp mv meld diff kdiff3
#determine the data directory according to the XDG Base Directory Specification
-if [ -n "$XDG_DATA_HOME" ]
-then
+if [ -n "$XDG_DATA_HOME" ]; then
export AUTOJUMP_DATA_DIR="$XDG_DATA_HOME/autojump"
else
export AUTOJUMP_DATA_DIR=~/.local/share/autojump
fi
-if [ ! -e "${AUTOJUMP_DATA_DIR}" ]
-then
+if [ ! -e "${AUTOJUMP_DATA_DIR}" ]; then
mkdir -p "${AUTOJUMP_DATA_DIR}"
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_errors "${AUTOJUMP_DATA_DIR}/autojump_errors" 2>>/dev/null
fi
+# set paths if necessary for local installations
+if [ -d ~/.autojump/ ]; then
+ export PATH=~/.autojump/bin:"${PATH}"
+fi
+
export AUTOJUMP_HOME=${HOME}
-AUTOJUMP='{ [[ "$AUTOJUMP_HOME" == "$HOME" ]] && (autojump -a "$(pwd -P)"&)>/dev/null 2>>"${AUTOJUMP_DATA_DIR}/.autojump_errors";} 2>/dev/null'
+if [ "${AUTOJUMP_KEEP_SYMLINKS}" == "1" ]
+then
+ _PWD_ARGS=""
+else
+ _PWD_ARGS="-P"
+fi
+AUTOJUMP='{ [[ "$AUTOJUMP_HOME" == "$HOME" ]] && (autojump -a "$(pwd ${_PWD_ARGS})"&)>/dev/null 2>>"${AUTOJUMP_DATA_DIR}/.autojump_errors";} 2>/dev/null'
case $PROMPT_COMMAND in
*autojump*) ;;
@@ -73,3 +81,4 @@ esac
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";else false; fi }
+
View
12 .zsh.d/external/autojump/autojump.sh
@@ -15,7 +15,15 @@
#You should have received a copy of the GNU General Public License
#along with autojump. If not, see <http://www.gnu.org/licenses/>.
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
- . /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
View
22 .zsh.d/external/autojump/autojump.zsh
@@ -14,24 +14,34 @@
#You should have received a copy of the GNU General Public License
#along with autojump. If not, see <http://www.gnu.org/licenses/>.
-#determine the data directory according to the XDG Base Directory Specification
-if [ -n "$XDG_DATA_HOME" ]
-then
+# determine the data directory according to the XDG Base Directory Specification
+if [ -n "$XDG_DATA_HOME" ]; then
export AUTOJUMP_DATA_DIR="$XDG_DATA_HOME/autojump"
else
export AUTOJUMP_DATA_DIR=~/.local/share/autojump
fi
-if [ ! -e "${AUTOJUMP_DATA_DIR}" ]
-then
+if [ ! -e "${AUTOJUMP_DATA_DIR}" ]; then
mkdir -p "${AUTOJUMP_DATA_DIR}"
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_errors "${AUTOJUMP_DATA_DIR}/autojump_errors" 2>>/dev/null
fi
+# set paths if necessary for local installations
+if [[ -d ~/.autojump/ ]]; then
+ path=(~/.autojump/bin $path)
+ fpath=(~/.autojump/functions/ $fpath)
+fi
+
function autojump_preexec() {
- { (autojump -a "$(pwd -P)"&)>/dev/null 2>>|${AUTOJUMP_DATA_DIR}/.autojump_errors ; } 2>/dev/null
+ if [[ "${AUTOJUMP_KEEP_SYMLINKS}" == "1" ]]
+ then
+ _PWD_ARGS=""
+ else
+ _PWD_ARGS="-P"
+ fi
+ { (autojump -a "$(pwd ${_PWD_ARGS})"&)>/dev/null 2>>|${AUTOJUMP_DATA_DIR}/.autojump_errors ; } 2>/dev/null
}
typeset -ga preexec_functions
View
177 .zsh.d/external/autojump/install.sh
@@ -15,12 +15,32 @@
#You should have received a copy of the GNU General Public License
#along with autojump. If not, see <http://www.gnu.org/licenses/>.
-function show_help {
- echo "sudo ./install.sh [--prefix /usr/local]"
+function add_msg {
+ echo
+ echo "Please add the line to ~/.${2}rc :"
+ echo
+
+ if [ "${1}" == "global" ]; then
+ echo -e "\tsource /etc/profile.d/autojump.${2}"
+ elif [ "${1}" == "local" ]; then
+ echo -e "\tsource ~/.autojump/etc/profile.d/autojump.${2}"
+ fi
+
+ echo
+ echo "You need to run 'source ~/.${2}rc' before you can start using autojump."
+ echo
+ echo "To remove autojump, run './uninstall.sh'"
+ echo
+}
+
+function help_msg {
+ echo "sudo ./install.sh [--local] [--prefix /usr/local] [--zsh]"
}
# Default install directory.
prefix=/usr
+shell="bash"
+local=
user=${SUDO_USER:-${USER}}
OS=`uname`
@@ -30,25 +50,73 @@ if [ $OS == 'Darwin' ]; then
else
user_home=$(getent passwd ${user} | cut -d: -f6)
fi
- bashrc_file=${user_home}/.bashrc
+bashrc_file=${user_home}/.bashrc
# Command line parsing
while true; do
case "$1" in
- -h|--help|-\?) show_help; exit 0;;
- -p|--prefix) if [ $# -gt 1 ]; then
- prefix=$2; shift 2
- else
- echo "--prefix or -p require an argument" 1>&2
+ -h|--help|-\?)
+ help_msg;
+ exit 0
+ ;;
+ -l|--local)
+ local=true
+ prefix=~/.autojump
+ shift
+ ;;
+ -p|--prefix)
+ if [ $# -gt 1 ]; then
+ prefix=$2; shift 2
+ else
+ echo "--prefix or -p require an argument" 1>&2
+ exit 1
+ fi
+ ;;
+ -z|--zsh)
+ shell="zsh"
+ shift
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ echo "invalid option: $1" 1>&2;
+ help_msg;
exit 1
- fi ;;
- --) shift; break;;
- -*) echo "invalid option: $1" 1>&2; show_help; exit 1;;
- *) break;;
+ ;;
+ *)
+ break
+ ;;
esac
done
-echo "Installing to ${prefix} ..."
+# check Python version
+python_version=`python -c 'import sys; print(sys.version_info[:])'`
+if [[ ${python_version:1:1} -eq 2 && ${python_version:4:1} -lt 6 ]]; then
+ echo
+ echo "Incompatible Python version, please upgrade to v2.6+ or v3.0+."
+ if [[ ${python_version:4:1} -gt 3 ]]; then
+ echo
+ echo "Alternatively, you can download v12 that supports Python v2.4+ from:"
+ echo
+ echo -e "\thttps://github.com/joelthelion/autojump/tags"
+ echo
+ fi
+ exit 1
+fi
+
+# check for valid options
+if [[ ${UID} != 0 ]] && [ ! ${local} ]; then
+ echo
+ echo "Please rerun as root or use the --local option."
+ echo
+ exit 1
+fi
+
+echo
+echo "Installing files to ${prefix} ..."
+echo
# add git revision to autojump
./git-version.sh
@@ -57,52 +125,45 @@ echo "Installing to ${prefix} ..."
mkdir -p ${prefix}/share/autojump/
mkdir -p ${prefix}/bin/
mkdir -p ${prefix}/share/man/man1/
-cp icon.png ${prefix}/share/autojump/
-cp jumpapplet ${prefix}/bin/
-cp autojump ${prefix}/bin/
-cp autojump.1 ${prefix}/share/man/man1/
-
-if [ -d "/etc/profile.d" ]; then
- cp autojump.bash /etc/profile.d/
- cp autojump.sh /etc/profile.d/
-
- # Make sure that the code we just copied has been sourced.
- # check if .bashrc has sourced /etc/profile or /etc/profile.d/autojump.bash
- if [ `grep -c "^[[:space:]]*\(source\|\.\) /etc/profile\(\.d/autojump\.bash\)[[:space:]]*$" ${bashrc_file}` -eq 0 ]; then
- echo "Your .bashrc doesn't seem to source /etc/profile or /etc/profile.d/autojump.bash"
- echo "Adding the /etc/profile.d/autojump.bash to your .bashrc"
- echo "" >> ${bashrc_file}
- echo "# Added by autojump install.sh" >> ${bashrc_file}
- echo "source /etc/profile.d/autojump.bash" >> ${bashrc_file}
+cp -v icon.png ${prefix}/share/autojump/
+cp -v jumpapplet ${prefix}/bin/
+cp -v autojump ${prefix}/bin/
+cp -v autojump.1 ${prefix}/share/man/man1/
+
+# global installation
+if [ ! ${local} ]; then
+ # install _j to the first accessible directory
+ if [ ${shell} == "zsh" ]; then
+ success=
+ fpath=`/usr/bin/env zsh -c 'echo $fpath'`
+ for f in ${fpath}; do
+ cp -v _j ${f} && success=true && break
+ done
+
+ if [ ! ${success} ]; then
+ echo
+ echo "Couldn't find a place to put the autocompletion file, please copy _j into your \$fpath"
+ echo "Installing the rest of autojump ..."
+ echo
+ fi
fi
- echo "Done!"
- echo
- echo "You need to source your ~/.bashrc (source ~/.bashrc) before you can start using autojump."
-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 ~/.bashrc 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
-
- # Answered yes. Go ahead and add the autojump code
- echo "" >> ${bashrc_file}
- echo "#autojump" >> ${bashrc_file}
- cat autojump.bash | grep -v "^#" >> ${bashrc_file}
-
- # Since OSX uses .bash_profile, we need to make sure that .bashrc is properly sourced.
- # Makes the assumption that if they have a line: source ~/.bashrc or . ~/.bashrc, that
- # .bashrc has been properly sourced and you don't need to add it.
- if [ $OS == 'Darwin' -a x`grep -c "^[[:space:]]*\(source\|\.\) ~/\.bashrc[[:space:]]*$" ~/.bash_profile` == x0 ]; then
- echo "You are using OSX and your .bash_profile doesn't seem to be sourcing .bashrc"
- echo "Adding source ~/.bashrc to your bashrc"
- echo -e "\n# Get the aliases and functions" >> ~/.bash_profile
- echo -e "if [ -f ${bashrc_file} ]; then\n . ${bashrc_file}\nfi" >> ~/.bash_profile
- fi
- echo "You need to source your ~/.bashrc (source ~/.bashrc) before you can start using autojump."
- else
- echo "Then you need to put autojump.sh, or the code from it, somewhere where it will get read. Good luck!"
- fi
+
+ if [ -d "/etc/profile.d" ]; then
+ cp -v autojump.sh /etc/profile.d/
+ cp -v autojump.${shell} /etc/profile.d/
+ add_msg "global" ${shell}
else
- echo "Then you need to put autojump.sh, or the code from it, somewhere where it will get read. Good luck!"
+ echo "Your distribution does not have a '/etc/profile.d/' directory, please create it manually or use the local install option."
fi
+else # local installation
+ mkdir -p ${prefix}/etc/profile.d/
+ cp -v autojump.sh ${prefix}/etc/profile.d/
+ cp -v autojump.${shell} ${prefix}/etc/profile.d/
+
+ if [ ${shell} == "zsh" ]; then
+ mkdir -p ${prefix}/functions/
+ cp _j ${prefix}/functions/
+ fi
+
+ add_msg "local" ${shell}
fi
View
94 .zsh.d/external/autojump/install.zsh
@@ -1,94 +0,0 @@
-#!/usr/bin/env zsh
-#Copyright Joel Schaerer 2008, 2009
-#This file is part of autojump
-
-#autojump is free software: you can redistribute it and/or modify
-#it under the terms of the GNU General Public License as published by
-#the Free Software Foundation, either version 3 of the License, or
-#(at your option) any later version.
-#
-#autojump is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-#GNU General Public License for more details.
-#
-#You should have received a copy of the GNU General Public License
-#along with autojump. If not, see <http://www.gnu.org/licenses/>.
-
-function show_help {
- echo "sudo ./install.sh [--prefix /usr/local]"
-}
-
-prefix=/usr
-
-#command line parsing
-while true; do
- case "$1" in
- -h|--help|-\?) show_help; exit 0;;
- -p|--prefix) if [ $# -gt 1 ]; then
- prefix=$2; shift 2
- else
- echo "--prefix or -p require an argument" 1>&2
- exit 1
- fi ;;
- --) shift; break;;
- -*) echo "invalid option: $1" 1>&2; show_help; exit 1;;
- *) break;;
- esac
-done
-
-echo "Installing main files to ${prefix} ..."
-
-# add git revision to autojump
-./git-version.sh
-
-sudo mkdir -p ${prefix}/share/autojump/
-sudo mkdir -p ${prefix}/bin/
-sudo mkdir -p ${prefix}/share/man/man1/
-sudo cp icon.png ${prefix}/share/autojump/
-sudo cp jumpapplet ${prefix}/bin/
-sudo cp autojump ${prefix}/bin/
-sudo cp autojump.1 ${prefix}/share/man/man1/
-
-# autocompletion file in the first directory of the FPATH variable
-fail=true
-for f in $fpath
-do
- sudo cp _j $f && fail=false && break
-done
-if $fail
-then
- echo "Couldn't find a place to put the autocompletion file :-("
- echo "Still trying to install the rest of autojump..."
-else
- echo "Installed autocompletion file to $f"
-fi
-
-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.d/autojump.zsh"
- echo "or"
- echo " source /etc/profile"
- echo "to your ~/.zshrc if it's not there already"
- echo
- echo "You need to source your ~/.zshrc (source ~/.zshrc) before you can start using autojump."
-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
- echo "Done!"
- echo
- echo "You need to source your ~/.zshrc (source ~/.zshrc) before you can start using autojump."
- 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
View
110 .zsh.d/external/autojump/uninstall.sh
@@ -0,0 +1,110 @@
+#!/usr/bin/env bash
+#Copyright Joel Schaerer 2008, 2009
+#This file is part of autojump
+
+#autojump is free software: you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation, either version 3 of the License, or
+#(at your option) any later version.
+#
+#autojump is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU General Public License
+#along with autojump. If not, see <http://www.gnu.org/licenses/>.
+
+function help_msg {
+ echo "sudo ./uninstall.sh [--prefix /usr/local]"
+}
+
+function remove_msg {
+ echo
+ echo "Please remove the line from .${2}rc :"
+ echo
+ if [ "${1}" == "global" ]; then
+ echo -e "\tsource /etc/profile.d/autojump.${2}"
+ elif [ "${1}" == "local" ]; then
+ echo -e "\tsource ~/.autojump/etc/profile.d/autojump.${2}"
+ fi
+ echo
+}
+
+# Default install directory.
+prefix=/usr
+
+user=${SUDO_USER:-${USER}}
+OS=`uname`
+
+if [ $OS == 'Darwin' ]; then
+ user_home=$(dscl . -search /Users UniqueID ${user} | cut -d: -f6)
+else
+ user_home=$(getent passwd ${user} | cut -d: -f6)
+fi
+bashrc_file=${user_home}/.bashrc
+
+# Command line parsing
+while true; do
+ case "$1" in
+ -h|--help|-\?) help_msg; exit 0;;
+ -p|--prefix)
+ if [ $# -gt 1 ]; then
+ prefix=$2; shift 2
+ else
+ echo "--prefix or -p require an argument" 1>&2
+ exit 1
+ fi
+ ;;
+ --) shift; break;;
+ -*) echo "invalid option: $1" 1>&2; help_msg; exit 1;;
+ *) break;;
+ esac
+done
+
+# UNINSTALL AUTOJUMP
+# global / custom location installations
+if [ -d "${prefix}/share/autojump/" ]; then
+ echo
+ echo "Uninstalling from ${prefix} ..."
+ echo
+ sudo rm -rv ${prefix}/share/autojump/
+ sudo rm -v ${prefix}/bin/jumpapplet
+ sudo rm -v ${prefix}/bin/autojump
+ sudo rm -v ${prefix}/share/man/man1/autojump.1
+ sudo rm -v /etc/profile.d/autojump.sh
+
+ if [ -f /etc/profile.d/autojump.bash ]; then
+ sudo rm -v /etc/profile.d/autojump.bash
+ remove_msg "global" "bash"
+ fi
+
+ if [ -f /etc/profile.d/autojump.zsh ]; then
+ sudo rm -v /etc/profile.d/autojump.zsh
+
+ fpath=`/usr/bin/env zsh -c 'echo $fpath'`
+ for f in ${fpath}; do
+ if [[ -f ${f}/_j ]]; then
+ sudo rm -v ${f}/_j
+ fi
+ done
+
+ remove_msg "global" "zsh"
+ fi
+fi
+
+# local installations
+if [ -d ~/.autojump/ ]; then
+ echo
+ echo "Uninstalling from ~/.autojump/ ..."
+ echo
+
+ if [ -f ~/.autojump/etc/profile.d/autojump.bash ]; then
+ rm -rv ~/.autojump/
+ remove_msg "local" "bash"
+ fi
+ if [ -f ~/.autojump/etc/profile.d/autojump.zsh ]; then
+ rm -rv ~/.autojump/
+ remove_msg "local" "zsh"
+ fi
+fi
View
16 .zsh.d/init.d/S95_zsh_keybindings
@@ -10,23 +10,23 @@ bindkey '' backward-delete-char
# zsh built-in help system (bound to ESC h)
autoload -Uz run-help
-# search history using entered prefix
-bindkey '\e[A' history-beginning-search-backward
-bindkey '\e[B' history-beginning-search-forward
+# search history using entered prefix.
+# bind to control up- and down-arrow
+bindkey '\e[1;5A' history-beginning-search-backward
+bindkey '\e[1;5B' history-beginning-search-forward
-# same as above, but leave cursor at end of lines
+# same history using entered prefix leaving cursor at end of lines.
# repeated presses remember and use original prefix
autoload -U history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
-# bind to control up- and down-arrow for now
-bindkey '\e[1;5A' history-beginning-search-backward-end
-bindkey '\e[1;5B' history-beginning-search-forward-end
+bindkey '\e[A' history-beginning-search-backward-end
+bindkey '\e[B' history-beginning-search-forward-end
# Insert $!, repeat for earlier history
autoload -U smart-insert-last-word
zle -N smart-insert-last-word
-bindkey '\e=' smart-insert-last-word
+bindkey '\e.' smart-insert-last-word
# Insert last word, repeat for earlier
autoload -U copy-earlier-word
Please sign in to comment.
Something went wrong with that request. Please try again.