Replies: 1 comment
-
Nice catch. I am pretty sure that is a bug. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In the previewer for directories, the
ls
/vim.fs.dir
is called over theitem.file
, which means, that the value initem.file
needs to be relative to thecwd
of nvim or an absolute path:snacks.nvim/lua/snacks/picker/preview.lua
Line 15 in bc0630e
Meaning, that setting
item.cwd
to a value is not taken into account at this point.Just before this loop, the full path for the item is stored in a
path
variable:snacks.nvim/lua/snacks/picker/preview.lua
Line 11 in bc0630e
I think it would make sense, for the loop to use that variable instead. Does someone know a reason why it would be a bad idea to use
path
instead ofctx.item.file
here?Why this came up as a problem for me was, because I am trying to create a picker, which searches through directories and opens them in Oil.nvim. And as with the other file based pickers (
files
andgrep
) I added a section, which sets thecwd
of the picker to the current oil directory if available. Meaning that I can navigate to a directory in Oil and then my file, grep and directory searches should start from that directory. With thefiles
andgrep
pickers settingcwd
worked, but with my directory picker the preview only works when the cwd is the same as the nvim cwd.Maybe I just made a mistake somewhere else in my picker creation, so here's the script for it:
Beta Was this translation helpful? Give feedback.
All reactions