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