Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn off Notifications? #13

Open
chrisgrieser opened this issue Apr 26, 2023 · 5 comments
Open

Turn off Notifications? #13

chrisgrieser opened this issue Apr 26, 2023 · 5 comments

Comments

@chrisgrieser
Copy link

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?

@NMAC427
Copy link
Owner

NMAC427 commented May 6, 2023

Are you seeing a notification every time you enter a buffer? Because when guess-indent sets up the autocommand, it should get executed silently.

@chrisgrieser
Copy link
Author

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

@NMAC427
Copy link
Owner

NMAC427 commented May 7, 2023

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.

@AlexSWall
Copy link

AlexSWall commented Dec 11, 2023

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.

@AlexSWall
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants