Skip to content
Discussion options

You must be logged in to vote

Improving on @alex-courtis answer:

vim.api.nvim_create_autocmd({ "WinEnter", "BufWinEnter" }, {
      callback = function(data)
        local tree_api = require("nvim-tree.api")
        local hl = vim.api.nvim_get_hl(0, { name = "Cursor", link = false })
        if tree_api.tree.is_tree_buf(data.buf) then
          vim.api.nvim_set_hl(0, "Cursor", { blend = 100, fg = hl.fg, bg = hl.bg })
          vim.opt_local.guicursor:append("a:Cursor/lCursor")
        else
          vim.api.nvim_set_hl(0, "Cursor", { blend = 0, fg = hl.fg, bg = hl.bg })
          vim.opt_local.guicursor:remove("a:Cursor/lCursor")
        end
      end,
})

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@alex-courtis
Comment options

Answer selected by vivitekk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants