diff --git a/bin/autojump b/bin/autojump index 91ef235..c2f3a22 100755 --- a/bin/autojump +++ b/bin/autojump @@ -368,10 +368,6 @@ def find_matches(db, patterns, max_matches=1, ignore_case=False, fuzzy=False): return [] for path, _ in dirs: - # avoid jumping to current directory - if current_dir == decode(os.path.realpath(path)) : - continue - found, tmp = True, path for n, p in enumerate(patterns): # for single/last pattern, only check end of path @@ -382,6 +378,11 @@ def find_matches(db, patterns, max_matches=1, ignore_case=False, fuzzy=False): if not found: break if found and (os.path.exists(path) or TESTING): + # avoid jumping to current directory + # (call out to realpath this late to not stat all dirs) + if current_dir == decode(os.path.realpath(path)) : + continue + if path not in results: results.append(path) if len(results) >= max_matches: