refactor: rename 'preview' config to 'preview_win'
This commit is contained in:
parent
1f5b002270
commit
eb5497f0ac
4 changed files with 10 additions and 6 deletions
|
|
@ -268,7 +268,7 @@ require("oil").setup({
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
-- Configuration for the file preview window
|
-- Configuration for the file preview window
|
||||||
preview = {
|
preview_win = {
|
||||||
-- Whether the preview window is automatically updated when the cursor is moved
|
-- Whether the preview window is automatically updated when the cursor is moved
|
||||||
update_on_cursor_moved = true,
|
update_on_cursor_moved = true,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ CONFIG *oil-confi
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
-- Configuration for the file preview window
|
-- Configuration for the file preview window
|
||||||
preview = {
|
preview_win = {
|
||||||
-- Whether the preview window is automatically updated when the cursor is moved
|
-- Whether the preview window is automatically updated when the cursor is moved
|
||||||
update_on_cursor_moved = true,
|
update_on_cursor_moved = true,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ local default_config = {
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
-- Configuration for the file preview window
|
-- Configuration for the file preview window
|
||||||
preview = {
|
preview_win = {
|
||||||
-- Whether the preview window is automatically updated when the cursor is moved
|
-- Whether the preview window is automatically updated when the cursor is moved
|
||||||
update_on_cursor_moved = true,
|
update_on_cursor_moved = true,
|
||||||
},
|
},
|
||||||
|
|
@ -221,7 +221,7 @@ default_config.adapter_aliases = {}
|
||||||
---@field extra_scp_args string[]
|
---@field extra_scp_args string[]
|
||||||
---@field git oil.GitOptions
|
---@field git oil.GitOptions
|
||||||
---@field float oil.FloatWindowConfig
|
---@field float oil.FloatWindowConfig
|
||||||
---@field preview oil.PreviewWindowConfig
|
---@field preview_win oil.PreviewWindowConfig
|
||||||
---@field confirmation oil.ConfirmationWindowConfig
|
---@field confirmation oil.ConfirmationWindowConfig
|
||||||
---@field progress oil.ProgressWindowConfig
|
---@field progress oil.ProgressWindowConfig
|
||||||
---@field ssh oil.SimpleWindowConfig
|
---@field ssh oil.SimpleWindowConfig
|
||||||
|
|
@ -249,7 +249,7 @@ local M = {}
|
||||||
---@field extra_scp_args? string[] Extra arguments to pass to SCP when moving/copying files over SSH
|
---@field extra_scp_args? string[] Extra arguments to pass to SCP when moving/copying files over SSH
|
||||||
---@field git? oil.SetupGitOptions EXPERIMENTAL support for performing file operations with git
|
---@field git? oil.SetupGitOptions EXPERIMENTAL support for performing file operations with git
|
||||||
---@field float? oil.SetupFloatWindowConfig Configuration for the floating window in oil.open_float
|
---@field float? oil.SetupFloatWindowConfig Configuration for the floating window in oil.open_float
|
||||||
---@field preview? oil.SetupPreviewWindowConfig Configuration for the file preview window
|
---@field preview_win? oil.SetupPreviewWindowConfig Configuration for the file preview window
|
||||||
---@field confirmation? oil.SetupConfirmationWindowConfig Configuration for the floating action confirmation window
|
---@field confirmation? oil.SetupConfirmationWindowConfig Configuration for the floating action confirmation window
|
||||||
---@field progress? oil.SetupProgressWindowConfig Configuration for the floating progress window
|
---@field progress? oil.SetupProgressWindowConfig Configuration for the floating progress window
|
||||||
---@field ssh? oil.SetupSimpleWindowConfig Configuration for the floating SSH window
|
---@field ssh? oil.SetupSimpleWindowConfig Configuration for the floating SSH window
|
||||||
|
|
@ -381,6 +381,10 @@ M.setup = function(opts)
|
||||||
if opts.preview and not opts.confirmation then
|
if opts.preview and not opts.confirmation then
|
||||||
new_conf.confirmation = vim.tbl_deep_extend("keep", opts.preview, default_config.confirmation)
|
new_conf.confirmation = vim.tbl_deep_extend("keep", opts.preview, default_config.confirmation)
|
||||||
end
|
end
|
||||||
|
-- Backwards compatibility. We renamed the 'preview' config to 'preview_win'
|
||||||
|
if opts.preview and opts.preview.update_on_cursor_moved ~= nil then
|
||||||
|
new_conf.preview_win.update_on_cursor_moved = opts.preview.update_on_cursor_moved
|
||||||
|
end
|
||||||
|
|
||||||
if new_conf.lsp_rename_autosave ~= nil then
|
if new_conf.lsp_rename_autosave ~= nil then
|
||||||
new_conf.lsp_file_methods.autosave_changes = new_conf.lsp_rename_autosave
|
new_conf.lsp_file_methods.autosave_changes = new_conf.lsp_rename_autosave
|
||||||
|
|
|
||||||
|
|
@ -407,7 +407,7 @@ M.initialize = function(bufnr)
|
||||||
|
|
||||||
constrain_cursor()
|
constrain_cursor()
|
||||||
|
|
||||||
if config.preview.update_on_cursor_moved then
|
if config.preview_win.update_on_cursor_moved then
|
||||||
-- Debounce and update the preview window
|
-- Debounce and update the preview window
|
||||||
if timer then
|
if timer then
|
||||||
timer:again()
|
timer:again()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue