kylechui / nvim-surround

Add/change/delete surrounding delimiter pairs with ease. Written with :heart: in Lua.
MIT License
2.92k stars 60 forks source link

On Highlight Functionality or Disable Cursor Line #265

Closed NotNullBool closed 1 month ago

NotNullBool commented 9 months ago

Checklist

Is your feature request related to a problem? Please describe. If possible, provide a sample buffer/keymap sequence, along with the expected result.

On highlight function feature.

Describe the solution you'd like A clear and concise description of what you want to happen.

I want to either have a way to be able to disable the column line and cursor line highlight or to have a function called when highlight is active.

So this can be more consistant to visual mode since I cant see the highlight because of my cursor line being too bright.

NotNullBool commented 9 months ago

I went ahead and forked it for the time being :)

kylechui commented 9 months ago

I imagine you could do something like this, which wouldn't require any modification to the plugin itself:

require("nvim-surround").setup({
    keymaps = {
        ys = "false",
    },
})
vim.keymap.set("n", "ys", function()
    -- Disable highlights here
    require("nvim-surround").normal_surround()
    -- Re-enable highlights here
end)

Edit: This won't work as is because of issues with g@, but I'll think about it some more later

kylechui commented 9 months ago

@NotNullBool Have you taken a look at NvimSurroundHighlight? I personally use:

vim.cmd.highlight("default link NvimSurroundHighlight Todo")

to make the highlights more visible.

NotNullBool commented 9 months ago

Yeah I thought about that but I wanted similar functionality to visual mode since that disables cursor line and cursor column temporarily

kylechui commented 9 months ago

Ah I see; that isn't exactly "intentional" behavior since the highlights just get auto-disabled whenever you enter visual mode. Maybe I'll add some callback function that takes in a selection and is called everytime some highlight event occurs, but I'm not sure yet.

NotNullBool commented 9 months ago

Thanks for hearing me out I really appreciate it! :)

kylechui commented 1 month ago

I think managing the highlights is not a key concern for this plugin, so I'll probably pass on implementing it "upstream". Your fork seems relatively simple and works, so I would suggest you keep that.