From 024d550c8c0cffd4ab1bfa1ecd8b749b71956c61 Mon Sep 17 00:00:00 2001 From: William Ting Date: Fri, 23 Nov 2012 08:30:15 -0600 Subject: [PATCH] Disable bash autocompletion, make it optional. Add relevant documentation. Closes #140. --- README.md | 10 ++++++++++ bin/autojump | 2 +- bin/autojump.bash | 5 ++++- docs/autojump.1 | 17 +++++++++++++++++ docs/body.md | 9 +++++++++ 5 files changed, 41 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 168bdd7..9f6c9b5 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,16 @@ ADDITIONAL CONFIGURATION export AUTOJUMP_KEEP_SYMLINKS=1 +- Autocomplete Additional Commands (Bash only) + + Autojump can be used to autocomplete other commands (e.g. cp or + vim). To use this feature, add the following environmental variable + in your \~/.bashrc: + + export AUTOJUMP_AUTOCOMPLETE_CMDS='cp vim' + + Changes require reloading autojump to take into effect. + ADVANCED USAGE -------------- diff --git a/bin/autojump b/bin/autojump index 5f3491b..67f9922 100755 --- a/bin/autojump +++ b/bin/autojump @@ -34,7 +34,7 @@ import re import shutil from tempfile import NamedTemporaryFile -VERSION = 'release-v21.1.1' +VERSION = 'release-v21.1.2' MAX_KEYWEIGHT = 1000 MAX_STORED_PATHS = 1000 COMPLETION_SEPARATOR = '__' diff --git a/bin/autojump.bash b/bin/autojump.bash index 935fc79..1603018 100644 --- a/bin/autojump.bash +++ b/bin/autojump.bash @@ -27,7 +27,10 @@ _autojump_files() EOF fi } -complete -o default -o bashdefault -F _autojump_files cp mv meld diff kdiff3 vim emacs + +if [[ -n ${AUTOJUMP_AUTOCOMPLETE_CMDS} ]]; then + complete -o default -o bashdefault -F _autojump_files ${AUTOJUMP_AUTOCOMPLETE_CMDS} +fi #determine the data directory according to the XDG Base Directory Specification if [[ -n ${XDG_DATA_HOME} ]] && [[ ${XDG_DATA_HOME} =~ ${USER} ]]; then diff --git a/docs/autojump.1 b/docs/autojump.1 index dfec026..f088642 100644 --- a/docs/autojump.1 +++ b/docs/autojump.1 @@ -114,6 +114,23 @@ export\ AUTOJUMP_KEEP_SYMLINKS=1 \f[] .fi .RE +.IP \[bu] 2 +Autocomplete Additional Commands (Bash only) +.RS 2 +.PP +Autojump can be used to autocomplete other commands (e.g. +cp or vim). +To use this feature, add the following environmental variable in your +~/.bashrc: +.IP +.nf +\f[C] +export\ AUTOJUMP_AUTOCOMPLETE_CMDS=\[aq]cp\ vim\[aq] +\f[] +.fi +.PP +Changes require reloading autojump to take into effect. +.RE .SS ADVANCED USAGE .IP \[bu] 2 Using Multiple Arguments diff --git a/docs/body.md b/docs/body.md index 5652a17..13f0c35 100644 --- a/docs/body.md +++ b/docs/body.md @@ -52,6 +52,15 @@ Options must be passed to 'autojump' and not the 'j' wrapper function. export AUTOJUMP_KEEP_SYMLINKS=1 +- Autocomplete Additional Commands (Bash only) + + Autojump can be used to autocomplete other commands (e.g. cp or vim). To use + this feature, add the following environmental variable in your ~/.bashrc: + + export AUTOJUMP_AUTOCOMPLETE_CMDS='cp vim' + + Changes require reloading autojump to take into effect. + ## ADVANCED USAGE - Using Multiple Arguments