Merge branch 'fish-completion' of https://github.com/scorphus/kitty
This commit is contained in:
commit
e9975cb7eb
@ -387,6 +387,16 @@ The important thing above is to make sure the call to |kitty| to load the zsh
|
||||
completions happens after the call to :file:`compinit`.
|
||||
|
||||
|
||||
fish
|
||||
~~~~~~~~
|
||||
|
||||
Add the following to your :file:`~/.config/fish/config.fish`
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
kitty + complete setup fish | source
|
||||
|
||||
|
||||
Changelog
|
||||
------------------
|
||||
|
||||
|
||||
@ -56,6 +56,14 @@ kitty_completions() {
|
||||
}
|
||||
|
||||
complete -o nospace -F kitty_completions kitty
|
||||
''',
|
||||
'fish': '''
|
||||
function __kitty_completions
|
||||
# Send all words up to the one before the cursor
|
||||
commandline -cop | kitty +complete fish
|
||||
end
|
||||
|
||||
complete -f -c kitty -a "(__kitty_completions)"
|
||||
''',
|
||||
}
|
||||
|
||||
@ -86,6 +94,11 @@ def bash_input_parser(data):
|
||||
return words, new_word
|
||||
|
||||
|
||||
@input_parser
|
||||
def fish_input_parser(data):
|
||||
return data.rstrip().splitlines(), True
|
||||
|
||||
|
||||
@output_serializer
|
||||
def zsh_output_serializer(ans):
|
||||
lines = []
|
||||
@ -117,6 +130,16 @@ def bash_output_serializer(ans):
|
||||
# }}}
|
||||
|
||||
|
||||
@output_serializer
|
||||
def fish_output_serializer(ans):
|
||||
lines = []
|
||||
for matches in ans.match_groups.values():
|
||||
for word in matches:
|
||||
lines.append(shlex.quote(word))
|
||||
# debug('\n'.join(lines))
|
||||
return '\n'.join(lines)
|
||||
|
||||
|
||||
def completions_for_first_word(ans, prefix, entry_points, namespaced_entry_points):
|
||||
cmds = ['@' + c for c in cmap]
|
||||
ans.match_groups['Entry points'] = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user