diff --git a/README.md b/README.md index ffba607..b1d65db 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ require('nvim-cursorline').setup { enable = true, min_length = 3, hl = { underline = true }, + insert_highlighting = true, } } ``` diff --git a/lua/nvim-cursorline.lua b/lua/nvim-cursorline.lua index d22c3e2..4bb37c6 100644 --- a/lua/nvim-cursorline.lua +++ b/lua/nvim-cursorline.lua @@ -18,6 +18,7 @@ local DEFAULT_OPTIONS = { enable = true, min_length = 3, hl = { underline = true }, + insert_highlighting = true, }, } @@ -91,11 +92,18 @@ function M.setup(options) matchadd() end, }) - au({ "CursorMoved", "CursorMovedI" }, { + au({ "CursorMoved" }, { callback = function() matchadd() end, }) + if M.options.cursorword.insert_highlighting then + au({ "CursorMovedI" }, { + callback = function() + matchadd() + end, + }) + end end end