mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
Implements #110: use 'export AUTOJUMP_IGNORE_CASE=1' to make autojump case insensitive
This commit is contained in:
parent
d7cea40619
commit
788255030b
13
README.md
13
README.md
@ -130,13 +130,22 @@ INTERNAL OPTIONS
|
||||
ADVANCED USAGE
|
||||
--------------
|
||||
|
||||
- Always Ignore Case
|
||||
|
||||
Default behavior is to prioritize exact matches over all else. For
|
||||
example, `j foo` will prefer /foobar over /FooBar even if the latter
|
||||
has a higher weight. To change this behavior and ignore case, add
|
||||
the following environmental variable in your \~/.bashrc:
|
||||
|
||||
export AUTOJUMP_IGNORE_CASE=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, export the following
|
||||
configuration in your \~/.bashrc:
|
||||
behavior to prefer symbolic links, add the following environmental
|
||||
variable in your \~/.bashrc:
|
||||
|
||||
export AUTOJUMP_KEEP_SYMLINKS=1
|
||||
|
||||
|
@ -15,12 +15,19 @@ MAX_STORED_PATHS = 1000
|
||||
COMPLETION_SEPARATOR = '__'
|
||||
ARGS = None
|
||||
|
||||
# load config from environmental variables
|
||||
if 'AUTOJUMP_DATA_DIR' in os.environ:
|
||||
CONFIG_DIR = os.environ.get('AUTOJUMP_DATA_DIR')
|
||||
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_IGNORE_CASE' in os.environ:
|
||||
if os.environ.get('AUTOJUMP_IGNORE_CASE') == 1:
|
||||
ALWAYS_IGNORE_CASE = True
|
||||
else:
|
||||
ALWAYS_IGNORE_CASE = False
|
||||
|
||||
if CONFIG_DIR == os.path.expanduser('~'):
|
||||
DB_FILE = CONFIG_DIR + '/.autojump.txt'
|
||||
else:
|
||||
@ -331,7 +338,9 @@ def shell_utility():
|
||||
else:
|
||||
max_matches = 1
|
||||
|
||||
if not ALWAYS_IGNORE_CASE:
|
||||
results = find_matches(db, patterns, max_matches, False)
|
||||
|
||||
# if no results, try ignoring case
|
||||
if ARGS.complete or not results:
|
||||
results = find_matches(db, patterns, max_matches, True)
|
||||
|
@ -53,6 +53,22 @@ wrapper function.
|
||||
.fi
|
||||
.SS ADVANCED USAGE
|
||||
.IP \[bu] 2
|
||||
Always Ignore Case
|
||||
.RS 2
|
||||
.PP
|
||||
Default behavior is to prioritize exact matches over all else.
|
||||
For example, \f[C]j\ foo\f[] will prefer /foobar over /FooBar even if
|
||||
the latter has a higher weight.
|
||||
To change this behavior and ignore case, add the following environmental
|
||||
variable in your ~/.bashrc:
|
||||
.IP
|
||||
.nf
|
||||
\f[C]
|
||||
export\ AUTOJUMP_IGNORE_CASE=1
|
||||
\f[]
|
||||
.fi
|
||||
.RE
|
||||
.IP \[bu] 2
|
||||
Prefer Symbolic Links
|
||||
.RS 2
|
||||
.PP
|
||||
@ -60,8 +76,8 @@ 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, export the following
|
||||
configuration in your ~/.bashrc:
|
||||
To switch behavior to prefer symbolic links, add the following
|
||||
environmental variable in your ~/.bashrc:
|
||||
.IP
|
||||
.nf
|
||||
\f[C]
|
||||
|
@ -18,9 +18,15 @@ Options must be passed to 'autojump' and not the 'j' wrapper function.
|
||||
|
||||
## ADVANCED USAGE
|
||||
|
||||
- Always Ignore Case
|
||||
|
||||
Default behavior is to prioritize exact matches over all else. For example, `j foo` will prefer /foobar over /FooBar even if the latter has a higher weight. To change this behavior and ignore case, add the following environmental variable in your ~/.bashrc:
|
||||
|
||||
export AUTOJUMP_IGNORE_CASE=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, export the following configuration in your ~/.bashrc:
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user