Skip to content

Commit 114da56

Browse files
vahnrrphanen
authored andcommitted
feat(preview): builtin can list directory content
1 parent 657c1bb commit 114da56

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lua/fzf-lua/previewer/builtin.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,10 @@ function Previewer.buffer_or_file:populate_preview_buf(entry_str)
11111111
local fs_stat = entry.path and uv.fs_stat(entry.path)
11121112
if not fs_stat then
11131113
lines = { string.format("Unable to stat file %s", entry.path) }
1114+
elseif fs_stat.type == "directory" then
1115+
local cmd = utils._if_win({ "cmd.exe", "/c", "dir" }, { "ls", "-la" })
1116+
table.insert(cmd, entry.path)
1117+
lines, _ = utils.io_systemlist(cmd)
11141118
elseif fs_stat.size > 0 and utils.perl_file_is_binary(entry.path) then
11151119
lines = { "Preview is not supported for binary files." }
11161120
elseif tonumber(self.limit_b) > 0 and fs_stat.size > self.limit_b then

0 commit comments

Comments
 (0)