-
Notifications
You must be signed in to change notification settings - Fork 130
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
feat: add win_options
to preview_win
#514
Conversation
Hm, not sure what happened with the "failed" test. I checked the logs and it seems to be passing and locally it seems to pass |
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...not sure what's going on with the tests. Does it pass for you locally? I've sometimes seen some finicky behavior like this if there are timeouts in an async test.
edit: ah okay yes it does pass locally. Not sure...try rebasing (which you'll have to do for merge conflicts anyway)
lua/oil/config.lua
Outdated
@@ -323,6 +323,7 @@ local M = {} | |||
|
|||
---@class (exact) oil.PreviewWindowConfig | |||
---@field update_on_cursor_moved boolean | |||
---@field win_options? table<string, any> |
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.
You'll want this one to omit the ?
and you'll need to also add this to oil.SetupPreviewWindowConfig
. This is the internal reference for type safety, the other one is for typing the options passed to setup()
. It's annoying to keep them both in sync, but it's the only way I could think of to get good type safety (and LuaLS completions) in both locations.
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.
Ah that makes sense, thanks for the guidance here. I updated the commit appropriately
24890f8
to
9cebd6d
Compare
9cebd6d
to
c96f1b4
Compare
It looks like something is causing it to hang after the tests all pass. I'm not sure what it would be doing after all the tests are done. I'm taking a deeper look now at how the tests are set up. I don't think anything is happening in this PR to make things get funky 🤔 |
EDIT: this is coming from the |
c96f1b4
to
7011a9b
Compare
Ah, I found the problem @stevearc it was causing problems because I was a dingus and forgot to update the default |
Thanks for the PR! |
Hi @mehalter ! Thanks for this cool contribution! One question wrt this PR: I set require("oil").setup({
preview_win = {
win_options = {
foldenable = false,
},
}
}) and it works as long as the preview buffer has no focus and I stay in the oil buffer with the list of dir contents. Thanks,
|
I'm not sure, just want to remove whatever is in your configuration that is setting foldenabled when entering a buffer |
Maybe |
This adds the ability to customize the window options for the preview window for files/directories. This takes a very basic approach, outside of just adding the
win_options
field to the lua type annotations it makes sure to set thewin_options
when creating thepreviewwindow
windows. The other wrinkle it accounts for is to make sure to apply thepreview_win.win_options
after applying oilwin_options
if it's within apreviewwindow
. This makes sure it gets the necessary settings such asconceal
andconcealcursor
while also applying the settings that the user wants for preview windows.Let me know what you think of this approach!
Resolves #509