Open chrisgrieser opened 1 year ago
Are you seeing a notification every time you enter a buffer? Because when guess-indent sets up the autocommand, it should get executed silently.
ah yes, I use nvim-notify to redirect all print
commands to a notification. (noice.nvim does a similar thing).
For whatever reason, it seems silent notifications still get redirected. Maybe the notification could be skipped alltogether when guess-indent is triggered via autocmd? Would save users like me the complications
I assume you overwrite the lua print function to achieve this (similar to this reddit post)? If this is the case, then I would suggest you to just filter out any messages that start with "Did set indentation to"
and "Failed to detect indentation style."
.
The way noice.nvim
redirects print/echo to notifications is using the vim.ui_attach
API, which does not suffer from this issue. Instead of overriding print you could use noice.nvim
in conjunction with nvim-notify
.
I'm actually getting this issue too, but only when I navigate using default Telescope file finders (e.g. :e
doesn't trigger this) and only when I have cmdheight = 0
set. But I don't get this issue when guess-indent.nvim
isn't installed; seems to be due to auto_cmd
being true
and the print
statements in set_indentation
. I'm not using any redirection of print
, nvim-notify
, or the like (that I know of). I'm using Neovim v0.9.4.
Seems like this is probably a Neovim issue, and not a guess-indent.nvim issue.
My workaround will be to set auto_cmd
to false
and implement my own setup_autocommands
, where instead of triggering on BufReadPost
the autocmd triggers on InsertEnter
. Not ideal, it obviously won't run before I've entered insert mode, but it fixes my issue and I just need something that isn't immediate, it seems.
I noticed that the plugin seems to creates a prints a notification every time it sets the indentation.
While that may be useful for when you manually run
:GuessIndent
or when the indentation values have been changed, it is a bit annoying when the notification appears every time you enter a new buffer, even if the indentation was already set correctly?