Implement completion for the kitty command

Implemented for bash and zsh. Completion scripts are just thin wrappers
around kitty + complete which knows how to complete kitty command lines.
Should make it easy to add completion for other shells in the future.
This commit is contained in:
Kovid Goyal
2018-08-26 10:39:51 +05:30
parent ff09bdcbf1
commit 42546f4371
5 changed files with 73 additions and 25 deletions

View File

@@ -14,6 +14,9 @@ Changelog
using standard keyboards) via `IBus
<https://github.com/ibus/ibus/wiki/ReadMe>`_ (:iss:`469`)
- Implement completion for the kitty command in bash and zsh. See
:ref:`completion`.
- Render the text under the cursor in a fixed color, configurable via
the option :opt:`cursor_text_color` (:iss:`126`)

View File

@@ -350,6 +350,39 @@ Frequently Asked Questions
The list of Frequently Asked Questions (*FAQ*) is :doc:`available here <faq>`.
.. _completion:
Completion for kitty
---------------------------------
|kitty| comes with completion for the ``kitty`` command for popular shells.
bash
~~~~~~~~
Add the following to your :file:`~/.bashrc`
.. code-block:: sh
source <(kitty + complete setup bash)
zsh
~~~~~~~~~
Add the following to your :file:`~/.zshrc`
.. code-block:: sh
autoload -Uz compinit
compinit
# Completion for kitty
kitty + complete setup zsh | source /dev/stdin
The important thing above is to make sure the call to |kitty| to load the zsh
completions happens after the call to :file:`compinit`.
Changelog
------------------