Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin breaks kitty protocol (existing workaround) #181

Open
matu3ba opened this issue Nov 13, 2023 · 2 comments
Open

plugin breaks kitty protocol (existing workaround) #181

matu3ba opened this issue Nov 13, 2023 · 2 comments

Comments

@matu3ba
Copy link

matu3ba commented Nov 13, 2023

Minimal reproducible:

-- nvim --clean -u mini.lua -c quit
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
  "marko-cerovac/material.nvim",
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})
vim.cmd.colorscheme("material")

Yet unhelpful manifestation: Executing nvim --clean -u mini.lua -c quit breaks ghostty.
I will update this issue with more information how to debug/inspect the underlying issue based on provided feedback.

@matu3ba
Copy link
Author

matu3ba commented Nov 14, 2023

Still no feedback yet. :( Got feedback, but it was unconclusive regarding how to debug the neovim behavior.

Anyhow, I have a more minimal reproducible and it looks like "Disable the colored cursor" fixes the problem:

require('material').setup({
    disable = {
        colored_cursor = true, -- Disable the colored cursor (enabled colored cursor breaks things)
    },
})

I could reduce some more functions and it looks like the cleanup is somehow messed up:

M.load = function()
    vim.g.colors_name     = "material"
    vim.opt.termguicolors = true
    vim.opt.background = "dark"

    vim.opt.guicursor = "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20,a:Cursor/Cursor"
    local exit_group  = vim.api.nvim_create_augroup("MaterialExit", { clear = true })
    vim.api.nvim_create_autocmd("ExitPre", {
        command = "autocmd ExitPre * set guicursor=n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20",
        group   = exit_group
    })

    -- apply highlights one by one
    for _, highlights_fn in pairs(highlights.main_highlights) do
        for name, values in pairs(highlights_fn()) do
            vim.api.nvim_set_hl(0, name, values)
        end
    end
end

@marko-cerovac
Copy link
Owner

Yes, I suspected that it would be the cursor. When the colorscheme changes the cursor color and you exit nvim, the cursor color stays the same. That autogrup is there to revert the cursor back to it's default color before nvim exits. For some reason Kitty just doesn't play nice with this option. I think it's an issue between neovim and kitty but I'll look into this in the next couple of days. The solution, for now, is to disable the colored cursor as you already found out. I'll keep you updated.

@matu3ba matu3ba changed the title plugin breaks kitty protocol (will be updated with more information) plugin breaks kitty protocol (existing workaround) May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants