2020-09-19 17:39:51 +08:00
|
|
|
function __history_completions --argument-names limit
|
2020-01-22 17:54:52 +08:00
|
|
|
if string match -q "" -- "$limit"
|
2019-05-05 18:53:09 +08:00
|
|
|
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
|