2017-10-04 23:52:58 +08:00
|
|
|
function __history_completions --argument limit
|
2019-05-05 18:53:09 +08:00
|
|
|
if echo $limit | string match -q ""
|
|
|
|
set limit 25
|
|
|
|
end
|
2017-10-04 23:52:58 +08:00
|
|
|
|
2019-05-05 18:53:09 +08:00
|
|
|
set -l tokens (commandline --current-process --tokenize)
|
|
|
|
history --prefix (commandline) | string replace -r \^$tokens[1]\\s\* "" | head -n$limit
|
2017-09-21 09:50:10 +08:00
|
|
|
end
|
|
|
|
|
2018-04-15 12:23:33 +08:00
|
|
|
# erase the stock autojump completions, which are no longer needed with this
|
|
|
|
complete -c j -e
|
2017-10-04 23:52:58 +08:00
|
|
|
complete -k -c j -a '(__history_completions 25)' -f
|