Fish: Use variables for completion options

This commit is contained in:
Roman Inflianskas 2015-05-04 11:58:58 +03:00 committed by Paul Beckingham
parent 69698454c3
commit e16bd6ee83

View file

@ -15,6 +15,24 @@
# * Tags # * Tags
# * Attribute names and modifiers # * Attribute names and modifiers
# #
#
# You can override some default options in your config.fish:
#
# # Tab-completion of task descriptions.
# # Warning: This often creates a list of suggestions which spans several pages,
# # and it usually pushes some of the commands and attributes to the end of the
# # list.
# set -g task_complete_task yes
#
# # Tab-completion of task IDs outside of the "depends" attribute.
# # Warning: This often creates a list of suggestions which spans several pages,
# # and it pushes all commands and attributes to the end of the list.
# set -g task_complete_id yes
#
# # Attribute modifiers (DEPRECATED since 2.4.0)
# set -g task_complete_attribute_modifiers yes
#
#
# Copyright 2014 - 2015, Roman Inflianskas <infroma@gmail.com> # Copyright 2014 - 2015, Roman Inflianskas <infroma@gmail.com>
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
@ -150,8 +168,7 @@ function __fish.task.list.attr_value_by_name
__fish.task.combos_simple $attr (__fish.task.list $attr) __fish.task.combos_simple $attr (__fish.task.list $attr)
# case 'description' 'due' 'entry' 'end' 'start' 'project' 'recur' 'until' 'wait' # case 'description' 'due' 'entry' 'end' 'start' 'project' 'recur' 'until' 'wait'
case '*' case '*'
# BUG: remove in 2.4.0 if [ "$task_complete_attribute_modifiers" = 'yes' ]; and echo (commandline -ct) | grep -q '\.'
if echo (commandline -ct) | grep -q '\.'
__fish.task.combos_with_mods $attr (__fish.task.list $attr) __fish.task.combos_with_mods $attr (__fish.task.list $attr)
else else
__fish.task.combos_simple $attr (__fish.task.list $attr) __fish.task.combos_simple $attr (__fish.task.list $attr)
@ -195,7 +212,7 @@ function __fish.task.list.id
end end
end end
# BUG: remove in 2.4.0 # Attribure modifiers (DEPRECATED since 2.4.0)
function __fish.task.list.mod function __fish.task.list.mod
for mod in 'before' 'after' 'over' 'under' 'none' 'is' 'isnt' 'has' 'hasnt' 'startswith' 'endswith' 'word' 'noword' for mod in 'before' 'after' 'over' 'under' 'none' 'is' 'isnt' 'has' 'hasnt' 'startswith' 'endswith' 'word' 'noword'
echo $mod echo $mod
@ -266,7 +283,7 @@ function __fish.task.combos_simple
end end
end end
# BUG: remove in 2.4.0 # Attribure modifiers (DEPRECATED since 2.4.0)
function __fish.task.combos_with_mods function __fish.task.combos_with_mods
__fish.task.combos_simple $argv __fish.task.combos_simple $argv
for mod in (__fish.task.list.mod) for mod in (__fish.task.list.mod)
@ -290,16 +307,10 @@ __fish.task.complete attr_value
__fish.task.complete attr_name __fish.task.complete attr_name
__fish.task.complete config __fish.task.complete config
# Uncomment the following line if you want tab-completion of task descriptions. if [ "$task_complete_task" = 'yes' ]
# Warning: This often creates a list of suggestions which spans several pages, __fish.task.complete task
# and it usually pushes some of the commands and attributes to the end of the end
# list.
#__fish.task.complete task if [ "$task_complete_id" = 'yes' ]
__fish.task.complete id with_description
# Uncomment the following line if you want tab-completion of task IDs outside end
# of the "depends" attribute. Warning: This often creates a list of
# suggestions which spans several pages, and it pushes all commands and
# attributes to the end of the list.
#__fish.task.complete id with_description