You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the size column, it shows "4.1k" for all directories regardless of their contents.
What is the severity of this bug?
minor (annoyance)
Steps To Reproduce
enable the size column
open directory with subdirectories inside
Expected Behavior
Although it is technically correct, 4096 being the size of the inode, I think it would be better to just hide the size if it does not represent the actual size of the contents.
Directory structure
test/
test/directory1/test.txt
test/directory2/
Repro
-- save as repro.lua-- run with nvim -u repro.lua-- DO NOT change the pathslocalroot=vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .reprofor_, nameinipairs({ "config", "data", "state", "runtime", "cache" }) dovim.env[("XDG_%s_HOME"):format(name:upper())] =root.."/" ..nameend-- bootstrap lazylocallazypath=root.."/plugins/lazy.nvim"ifnotvim.loop.fs_stat(lazypath) thenvim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
endvim.opt.runtimepath:prepend(lazypath)
-- install pluginslocalplugins= {
"folke/tokyonight.nvim",
{
"stevearc/oil.nvim",
config=function()
require("oil").setup({
columns= { "size", "icon" },
})
end,
},
-- add any other plugins here
}
require("lazy").setup(plugins, {
root=root.."/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
Did you check the bug with a clean config?
I have confirmed that the bug reproduces with nvim -u repro.lua using the repro.lua file above.
The text was updated successfully, but these errors were encountered:
The following change to the files adapter would hide the size if the entry type is a directory.
--- a/lua/oil/adapters/files.lua+++ b/lua/oil/adapters/files.lua@@ -65,7 +65,7 @@ file_columns.size = {
render = function(entry, conf)
local meta = entry[FIELD_META]
local stat = meta.stat
- if not stat then+ if not stat or stat.type == "directory" then
return columns.EMPTY
end
if stat.size >= 1e9 then
Note that this only works for this adapter, as I have not yet used the others.
I can make a PR with the change
ndfsa
changed the title
bug:
bug: all directory sizes show 4.1k
Sep 20, 2024
Did you check the docs and existing issues?
Neovim version (nvim -v)
v0.11.0-dev-771+g67d6b6f27
Operating system/version
Arch Linux
Describe the bug
When using the size column, it shows "4.1k" for all directories regardless of their contents.
What is the severity of this bug?
minor (annoyance)
Steps To Reproduce
Expected Behavior
Although it is technically correct, 4096 being the size of the inode, I think it would be better to just hide the size if it does not represent the actual size of the contents.
Directory structure
test/
test/directory1/test.txt
test/directory2/
Repro
Did you check the bug with a clean config?
nvim -u repro.lua
using the repro.lua file above.The text was updated successfully, but these errors were encountered: