Skip to content

Commit

Permalink
rename to max_file_size_mb
Browse files Browse the repository at this point in the history
  • Loading branch information
stevalkr committed Nov 11, 2024
1 parent 1aad2d6 commit c3ac284
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion doc/oil.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
4 changes: 2 additions & 2 deletions lua/oil/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions lua/oil/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c3ac284

Please sign in to comment.