Cursorword highlighting with callbacks support(I call this murmuring). Created with performance in mind.
Dynamic coloring of your cursorword:
demo_murmur_cursor_rgb.mov
IDE-like no blinking diagnostic message with cursor scope.
murmur_no_blinking_on_cursormoved.mov
Commented lines are the default.
localFOO='your_augroup_name'vim.api.nvim_create_augroup(FOO, { clear=true })
use {
'nyngwang/murmur.lua',
config=function ()
require('murmur').setup {
-- cursor_rgb = {-- guibg = '#393939',-- },-- cursor_rgb_always_use_config = false, -- if set to `true`, then always use `cursor_rgb`.-- yank_blink = {-- enabled = true,-- on_yank = nil, -- Can be customized. See `:h on_yank`.-- },max_len=80,
min_len=3, -- this is recommended since I prefer no cursorword highlighting on `if`.exclude_filetypes= {},
callbacks= {
-- to trigger the close_events of vim.diagnostic.open_float.function ()
-- Close floating diag. and make it triggerable again.vim.api.nvim_exec_autocmds("User", { pattern="MurmurDiagnostics" })
vim.w.diag_shown=falseend,
}
}
-- To create IDE-like no blinking diagnostic message with `cursor` scope. (should be paired with the callback above)vim.api.nvim_create_autocmd('CursorHold', {
group=FOO,
pattern='*',
callback=function ()
-- skip when a float-win already exists.ifvim.w.diag_shownthenreturnend-- open float-win when hovering on a cursor-word.ifvim.w.cursor_word~="" thenlocalbuf=vim.diagnostic.open_float({
scope="cursor",
-- Only close the window on InsertEnter and the explicit diagnostic close eventclose_events= { "InsertEnter", "User MurmurDiagnostics" },
})
-- If the window closes for any reason *other* than it being closed by a callback,-- make it triggerable againvim.api.nvim_create_autocmd("WinClosed", {
group=FOO,
buffer=buf,
once=true,
callback=function() vim.w.diag_shown=falseend,
})
vim.w.diag_shown=trueelsevim.w.diag_shown=falseendend
})
-- To create special cursorword coloring for the colortheme `typewriter-night`.-- remember to change it to the name of yours.vim.api.nvim_create_autocmd({ 'ColorScheme' }, {
group=FOO,
pattern='typewriter-night',
callback=function ()
vim.api.nvim_set_hl(0, "murmur_cursor_rgb", { fg="#0a100d", bg="#ffee32" })
end
})
end
}Extended from the original project: xiyaowong / nvim-cursorword
