1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

To prevent database decay, set the env var AUTOJUMP_KEEP_ALL_ENTRIES=1 instead of using --preserve or --competion

This commit is contained in:
William Ting 2012-05-06 18:40:19 -10:00
parent 788255030b
commit 9ad889a706
4 changed files with 48 additions and 14 deletions

View File

@ -114,8 +114,6 @@ Options must be passed to 'autojump' and not the 'j' wrapper function.
-a, --add DIR manually add path to database
--preserve prevent key weight decay over time
--stat show database entries and their key weights
--version show version information and exit
@ -127,8 +125,8 @@ INTERNAL OPTIONS
--complete used for tab completion
ADVANCED USAGE
--------------
ADDITIONAL CONFIGURATION
------------------------
- Always Ignore Case
@ -139,6 +137,15 @@ ADVANCED USAGE
export AUTOJUMP_IGNORE_CASE=1
- Prevent Database Entries' Decay
Default behavior is to decay unused database entries slowly over
time. Eventually when database limits are hit and maintenance is
run, autojump will purge older less used entries. To prevent decay,
add the following variable in your \~/.bashrc:
export AUTOJUMP_KEEP_ALL_ENTRIES=1
- Prefer Symbolic Links
Default behavior is to evaluate symbolic links into full paths as to
@ -149,6 +156,9 @@ ADVANCED USAGE
export AUTOJUMP_KEEP_SYMLINKS=1
ADVANCED USAGE
--------------
- Change Directory Weight
To manually change a directory's key weight, you can edit the file

View File

@ -22,6 +22,12 @@ else:
xdg_data_dir = os.environ.get('XDG_DATA_HOME') or os.path.join(os.environ['HOME'], '.local', 'share')
CONFIG_DIR = os.path.join(xdg_data_dir, 'autojump')
if 'AUTOJUMP_KEEP_ALL_ENTRIES' in os.environ:
if os.environ.get('AUTOJUMP_KEEP_ALL_ENTRIES') == 1:
KEEP_ALL_ENTRIES = True
else:
KEEP_ALL_ENTRIES = False
if 'AUTOJUMP_IGNORE_CASE' in os.environ:
if os.environ.get('AUTOJUMP_IGNORE_CASE') == 1:
ALWAYS_IGNORE_CASE = True
@ -165,8 +171,6 @@ def options():
help='enclose directory quotes to prevent errors')
parser.add_argument('--complete', action="store_true", default=False,
help='used for bash tab completion')
parser.add_argument('--preserve', action="store_true", default=False,
help='prevent key weight decay over time')
parser.add_argument('--stat', action="store_true", default=False,
help='show database entries and their key weights')
parser.add_argument('--version', action="version", version="%(prog)s " + VERSION,
@ -227,7 +231,7 @@ def match_last(pattern):
if (len(last_pattern_path) > 0 and
last_pattern_path[0] == "/" and
os.path.exists(last_pattern_path)):
if not ARGS.preserve:
if not ARGS.complete:
output(last_pattern_path)
return True
return False
@ -364,7 +368,7 @@ def shell_utility():
else:
return False
if not ARGS.preserve:
if not KEEP_ALL_ENTRIES:
db.maintenance()
return True

View File

@ -35,8 +35,6 @@ wrapper function.
\f[C]
-a,\ --add\ DIR\ \ \ \ \ \ \ manually\ add\ path\ to\ database
--preserve\ \ \ \ \ \ \ \ \ \ prevent\ key\ weight\ decay\ over\ time
--stat\ \ \ \ \ \ \ \ \ \ \ \ \ \ show\ database\ entries\ and\ their\ key\ weights
--version\ \ \ \ \ \ \ \ \ \ \ show\ version\ information\ and\ exit
@ -51,7 +49,7 @@ wrapper function.
--complete\ \ \ \ \ \ \ \ \ \ used\ for\ tab\ completion
\f[]
.fi
.SS ADVANCED USAGE
.SS ADDITIONAL CONFIGURATION
.IP \[bu] 2
Always Ignore Case
.RS 2
@ -69,6 +67,21 @@ export\ AUTOJUMP_IGNORE_CASE=1
.fi
.RE
.IP \[bu] 2
Prevent Database Entries\[aq] Decay
.RS 2
.PP
Default behavior is to decay unused database entries slowly over time.
Eventually when database limits are hit and maintenance is run, autojump
will purge older less used entries.
To prevent decay, add the following variable in your ~/.bashrc:
.IP
.nf
\f[C]
export\ AUTOJUMP_KEEP_ALL_ENTRIES=1
\f[]
.fi
.RE
.IP \[bu] 2
Prefer Symbolic Links
.RS 2
.PP
@ -85,6 +98,7 @@ export\ AUTOJUMP_KEEP_SYMLINKS=1
\f[]
.fi
.RE
.SS ADVANCED USAGE
.IP \[bu] 2
Change Directory Weight
.RS 2

View File

@ -4,8 +4,6 @@ Options must be passed to 'autojump' and not the 'j' wrapper function.
-a, --add DIR manually add path to database
--preserve prevent key weight decay over time
--stat show database entries and their key weights
--version show version information and exit
@ -16,7 +14,7 @@ Options must be passed to 'autojump' and not the 'j' wrapper function.
--complete used for tab completion
## ADVANCED USAGE
## ADDITIONAL CONFIGURATION
- Always Ignore Case
@ -24,12 +22,20 @@ Options must be passed to 'autojump' and not the 'j' wrapper function.
export AUTOJUMP_IGNORE_CASE=1
- Prevent Database Entries' Decay
Default behavior is to decay unused database entries slowly over time. Eventually when database limits are hit and maintenance is run, autojump will purge older less used entries. To prevent decay, add the following variable in your ~/.bashrc:
export AUTOJUMP_KEEP_ALL_ENTRIES=1
- Prefer Symbolic Links
Default behavior is to evaluate symbolic links into full paths as to reduce duplicate entries in the database. However, some users prefer a shorter working directory path in their shell prompt. To switch behavior to prefer symbolic links, add the following environmental variable in your ~/.bashrc:
export AUTOJUMP_KEEP_SYMLINKS=1
## ADVANCED USAGE
- Change Directory Weight
To manually change a directory's key weight, you can edit the file _$XDG_DATA_HOME/autojump/autojump.txt_. Each entry has two columns. The first is the key weight and the second is the path: