RRethy / vim-illuminate

illuminate.vim - (Neo)Vim plugin for automatically highlighting other uses of the word under the cursor using either LSP, Tree-sitter, or regex matching.
2.14k stars 47 forks source link

make navigation message optional #89

Closed debugloop closed 2 years ago

debugloop commented 2 years ago

Hi, thanks for this plugin!

I'm using the next_reference function in a mapping that accepts a count which forces me to acknowledge a number of messages by pressing any key. This PR optionally removes the message, using the same flag as https://github.com/lewis6991/gitsigns.nvim uses for its next_hunk function. I use the following code in my lspconfig's on_attach for reference:

require('illuminate').on_attach(client)
require('which-key').register({
  ["]i"] = { function() for i=1,vim.v.count1 do require('illuminate').next_reference({wrap=true, navigation_message=false}) end end, "jump to next reference" },
  ["[i"] = { function() for i=1,vim.v.count1 do require('illuminate').next_reference({wrap=true, reverse=true, navigation_message=false}) end end, "jump to previous reference" },
  ["<leader>it"] = { require('illuminate').toggle_pause, "illuminate: toggle updates" },
})

The perfect solution would be to just keep the last message, but I haven't found a way to do that yet.