rasulomaroff / reactive.nvim

Reactivity. Right in your neovim.
Apache License 2.0
183 stars 1 forks source link

BUG: Overlapping StatusCol ?? Plus some questions #13

Closed ls-devs closed 4 months ago

ls-devs commented 4 months ago

Hi, I just installed reactive but it seems that there is an issue with statuscol , please see : Sans titre Sans titre_2

Also note that when loading Neovim and interring a buffer, relative always start like I'm already in insert (green cursorline + green cursor). When I switch mods, the cursor is staying with the color of the previous mod. Ex : I'm in insert mod : Cursor and CursorLine are green, I leave insert mode (back to normal) the cursorline change color but the cursor stay green. Can it be related to noice ?

Config :

return {
    "rasulomaroff/reactive.nvim",
    event = "BufReadPost",
    opts = {
        load = { "catppuccin-mocha-cursor", "catppuccin-mocha-cursorline" },
    },
}
rasulomaroff commented 4 months ago

Hi there @ls-devs! Regarding insert mode problem - it's not a reactive issue and as far as I remember it's a neovim issue that was fixed upstream. But you can try a temporary workaround (autocmd) from here #5, please let me know if that helped.

Regarding the statuscol. Could you please put additional lines in your config and tell me if that works?

try this:

opts = {
    load = { "catppuccin-mocha-cursor", "catppuccin-mocha-cursorline" },
    configs = {
        ["catppuccin-mocha-cursorline"] = {
            modes = {
                i = {
                    winhl = {
                        CursorLineSign = { bg = "#ffffff" }
                    }
                }
            }
        }
    }
}

I putted just a pure white color, but it's just to test that in the insert mode you'll see the white background for your cursor line sign columns.

I think I just forgot to highlight CursorLineSign group for catppuccin integration.

rasulomaroff commented 4 months ago

btw, just looking again at your screenshots, this can't be a CursorLineSign I guess, because it's on another side. Could you please clarify what plugin gives you those arrows?

ls-devs commented 4 months ago

@rasulomaroff Hi, The config you gave me for reactive gives this result : image

The autocmd from #5 did not work for me the cursor is still the same color as the previous mode + it's still starting like I'm already in insert mode. (like in the screenshot above).

btw, just looking again at your screenshots, this can't be a CursorLineSign I guess, because it's on another side. Could you please clarify what plugin gives you those arrows?

I was talking about statuscol.nvim, it's a plugin used with ufo.nvim ans this is what gives me those arrows (those are folds)

statuscol config if needed :

        {
            "luukvbaal/statuscol.nvim",
            lazy = true,
            event = { "BufReadPost", "BufNewFile" },
            opts = {
                relculright = true,
                setopt = true,
            },
            config = function(_, opts)
                require("statuscol").setup(vim.tbl_deep_extend("force", opts, {
                    segments = {
                        { text = { "%s" }, click = "v:lua.ScSa" },
                        { text = { require("statuscol.builtin").lnumfunc, " " }, click = "v:lua.ScLa" },
                        { text = { require("statuscol.builtin").foldfunc, "  " }, click = "v:lua.ScFa" },
                    },
                }))
            end,
        },
rasulomaroff commented 4 months ago

@ls-devs Yes, the result is expected because that sign column is on another side on your screenshot.

But actually I was thinking about another one. CursorLineFold - try this instead of CursorLineSign and it should work. If that works properly, I could update the catppuccin integration by including CursorLineFold group into that, but the problem is that in this case I'll need to include CursorLineSign group as well, because if I don't there will be a gap as on your screenshot because by default folds are on the very left position.

this is the default order if I remember it correctly Fold - Sign - LineNumber

As I don't use these type of plugins, I never thought about this highlight group.

Regarding that insert mode problem. Is it only highlighted as if you're in insert mode or you're literally in insert mode? This problem was happening when using Telescope + Reactive together and the autocmd from that discussion usually solved it

ls-devs commented 4 months ago

@rasulomaroff CursorLineFold is what we looking for :)

For the insert mode problem, it's highlighted as if I'm in insert mode, but I'm actually in normal mode. The autocmd do not solve the problem for me, unfortunately. Please see the video :

https://github.com/rasulomaroff/reactive.nvim/assets/58638832/e3340a75-3e8d-4b15-aeca-b9c2847f784d

rasulomaroff commented 4 months ago

@ls-devs if you could provide minimal repro, I would appreciate it Because I don't know how I can reproduce this issue :( If you disable noice, will the issue still persist?

ls-devs commented 4 months ago

@rasulomaroff Disabling noice does not change anything, the problem still persist.

I don't have any repro, and don't even know how to make one to be honest.

Maybe you can try my config that's located here : ls-devs/nvim

rasulomaroff commented 4 months ago

@ls-devs regarding CursorLineFold highlight group. I would recommend you to just link it to CursorLineNr for the modes you need it to. Because I think implementing that in catppuccin repo may be unnecessary as not everybody will like the result (area left to the line number will be highlighted as well), but I may be wrong? Maybe nobody really minds about it :D

For repro you can try a simple trick - kinda binary disabling. Disable the first half of your plugins (except reactive of course). If the issue persists - disable another half of previously remained one and so on till you don't find the culprit. You get the idea

Anyway, I'll try to use your config as soon as I have time for that.

Btw, just checked it - it's even easier in your case since your lazy config has imported modules (ui, preview, lsp, gittools etc). Try disabling them one by one and find a module from where the issue starts.

ls-devs commented 4 months ago

@rasulomaroff Linking CursorLineFold to CursorLineNr definitly helps to solve a part of the issue. But I found out there's a problem with git_signs highlighting

With git_signs : image

Without : image

For the insert mode problem, didn't found the real issue but manually pressing Escape before openning a file with Telescope solve the issue. Also, the cursor still stay in old mode color when going back to normal mode.

ls-devs commented 4 months ago

Hey @rasulomaroff I managed to fix all my issues, except for Telescope with reactive using this config :

return {
    "rasulomaroff/reactive.nvim",
    event = "VeryLazy",
    init = function()
        vim.cmd("hi link CursorLineFold CursorLineNr")
    end,
    opts = {
        load = { "catppuccin-mocha-cursor", "catppuccin-mocha-cursorline" },
        configs = {
            ["catppuccin-mocha-cursor"] = {
                modes = {
                    i = {
                        hl = {
                            ReactiveCursor = { bg = "none", fg = "#1e1e2e", blend = 0 },
                        },
                    },
                    n = {
                        hl = {
                            ReactiveCursor = { bg = "none", fg = "#1e1e2e", blend = 0 },
                        },
                    },

                    no = {
                        operators = {
                            d = {
                                hl = {
                                    ReactiveCursor = { bg = "none", fg = "#1e1e2e", blend = 0 },
                                },
                            },
                            y = {
                                hl = {
                                    ReactiveCursor = { bg = "none", fg = "#1e1e2e", blend = 0 },
                                },
                            },
                            c = {
                                hl = {
                                    ReactiveCursor = { bg = "none", fg = "#1e1e2e", blend = 0 },
                                },
                            },
                        },
                    },
                    R = {
                        hl = {
                            ReactiveCursor = { bg = "none", fg = "#1e1e2e", blend = 0 },
                        },
                    },
                    -- visual
                    [{ "v", "V", "\x16" }] = {
                        hl = {
                            ReactiveCursor = { bg = "none", fg = "#1e1e2e", blend = 0 },
                        },
                    },
                    -- select
                    [{ "s", "S", "\x13" }] = {
                        hl = {
                            ReactiveCursor = { bg = "none", fg = "#1e1e2e", blend = 0 },
                        },
                    },
                },
            },
        },
    },
}

It's fits me perfectly and it's working as I expect.

For Telescope, Idk what to really do, I checked if the autocmd is working and I can tell it's triggered. Unfortunately, and idk why, but it looks like Telescope still kind of open the buffer in insert mode or something like this. (not really in insert mode but seems triggering the mode change).

rasulomaroff commented 4 months ago

@ls-devs hi there! Yes telescope is very tricky with this. Especially when you just input the text, it changes modes for each keystroke. At least it did it when I was using it, maybe there's a special reason for that.

But the key thing is that I never actually got that error, I just can't reproduce it at all (the one with insert mode)

If you just leave telescope and reactive, will the issue still persist? If so, can you send me your congifs of these plugins?

ls-devs commented 4 months ago

@rasulomaroff I tried disabling my plugins directories one by one. And I found that if I disable ethanholz/nvim-lastplace the issue is now gone.

ls-devs commented 4 months ago

I'll now close this issue since it's no more related to reactive. Thanks for all your help, love your plugin :)

rasulomaroff commented 4 months ago

@ls-devs as far as I can see the only purpose of nvim-lastplace is to get you back to place you were editing last in the file?

For that I just use a simple autocmd, which doesn't create those issues btw

take a look:

Alacritty 2024-04-06 at 15-20

ls-devs commented 4 months ago

@rasulomaroff Yes so I decided to switch for an autocmd too. This is the one I use :

                {
                    "BufWinEnter",
                    function()
                        local mark = vim.api.nvim_buf_get_mark(0, '"')
                        local lcount = vim.api.nvim_buf_line_count(0)
                        if mark[1] > 0 and mark[1] <= lcount then
                            pcall(vim.api.nvim_win_set_cursor, 0, mark)
                        end
                    end,
                    opts = {
                        pattern = "*",
                    },
                    description = "Remember last place",
                },

Thanks for sharing, will try it :)