snacks.nvim icon indicating copy to clipboard operation
snacks.nvim copied to clipboard

bug: `Snacks.dashboard.pick('oldfiles')` opens `FzfLuz.oldfiles()` in `cwd` instead of root

Open RevengeRip opened this issue 1 month ago • 1 comments

Did you check docs and existing issues?

  • [x] I have read all the snacks.nvim docs
  • [x] I have updated the plugin to the latest version before submitting this issue
  • [x] I have searched the existing issues of snacks.nvim
  • [x] I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.11.5

Operating system/version

Arch Linux

Describe the bug

When you have FzfLua installed and open recent files with Snacks.dashboard.pick('oldfiles') (default entry for "Recent files" in vanilla snacks and LazyVim) it will open FzfLua.oldfiles in current working directory instead of root. That makes files in higher directories (/mnt, /etc) invisible in recent files. FzfLua.oldfiles() works just fine, showing all recent files from all folders.

Steps To Reproduce

  1. Open Neovim with snacks.nvim
  2. Press r to open "Recent files" or execute :lua Snacks.dashboard.pick('oldfiles')

Expected Behavior

Recent files should show all recent files, not only those that are relative to current working directory.

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    { "folke/snacks.nvim", opts = {} },
    -- add any other plugins here
  },
})

RevengeRip avatar Nov 16 '25 19:11 RevengeRip

I don't think that's a bug. LazyVim.pick explicitly sets cwd and that's why FzfLua is affected as well.

Easiest workaround to the best of my knowledge, is to change that shortcut yourself in your personal configuration like this

return {
  "folke/snacks.nvim",
  opts = {
    dashboard = {
      config = function(opts, _)
        table.insert(
          opts.preset.keys,
          { icon = " ", key = "r", desc = "Recent Files", action = ":FzfLua oldfiles" }
        )
      end,
    },
  },
}

Or this one

dashboard = {
        config = function(opts, _)
          opts.preset.pick = nil
        end,
      },

dpetka2001 avatar Nov 16 '25 22:11 dpetka2001