Julian / lean.nvim

neovim support for the Lean theorem prover
MIT License
248 stars 25 forks source link

feat(infoview): more buffer options #337

Closed MithicSpirit closed 3 months ago

MithicSpirit commented 3 months ago

Sets nocursorcolumn, colorcolumn="", and winfixbuf (when available). 'nocursorcolumn' and 'colorcolumn' are to prevent global options from affecting the infoview buffer (the former is for consistency with 'nocursorline', which is already present). 'winfixbuf' is a new feature in Neovim 0.10 that restricts the window to that particular buffer.

Closes #332.

Julian commented 3 months ago

Thanks.

0.10 has winfixbuf which kind of makes bufhidden irrelevant (as it doesn't allow the buffer to be switched). #332 is a reminder to set it.

I think we also already set buftype? I haven't tried in an isolated setup so it's possible it's something I do, but my infoviews are certainly already set to that. Are yours not?

I also personally don't set colorcolumn for any window with buftype=nofile, but I think it's fine to explicitly not set colorcolumn, but then why not do that directly rather than via textwidth?

The place to set it (along with any others of these we do go with) would be here alongside the other infoview options.

MithicSpirit commented 3 months ago

0.10 has winfixbuf which kind of makes bufhidden irrelevant (as it doesn't allow the buffer to be switched). #332 is a reminder to set it.

Good idea. Setting it now.

I think we also already set buftype? I haven't tried in an isolated setup so it's possible it's something I do, but my infoviews are certainly already set to that. Are yours not?

They seem to be, but grepping for buftype finds no matches. I guess some function is setting automatically.

I also personally don't set colorcolumn for any window with buftype=nofile, but I think it's fine to explicitly not set colorcolumn, but then why not do that directly rather than via textwidth?

I have 'colorcolumn' and 'textwidth' set globally, so it shows up independent of 'buftype' (which is buffer-local rather than window-local anyway). I was using 'textwidth' rather than 'colorcolumn' because I was having issues setting window-local options (in hindsight, that's probably because of opts), but using the file you linked below it seems to work.

The place to set it (along with any others of these we do go with) would be here alongside the other infoview options.

Ah, I didn't see this. Yeah, this is a lot better.

MithicSpirit commented 3 months ago

Hold on while I figure out why the 'winfixbuf' check isn't working for the macOS build.

MithicSpirit commented 3 months ago

Apparently 0 is truthy in Lua 🤦