mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 19:03:38 +08:00
Add history-based completions for autojump's j command
j does not have any "logical" source of completions, but it almost often called with arguments that have been seen before (since it is used to jump to favorite/recent directories). We can search the history for possible completions and use those. This is an example of the behavior mentioned in #4344 as a possible enhancement for fish 3.0, where completions can be provided from history if none are otherwise found.
This commit is contained in:
parent
46cf8c6bb7
commit
fa9e445342
6
share/completions/j.fish
Normal file
6
share/completions/j.fish
Normal file
|
@ -0,0 +1,6 @@
|
|||
function __history_completions
|
||||
set -l tokens (commandline --current-process --tokenize)
|
||||
history --prefix (commandline) | string replace -r \^$tokens[1]\\s\* ""
|
||||
end
|
||||
|
||||
complete -k -c j -a '(__history_completions)' -f
|
Loading…
Reference in New Issue
Block a user