Improve window options configurations#305
Conversation
| relativenumber = false, | ||
| foldcolumn = "0", | ||
| signcolumn = "no", | ||
| statuscolumn = "", |
There was a problem hiding this comment.
I added the statuscolumn option here and in other places because simply turning off the other column options won't clean the "side gutter" for folks using it. That being said, I think this option was introduced on NeoVim 0.9, and since Overseer supports NeoVim 0.8, I can remove the option from here if you prefer. Just let me know.
There was a problem hiding this comment.
I think it makes sense to add it, but we should add a check in util.set_window_opts so that it doesn't crash on neovim 0.8
## Changes Description This commit adds the ability to customize window options `vim.wo` for windows Overseer creates (e.g. the task_list, the output, etc.). It also fixes a problem where pre-defined window options are reset after the main buffer changes on the window.
stevearc
left a comment
There was a problem hiding this comment.
Thanks for the PR! Generally on board with the approach. Left some comments, and I've also refactored some of this logic recently so you'll need to resolve the merge conflicts.
| relativenumber = false, | ||
| foldcolumn = "0", | ||
| signcolumn = "no", | ||
| statuscolumn = "", |
There was a problem hiding this comment.
I think it makes sense to add it, but we should add a check in util.set_window_opts so that it doesn't crash on neovim 0.8
| -- When the Task List is positioned at the bottom, it will show its output | ||
| -- window on the right side of the split. The next configuration table | ||
| -- tweaks options for such window | ||
| output = { |
There was a problem hiding this comment.
Hmmm...putting the config here feels duplicative of the task_win key. Here's what I think makes the most sense:
- repurpose
task_winto be for all task output windows, not just the floating ones - put the current
task_winoptions undertask_win.floatto indicate that the configuration is for a subset of the task output windows that are floating - add some shims to
config.setupto maintain backwards compatibility
| -- The documentation of `vim.api.nvim_win_set_buf` states that it will | ||
| -- "Set the current buffer in a window, without side effects", but | ||
| -- unfortunately, some window options are not kept when a "new" buffer is | ||
| -- set to the window. For instance, the `winhighlight` and the experimental | ||
| -- `statuscolumn` options may change with a new buffer, therefore, to make | ||
| -- the appearance of the window consistent, we re-apply its window options | ||
| -- when switching its current buffer. |
There was a problem hiding this comment.
This behavior is explained if you read :help local-options. Maybe "without side effects" is a misleading claim in general, because there are a lot of things that can happen as a result of that call (autocmds, for instance).
| -- Set the filetype only after we enter the buffer so that FileType autocmds | ||
| -- behave properly | ||
| vim.bo[bufnr].filetype = "OverseerList" | ||
| vim.api.nvim_set_option_value("filetype", "OverseerList", { buf = bufnr }) |
There was a problem hiding this comment.
Why this change? The only reason I was using nvim_set_option_value for window options is because vim.wo updates the local and global option value.
|
I am interested in this too for customization. @Townk are you planning on finishing this or do you need help? |
Changes Description
This commit adds the ability to customize window options
vim.wofor windows Overseer creates (e.g. the task_list, the output, etc.). It also fixes a problem where pre-defined window options are reset after the main buffer changes on the window.