mawkler / modicator.nvim

Cursor line number mode indicator plugin for Neovim
MIT License
298 stars 6 forks source link

Suppress warnings and disable plugin functionality for non-modifiable buffers. #31

Closed Peglah closed 5 months ago

Peglah commented 5 months ago

Good for when you use Neovim to view man pages among other things.

mawkler commented 5 months ago

Hi @Peglah and thank you for contributing to Modicator!

However, modicator doesn't check the modifiable option, so it should never warn about it already. Also, I'm not sure that I agree that Modicator should be disabled in buffers where modifiable = false, since it is still possible to switch between Normal and Visual mode.

Could you please elaborate on any issues that your were having when viewing man pages that lead you to create this PR? I don't have any issues doing :Man nvim with modicator.nvim on main.

Peglah commented 5 months ago

Hi @mawkler and thank you for looking at my PR.

These are the steps I've taken: Installed modicator with lazy.nvim (just default config) according to the modicator readme. Set Neovim as manpager with export MANPAGER='nvim +Man!' as stated in help:filetype.

When I run man nvim from the terminal I get the warning: modicator.nvim: modicator requires `number` to be set. Run `:set number` or add `vim.o.number = true` to your init.lua.

I realize I can export MANPAGER="nvim +Man! -c 'set number'" to force the numbers again but I would prefer to look at man pages without numbering. I didn't know about the visual mode in non-modifiable buffers and it really is a valid point, hence I no longer think modicator should be disabled.

Can you replicate my issue? What are your thoughts?

mawkler commented 5 months ago

@Peglah Those warnings you were seeing are just to help you with setting up Modicator. Modicator continues to work for buffers other than :Man (which disables those options for just that buffer) so you can ignore the warnings. I have pushed a commit that sets the show_warnings option to false by default, so you should no longer be seeing the warnings. Let me know if you have any more issues!

Peglah commented 5 months ago

@mawkler I understand the reasoning for having the warnings. It's a nice help for new users. 0140310 solved all my issues. Thank you very much!