diff --git a/README.md b/README.md index 47328a3e..79b96362 100644 --- a/README.md +++ b/README.md @@ -272,7 +272,7 @@ require("oil").setup({ -- Whether the preview window is automatically updated when the cursor is moved update_on_cursor_moved = true, -- Maximum file size in megabytes to preview - max_file_size = 100, + max_file_size_mb = 100, }, -- Configuration for the floating action confirmation window confirmation = { diff --git a/doc/oil.txt b/doc/oil.txt index f0f81d92..32830365 100644 --- a/doc/oil.txt +++ b/doc/oil.txt @@ -157,7 +157,7 @@ CONFIG *oil-confi -- Whether the preview window is automatically updated when the cursor is moved update_on_cursor_moved = true, -- Maximum file size in megabytes to preview - max_file_size = 100, + max_file_size_mb = 100, }, -- Configuration for the floating action confirmation window confirmation = { diff --git a/lua/oil/config.lua b/lua/oil/config.lua index 76a45d7c..4d7cf489 100644 --- a/lua/oil/config.lua +++ b/lua/oil/config.lua @@ -142,7 +142,7 @@ local default_config = { -- Whether the preview window is automatically updated when the cursor is moved update_on_cursor_moved = true, -- Maximum file size in megabytes to preview - max_file_size = 100, + max_file_size_mb = 100, }, -- Configuration for the floating action confirmation window confirmation = { @@ -330,7 +330,7 @@ local M = {} ---@class (exact) oil.SetupPreviewWindowConfig ---@field update_on_cursor_moved? boolean Whether the preview window is automatically updated when the cursor is moved ----@field max_file_size? number Maximum file size in megabytes to preview +---@field max_file_size_mb? number Maximum file size in megabytes to preview ---@class (exact) oil.SetupConfirmationWindowConfig : oil.SetupWindowConfig diff --git a/lua/oil/init.lua b/lua/oil/init.lua index c04c81c5..ab050114 100644 --- a/lua/oil/init.lua +++ b/lua/oil/init.lua @@ -453,8 +453,8 @@ M.open_preview = function(opts, callback) return finish("Could not find entry under cursor") end if entry.meta ~= nil or entry.meta.stat ~= nil then - if entry.meta.stat.size >= config.preview.max_file_size * 1e6 then - return finish("File over " .. config.preview.max_file_size .. "MB is too large to preview ") + if entry.meta.stat.size >= config.preview.max_file_size_mb * 1e6 then + return finish("File over " .. config.preview.max_file_size_mb .. "MB is too large to preview ") end end local entry_title = entry.name