Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: using columns with { "mtime", format = "... %l" } causes actions.select to fail #582

Closed
3 tasks done
donniebreve opened this issue Feb 9, 2025 · 1 comment
Closed
3 tasks done
Labels
bug Something isn't working

Comments

@donniebreve
Copy link

donniebreve commented Feb 9, 2025

Did you check the docs and existing issues?

  • I have read the docs
  • I have searched the existing issues

Neovim version (nvim -v)

0.10.4

Operating system/version

Linux

Describe the bug

When using the columns configuration option and adding { "mtime", format = "... %l" }, actions.select prompts to "Save changes?" when executed. Selecting "Y" opens a file with a name containing permissions, size, mdate, etc. Selecting "N" shows an empty oil buffer.

The date formatting works.

return {
  "stevearc/oil.nvim",
  lazy = false,
  dependencies = { "nvim-tree/nvim-web-devicons" },
  opts = {
    --columns = { "icon" }, -- working
    --columns = { "icon", "permissions" }, -- working
    --columns = { "icon", "permissions", "size" }, -- working
    --columns = { "icon", "permissions", "size", "mtime" }, -- working
    columns = { "icon", "permissions", "size", { "mtime", format = "%b %d %l:%M %p" } }, -- not working
  }
}

What is the severity of this bug?

tolerable (can work around it)

Steps To Reproduce

  1. nvim -u repro.lua
  2. :Oil
  3. -
  4. Move to a directory, <cr>

Expected Behavior

The directory or file should be opened.

Directory structure

No response

Repro

-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  {
    "stevearc/oil.nvim",
    dependencies = { "nvim-tree/nvim-web-devicons" },
    opts = {
      --columns = { "icon" }, -- working
      --columns = { "icon", "permissions" }, -- working
      --columns = { "icon", "permissions", "size" }, -- working
      --columns = { "icon", "permissions", "size", "mtime" }, -- working
      columns = { "icon", "permissions", "size", { "mtime", format = "%b %d %l:%M %p" } },     -- not working
    }
  }
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

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.

Great plugin, love it! Thanks!

@donniebreve donniebreve added the bug Something isn't working label Feb 9, 2025
@donniebreve donniebreve changed the title bug: using columns causes actions.select to fail bug: using columns with { "mtime", format = "..." } causes actions.select to fail Feb 9, 2025
@donniebreve donniebreve changed the title bug: using columns with { "mtime", format = "..." } causes actions.select to fail bug: using columns with { "mtime", format = "... %l" } causes actions.select to fail Feb 9, 2025
@stevearc
Copy link
Owner

Should be fixed now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants