From f0e45478a7344121ae32963ccc155d5bf2ccd0c7 Mon Sep 17 00:00:00 2001 From: William Ting Date: Fri, 14 Dec 2012 22:58:20 -0600 Subject: [PATCH] Add jc function, jump to a subdirectory of the current working directory. Closes #156. --- ChangeLog | 15 ++++++++++----- README.md | 7 ++++++- bin/autojump | 2 +- bin/autojump.bash | 10 +++++++++- bin/autojump.zsh | 10 +++++++++- docs/autojump.1 | 11 ++++++++++- docs/header.md | 6 +++++- 7 files changed, 50 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index c68011a..75f16a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,13 +2,18 @@ # Summary of release changes, see commit history for more details: # https://github.com/joelthelion/autojump/commits/master/ -* Release v21.1: +* Release v21.2.0: + + - Add `jc` command (jump child). Jumps to a subdirectory of the current + working directory. + +* Release v21.1.0: - install.sh is rewritten to add support for --path and --destdir options, making it easier for package maintainers to install autojump specifically into certain locations. Thanks to jjk-jacky for his contributions. -* Release v21: +* Release v21.0.0: - New mailing list for developer discussion and announcements: @@ -83,7 +88,7 @@ - Miscellaneous refactoring, bug fixes, documentation updates. -* Release v20: +* Release v20.0.0: - Python versions supported is now v2.7+ and v3.2+ due to rewrite using argparse. @@ -112,13 +117,13 @@ - Miscellaneous bug fixes. -* Release v19: +* Release v19.0.0: - prototype `cp` and `mv` directory tab completion - Debian post-installation instructions - minor Mac OS X fixes -* Release v18: +* Release v18.0.0: - add automated version numbering - performance tweaks to reduce filesystem checks diff --git a/README.md b/README.md index 9a93470..34de440 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,15 @@ autojump - a faster way to navigate your filesystem SYNOPSIS -------- -Jump to a previously visited directory 'foobar': +Jump to a previously visited directory that contains 'foo': j foo +Jump to a previously visited subdirectory of the current working +directory: + + jc bar + Show all database entries and their respective key weights: j --stat diff --git a/bin/autojump b/bin/autojump index 05d605c..571d6be 100755 --- a/bin/autojump +++ b/bin/autojump @@ -34,7 +34,7 @@ import re import shutil from tempfile import NamedTemporaryFile -VERSION = 'release-v21.1.4' +VERSION = 'release-v21.2.0' MAX_KEYWEIGHT = 1000 MAX_STORED_PATHS = 1000 COMPLETION_SEPARATOR = '__' diff --git a/bin/autojump.bash b/bin/autojump.bash index c6fad14..83c35cf 100644 --- a/bin/autojump.bash +++ b/bin/autojump.bash @@ -75,7 +75,7 @@ function j { return fi - new_path="$(autojump $@)" + new_path="$(autojump ${@})" if [ -d "${new_path}" ]; then echo -e "\\033[31m${new_path}\\033[0m" cd "${new_path}" @@ -85,3 +85,11 @@ function j { false fi } + +function jc { + if [[ ${@} == -* ]]; then + j ${@} + else + j $(pwd) ${@} + fi +} diff --git a/bin/autojump.zsh b/bin/autojump.zsh index b1485e4..4eea620 100644 --- a/bin/autojump.zsh +++ b/bin/autojump.zsh @@ -42,7 +42,7 @@ function j { return fi - local new_path="$(autojump $@)" + local new_path="$(autojump ${@})" if [ -d "${new_path}" ]; then echo -e "\\033[31m${new_path}\\033[0m" cd "${new_path}" @@ -52,3 +52,11 @@ function j { false fi } + +function jc { + if [[ ${@} == -* ]]; then + j ${@} + else + j $(pwd) ${@} + fi +} diff --git a/docs/autojump.1 b/docs/autojump.1 index d927245..a6e11c1 100644 --- a/docs/autojump.1 +++ b/docs/autojump.1 @@ -4,7 +4,7 @@ autojump - a faster way to navigate your filesystem .SS SYNOPSIS .PP -Jump to a previously visited directory \[aq]foobar\[aq]: +Jump to a previously visited directory that contains \[aq]foo\[aq]: .IP .nf \f[C] @@ -12,6 +12,15 @@ j\ foo \f[] .fi .PP +Jump to a previously visited subdirectory of the current working +directory: +.IP +.nf +\f[C] +jc\ bar +\f[] +.fi +.PP Show all database entries and their respective key weights: .IP .nf diff --git a/docs/header.md b/docs/header.md index 1cca0be..6a1e6c9 100644 --- a/docs/header.md +++ b/docs/header.md @@ -3,10 +3,14 @@ autojump - a faster way to navigate your filesystem ## SYNOPSIS -Jump to a previously visited directory 'foobar': +Jump to a previously visited directory that contains 'foo': j foo +Jump to a previously visited subdirectory of the current working directory: + + jc bar + Show all database entries and their respective key weights: j --stat