1
0
mirror of https://github.com/wting/autojump synced 2026-03-02 03:49:26 +00:00

Implements #110: use 'export AUTOJUMP_IGNORE_CASE=1' to make autojump case insensitive

This commit is contained in:
William Ting
2012-05-06 18:30:22 -10:00
parent d7cea40619
commit 788255030b
4 changed files with 46 additions and 6 deletions

View File

@@ -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
results = find_matches(db, patterns, max_matches, False)
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)