2016-09-11 11:42:52 +08:00
|
|
|
# Note that when a completion file is sourced a new block scope is created so `set -l` works.
|
2021-10-18 10:27:46 +08:00
|
|
|
set -l __fish_history_all_commands search delete save merge clear clear-session
|
2016-08-24 08:52:40 +08:00
|
|
|
|
2020-08-18 11:10:06 +08:00
|
|
|
complete -c history -s h -l help -d "Display help and exit"
|
|
|
|
|
2016-09-11 11:42:52 +08:00
|
|
|
# Note that these options are only valid with the "search" and "delete" subcommands.
|
2021-12-27 05:48:49 +08:00
|
|
|
complete -c history -n '__fish_seen_subcommand_from search delete; or not __fish_seen_subcommand_from $__fish_history_all_commands' \
|
2016-09-11 11:42:52 +08:00
|
|
|
-s p -l prefix -d "Match items beginning with the string"
|
2021-12-27 05:48:49 +08:00
|
|
|
complete -c history -n '__fish_seen_subcommand_from search delete; or not __fish_seen_subcommand_from $__fish_history_all_commands' \
|
2016-09-11 11:42:52 +08:00
|
|
|
-s c -l contains -d "Match items containing the string"
|
2021-12-27 05:48:49 +08:00
|
|
|
complete -c history -n '__fish_seen_subcommand_from search delete; or not __fish_seen_subcommand_from $__fish_history_all_commands' \
|
2016-09-11 11:42:52 +08:00
|
|
|
-s e -l exact -d "Match items identical to the string"
|
2021-12-27 05:48:49 +08:00
|
|
|
complete -c history -n '__fish_seen_subcommand_from search delete; or not __fish_seen_subcommand_from $__fish_history_all_commands' \
|
2016-09-11 11:42:52 +08:00
|
|
|
-s t -l show-time -d "Output with timestamps"
|
2021-12-27 05:48:49 +08:00
|
|
|
complete -c history -n '__fish_seen_subcommand_from search delete; or not __fish_seen_subcommand_from $__fish_history_all_commands' \
|
2018-04-15 12:45:25 +08:00
|
|
|
-s C -l case-sensitive -d "Match items in a case-sensitive manner"
|
2020-08-18 11:10:06 +08:00
|
|
|
|
|
|
|
# Note that these options are only valid with the "search" subcommand.
|
2021-12-27 05:48:49 +08:00
|
|
|
complete -c history -n '__fish_seen_subcommand_from search; or not __fish_seen_subcommand_from $__fish_history_all_commands' \
|
2019-09-24 13:43:38 +08:00
|
|
|
-s n -l max -d "Limit output to the first 'n' matches" -x
|
2021-12-27 05:48:49 +08:00
|
|
|
complete -c history -n '__fish_seen_subcommand_from search; or not __fish_seen_subcommand_from $__fish_history_all_commands' \
|
2020-08-18 11:10:06 +08:00
|
|
|
-s z -l null -d "Terminate entries with NUL character"
|
2021-12-27 05:48:49 +08:00
|
|
|
complete -c history -n '__fish_seen_subcommand_from search; or not __fish_seen_subcommand_from $__fish_history_all_commands' \
|
2020-08-18 11:10:06 +08:00
|
|
|
-s R -l reverse -d "Output the oldest results first" -x
|
2016-09-11 11:42:52 +08:00
|
|
|
|
|
|
|
# We don't include a completion for the "save" subcommand because it should not be used
|
|
|
|
# interactively.
|
|
|
|
complete -f -c history -n "not __fish_seen_subcommand_from $__fish_history_all_commands" \
|
|
|
|
-a search -d "Prints commands from history matching the strings"
|
|
|
|
complete -f -c history -n "not __fish_seen_subcommand_from $__fish_history_all_commands" \
|
|
|
|
-a delete -d "Deletes commands from history matching the strings"
|
|
|
|
complete -f -c history -n "not __fish_seen_subcommand_from $__fish_history_all_commands" \
|
|
|
|
-a merge -d "Incorporate history changes from other sessions"
|
|
|
|
complete -f -c history -n "not __fish_seen_subcommand_from $__fish_history_all_commands" \
|
|
|
|
-a clear -d "Clears history file"
|
2021-10-18 10:27:46 +08:00
|
|
|
complete -f -c history -n "not __fish_seen_subcommand_from $__fish_history_all_commands" \
|
|
|
|
-a clear-session -d "Clears all history from the current session"
|