071b8f8921cb2bbb1fcabbf3d271e77af0b12a7d

Author
Ian Chesal <ian.chesal@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(kitty): add plugin for the kitty terminal (#10994)

* A plugin for the Kitty terminal

Provides a handful of useful aliases for anyone working in a Kitty
terminal. In particular, the kssh command is handy for ensuring that
terminfo is set correctly on remote hosts when  you ssh to them.

* Guard kitty configuration

We should only load these aliases into a terminal that's identifying
itself as an xterm-kitty terminal. They're not useful in any other
situation.

Diff

 1diff --git a/plugins/kitty/README.md b/plugins/kitty/README.md
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..ec9e375de792b1f945404efc7798b98e2632b3eb
 4--- /dev/null
 5+++ b/plugins/kitty/README.md
 6@@ -0,0 +1,23 @@
 7+# Kitty plugin
 8+
 9+This plugin adds a few aliases and functions that are useful for users of the [Kitty](https://sw.kovidgoyal.net/kitty/) terminal.
10+
11+To use it, add _kitty_ to the plugins array of your zshrc file:
12+```
13+plugins=(... kitty)
14+```
15+
16+## Plugin commands
17+
18+* `kssh`
19+  Runs a kitten ssh session that ensures your terminfo settings are copied
20+  correctly to the remote hose.
21+* `kssh-slow`
22+  A slower form of `kssh` that should always work. Use this if `kssh` fails
23+  to set terminfo correctly for you on the remote host.
24+* `kitty-theme`
25+  Browse and change the theme of your Kitty terminal.
26+
27+## Contributors
28+
29+- [Ian Chesal](https://github.com/ianchesal)
30diff --git a/plugins/kitty/kitty.plugin.zsh b/plugins/kitty/kitty.plugin.zsh
31new file mode 100644
32index 0000000000000000000000000000000000000000..1094236a7c487fc5521736c23a3404505e32d920
33--- /dev/null
34+++ b/plugins/kitty/kitty.plugin.zsh
35@@ -0,0 +1,16 @@
36+#####################################################
37+# Kitty plugin for oh-my-zsh                        #
38+#####################################################
39+
40+if [[ "$TERM" == 'xterm-kitty' ]]; then
41+  ## kssh
42+  # Use this when your terminfo isn't recognized on remote hosts.
43+  # See: https://sw.kovidgoyal.net/kitty/faq/#i-get-errors-about-the-terminal-being-unknown-or-opening-the-terminal-failing-when-sshing-into-a-different-computer
44+  alias kssh="kitty +kitten ssh"
45+  compdef kssh='ssh'
46+  # Use this if kssh fails
47+  alias kssh-slow="infocmp -a xterm-kitty | ssh myserver tic -x -o \~/.terminfo /dev/stdin"
48+
49+  # Change the colour theme
50+  alias kitty-theme="kitty +kitten themes"
51+fi