-
Notifications
You must be signed in to change notification settings - Fork 63
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
Improve window options configurations #305
base: master
Are you sure you want to change the base?
Conversation
relativenumber = false, | ||
foldcolumn = "0", | ||
signcolumn = "no", | ||
statuscolumn = "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm...putting the config here feels duplicative of the task_win
key. Here's what I think makes the most sense:
- repurpose
task_win
to be for all task output windows, not just the floating ones - put the current
task_win
options undertask_win.float
to indicate that the configuration is for a subset of the task output windows that are floating - add some shims to
config.setup
to 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).
vim.api.nvim_win_set_width(0, layout.calculate_width(nil, config.task_list)) | ||
if direction == "bottom" then | ||
vim.api.nvim_win_set_height(0, layout.calculate_height(nil, config.task_list)) | ||
end | ||
-- 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.