@@ -64,7 +64,11 @@ fi |
| 64 | 64 | builtin cd - && __gump_hook |
| 65 | 65 | else |
| 66 | 66 | local result |
| 67 | | - result=$(command gump query -- "$@") |
| 67 | + # Try CWD first, then database |
| 68 | + result=$(command gump query --cwd -- "$@" 2>/dev/null) |
| 69 | + if [[ -z "$result" ]]; then |
| 70 | + result=$(command gump query -- "$@" 2>/dev/null) |
| 71 | + fi |
| 68 | 72 | if [[ -n "$result" ]]; then |
| 69 | 73 | builtin cd -- "$result" && __gump_hook |
| 70 | 74 | else |
@@ -91,14 +95,21 @@ fi |
| 91 | 95 | output.push_str(r#" |
| 92 | 96 | # No-prefix directory jumping |
| 93 | 97 | command_not_found_handle() { |
| 94 | | - # Check if it's a local directory first |
| 98 | + # Check if it's a local directory first (exact match) |
| 95 | 99 | if [[ -d "$1" ]]; then |
| 96 | 100 | builtin cd -- "$1" && __gump_hook |
| 97 | 101 | return 0 |
| 98 | 102 | fi |
| 99 | 103 | |
| 100 | | - # Query gump database |
| 104 | + # Fuzzy match against current directory contents |
| 101 | 105 | local result |
| 106 | + result=$(command gump query --cwd -- "$@" 2>/dev/null) |
| 107 | + if [[ -n "$result" ]]; then |
| 108 | + builtin cd -- "$result" && __gump_hook |
| 109 | + return 0 |
| 110 | + fi |
| 111 | + |
| 112 | + # Query gump database |
| 102 | 113 | result=$(command gump query -- "$@" 2>/dev/null) |
| 103 | 114 | if [[ -n "$result" ]]; then |
| 104 | 115 | builtin cd -- "$result" && __gump_hook |
@@ -153,7 +164,11 @@ __gump_hook() { |
| 153 | 164 | builtin cd - |
| 154 | 165 | else |
| 155 | 166 | local result |
| 156 | | - result=$(command gump query -- "$@") |
| 167 | + # Try CWD first, then database |
| 168 | + result=$(command gump query --cwd -- "$@" 2>/dev/null) |
| 169 | + if [[ -z "$result" ]]; then |
| 170 | + result=$(command gump query -- "$@" 2>/dev/null) |
| 171 | + fi |
| 157 | 172 | if [[ -n "$result" ]]; then |
| 158 | 173 | builtin cd -- "$result" |
| 159 | 174 | else |
@@ -202,15 +217,23 @@ __gump_accept_line() { |
| 202 | 217 | return |
| 203 | 218 | fi |
| 204 | 219 | |
| 205 | | - # Check if it's a local directory |
| 220 | + # Check if it's a local directory (exact match) |
| 206 | 221 | if [[ -d "$first_word" ]]; then |
| 207 | 222 | BUFFER="cd ${(q)first_word}" |
| 208 | 223 | zle .accept-line |
| 209 | 224 | return |
| 210 | 225 | fi |
| 211 | 226 | |
| 212 | | - # Query gump database |
| 227 | + # Fuzzy match against current directory contents |
| 213 | 228 | local result |
| 229 | + result=$(command gump query --cwd -- $=BUFFER 2>/dev/null) |
| 230 | + if [[ -n "$result" ]]; then |
| 231 | + BUFFER="cd ${(q)result}" |
| 232 | + zle .accept-line |
| 233 | + return |
| 234 | + fi |
| 235 | + |
| 236 | + # Query gump database |
| 214 | 237 | result=$(command gump query -- $=BUFFER 2>/dev/null) |
| 215 | 238 | if [[ -n "$result" ]]; then |
| 216 | 239 | BUFFER="cd ${(q)result}" |
@@ -259,7 +282,11 @@ function {cmd} --description "Jump to a directory" |
| 259 | 282 | else if test (count $argv) -eq 1 -a "$argv[1]" = "-" |
| 260 | 283 | cd - |
| 261 | 284 | else |
| 262 | | - set -l result (command gump query -- $argv) |
| 285 | + # Try CWD first, then database |
| 286 | + set -l result (command gump query --cwd -- $argv 2>/dev/null) |
| 287 | + if test -z "$result" |
| 288 | + set result (command gump query -- $argv 2>/dev/null) |
| 289 | + end |
| 263 | 290 | if test -n "$result" |
| 264 | 291 | cd $result |
| 265 | 292 | else |
@@ -306,13 +333,21 @@ function __gump_execute |
| 306 | 333 | return |
| 307 | 334 | end |
| 308 | 335 | |
| 309 | | - # Check if it's a local directory |
| 336 | + # Check if it's a local directory (exact match) |
| 310 | 337 | if test -d "$first_word" |
| 311 | 338 | commandline -r "cd $first_word" |
| 312 | 339 | commandline -f execute |
| 313 | 340 | return |
| 314 | 341 | end |
| 315 | 342 | |
| 343 | + # Fuzzy match against current directory contents |
| 344 | + set -l result (command gump query --cwd -- $cmd 2>/dev/null) |
| 345 | + if test -n "$result" |
| 346 | + commandline -r "cd \"$result\"" |
| 347 | + commandline -f execute |
| 348 | + return |
| 349 | + end |
| 350 | + |
| 316 | 351 | # Query gump database |
| 317 | 352 | set -l result (command gump query -- $cmd 2>/dev/null) |
| 318 | 353 | if test -n "$result" |