smeikx / kitty-color-control

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Current State

This does not work well.

Have a look at my latest attempts of making this work more reliably and across platforms in the osc branch, and join the discussion if you really want this plugin to work or know how to improve it.

Neovim does not make it easy to send OSC to the terminal (without crashing). I have currently abandoned all efforts in favour of just writing my own color scheme. But feel free to fork and/or discuss, I am curious if there is a good solution to this.


Kitty Color Control

This simple plugin is made for usage in neovim’s TUI inside kitty; it does two things:

  • set the cursor’s foreground color according to neovim’s active color scheme
  • increase efficiency by setting the window’s background and foreground colors to the ones of the Normal highlight group, and setting the group’s colors to NONE

Prerequisites

You have to enable remote control. Optionally, also specify an address, if you have configured one, just set kitty_address in your init file, like this:

let g:kitty_address = 'unix:/tmp/hellokitty-$KITTY_PID'

Or with lua:

vim.g.kitty_address = 'unix:/tmp/hellokitty-$KITTY_PID'

Also, make sure to set guicursor, as demonstrated in neovim’s FAQ.

Quirks & Room for Improvement

As this plugin is a scratch to my personal itch, it does not cover all possible scenarios. In its current state it is just good enough.

  • This plugin depends on a POSIX compliant shell, grep, sed and tr.
  • When extracting colors from a set highlight group only guibg and guifg are considered.
  • The whole plugin is one single file. Maybe it should be more? (I don’t know about nvim plugin best practices).
  • There is more inline shell script than I like.
  • As it needs seven external commands and a subshell, all connected by pipe, to restore colors when leaving nvim, there is a noticable delay.
  • This is bearly tested (so far only on Linux, might try macOS later).

If you have an idea for improvemnt please create an issue to discuss it. If you also have the skills to do the improving yourself you are more than welcome to do so by creating a pull request.

About

License:MIT License


Languages

Language:Lua 100.0%