diff --git a/README.md b/README.md index 4d91f1d..85b5f01 100644 --- a/README.md +++ b/README.md @@ -268,7 +268,7 @@ require("oil").setup({ end, }, -- Configuration for the file preview window - preview = { + preview_win = { -- Whether the preview window is automatically updated when the cursor is moved update_on_cursor_moved = true, }, diff --git a/doc/oil.txt b/doc/oil.txt index cafd61e..03b7bc3 100644 --- a/doc/oil.txt +++ b/doc/oil.txt @@ -153,7 +153,7 @@ CONFIG *oil-confi end, }, -- Configuration for the file preview window - preview = { + preview_win = { -- Whether the preview window is automatically updated when the cursor is moved update_on_cursor_moved = true, }, diff --git a/lua/oil/config.lua b/lua/oil/config.lua index bcb7225..31e25f2 100644 --- a/lua/oil/config.lua +++ b/lua/oil/config.lua @@ -138,7 +138,7 @@ local default_config = { end, }, -- Configuration for the file preview window - preview = { + preview_win = { -- Whether the preview window is automatically updated when the cursor is moved update_on_cursor_moved = true, }, @@ -221,7 +221,7 @@ default_config.adapter_aliases = {} ---@field extra_scp_args string[] ---@field git oil.GitOptions ---@field float oil.FloatWindowConfig ----@field preview oil.PreviewWindowConfig +---@field preview_win oil.PreviewWindowConfig ---@field confirmation oil.ConfirmationWindowConfig ---@field progress oil.ProgressWindowConfig ---@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 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 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 progress? oil.SetupProgressWindowConfig Configuration for the floating progress 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 new_conf.confirmation = vim.tbl_deep_extend("keep", opts.preview, default_config.confirmation) 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 new_conf.lsp_file_methods.autosave_changes = new_conf.lsp_rename_autosave diff --git a/lua/oil/view.lua b/lua/oil/view.lua index bf34e8b..da404a3 100644 --- a/lua/oil/view.lua +++ b/lua/oil/view.lua @@ -407,7 +407,7 @@ M.initialize = function(bufnr) 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 if timer then timer:again()