From 2dd2867a612f7a5e02e0bb44fec2b5707de962a5 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Wed, 4 Oct 2017 17:52:58 +0200 Subject: [PATCH] Implement limits for __history_completions in j completions --- share/completions/j.fish | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/share/completions/j.fish b/share/completions/j.fish index 04c45411d..7d8a995aa 100644 --- a/share/completions/j.fish +++ b/share/completions/j.fish @@ -1,6 +1,10 @@ -function __history_completions +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\* "" + history --prefix (commandline) | string replace -r \^$tokens[1]\\s\* "" | head -n$limit end -complete -k -c j -a '(__history_completions)' -f +complete -k -c j -a '(__history_completions 25)' -f