Closed LintaoAmons closed 2 months ago
You can look here for how to configure cursor appearance in Wezterm, but that's all static.
I was able to setup a Neovim autocommand that changes cursor background based on ModeChanged
event. However, you probably shouldn't rely on the plugin for this. It's slow and would require you to explicitly manage all the mode change event pairs (entering + leaving mode). I think you could achieve better results from just Neovim (maybe this can give you some leads).
If you really want, this is what I got:
local au_group = vim.api.nvim_create_augroup('CursorChange', {clear = true})
vim.api.nvim_create_autocmd('Modechanged', {
group = au_group,
pattern = {'*:[iI\x16]*'}, -- enter Insert mode
callback = function()
local cursor_overrides = {
cursor_bg = 'red',
}
require('wezterm-config').set_wezterm_user_var('colors', cursor_overrides)
end,
})
vim.api.nvim_create_autocmd('Modechanged', {
group = au_group,
pattern = {'[iI\x16]*:*'}, -- exit Insert mode
callback = function()
local cursor_overrides = {
cursor_bg = 'blue',
}
require('wezterm-config').set_wezterm_user_var('colors', cursor_overrides)
end,
})
Thanks for your reply~ Let me try it out
I found that the cursor color is the color of the wezterm theme. Sorry I'm not very familiar with wezterm and don't know how to change the cursor color dynamically~ Can you give me some advise?
Not a issue(feel free to close it if you think it's not in the scope of this plugin)