feat(plugin): Add ghostty-copypaste plugin

This commit is contained in:
Louis Rubet 2025-10-07 18:03:46 +02:00
commit 176d528f97
2 changed files with 58 additions and 0 deletions

View file

@ -0,0 +1,15 @@
# zsh-ghostty-copypaste
[ghostty](https://ghostty.org/) users, this `zsh` plugin allows you to copy / paste a text selected with the keyboard with `ctrl+shift+c` / `ctrl+shift+v`.
To use it, add `ghostty-copypaste` to the plugins array of your `.zshrc` file:
```
plugins=(... ghostty-copypaste)
```
## Principle
- `ghossty` allows to copy / paste a text selected with the mouse, but not with the keyboard, because this is an action devoted to a terminal (`zsh`) and not to a terminal emulator (`ghostty`).
- When no mouse selection is started, `ghostty` passes a Control Sequence Introducer `^[[99;6u` / `^[[118;6u` to `zsh`. The plugin binds these CSI to the correct copy / paste functions for X11 or Wayland.
- Be careful, `ghostty` can lose focus when copying and pasting because of `xclip` or `wl-copy`/`wl-paste` in the plugin. If you use it as a context terminal ("quake"), it is best not to close it when it loses focus.