mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-15 09:27:38 +00:00
a2cb9cceaf
The default completions that autojump ships with for fish are broken (emitting output like "1\___\#...") as they use hackes to work around the previous lack of `complete -k`. The history-based autojump completions fully replace it.
12 lines
407 B
Fish
12 lines
407 B
Fish
function __history_completions --argument limit
|
|
if echo $limit | string match -q ""
|
|
set limit 25
|
|
end
|
|
|
|
set -l tokens (commandline --current-process --tokenize)
|
|
history --prefix (commandline) | string replace -r \^$tokens[1]\\s\* "" | head -n$limit
|
|
end
|
|
|
|
# erase the stock autojump completions, which are no longer needed with this
|
|
complete -c j -e
|
|
complete -k -c j -a '(__history_completions 25)' -f
|