Giter Club home page Giter Club logo

kitty-color-control's Introduction

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.

kitty-color-control's People

Contributors

smeikx avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

kitty-color-control's Issues

How to debug

Hey @smeikx
Thank you for creating this, it is a feature that I miss a lot from Alacritty.
I was thinking of doing it for myself but never found a nice way to do it.
I installed the plugin but I don't see it working, is there a way to debug it?

This is what I have in the init.vim.

let g:kitty_address = 'unix:/tmp/mykitty-$KITTY_PID'
set guicursor=n-v-c:block-Cursor/lCursor,i-ci-ve:ver25-Cursor/lCursor,r-cr:hor20,o:hor50

I've also tried with let g:kitty_address = 'unix:/tmp/mykitty'

This is what I have in my kitty.conf

allow_remote_control yes
listen_on unix:/tmp/mykitty

I am running on macos and have sed, grep and tr installed. Is there an easy way to debug it?

Use Escape Sequences instead of Remote Control

Relevant codes are documented here: https://sw.kovidgoyal.net/kitty/faq/#how-do-i-change-the-colors-in-a-running-kitty-instance

Unfortunately, sending an ANSI escape sequence is not an easy task in nvim; so far I could not find a way to make it work.

Here is my question on Neovim’s forum: https://neovim.discourse.group/t/proper-way-of-sending-ansi-escape-sequences-to-containing-terminal-emulator/1324

Other relevant links:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.