Zalgorithm

Prevent snacks.nvim from highlighting the current word in insert mode

Lazyvim is great, but the way the word that’s being typed was being highlighted with a background color was driving me nuts. It took a while to track down what was going on.

This was hard to debug because I didn’t know what to search for. In plain language, as I was typing a word, depending on both the color scheme and the file extension, the word’s background color would be given a highlight color. For example, with the Catppuccin Latte color scheme, the background of the current word would be set to light grey. I found this disturbing. I want as few things as possible moving on the screen.

The cause of the issue was the snacks.words plugin . It’s one of the snacks.nvim plugins that’s enabled by default (I think) by LazyVim. .

I think I like some of the plugin’s functionality, but I don’t want it highlighting the current word in insert mode. The fix was to add a snacks-words.lua file to my Neovim config (~/.config/nvim/lua/plugins/snacks-words.lua):

return {
  "folke/snacks.nvim",
  opts = {
    -- snacks.words is what was causing the annoying highlighting of the current word in insert mode
    -- customizing it here to remove insert mode
    words = {
      modes = { "n", "c" },
    },
  },
}

Problem solved.