From 57a7769845fba5df8beef692695363933c0c6ae0 Mon Sep 17 00:00:00 2001 From: Simon Hauser Date: Mon, 16 Nov 2020 21:43:31 +0100 Subject: [PATCH] Fix #250 (#251) --- lua/telescope/previewers.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/telescope/previewers.lua b/lua/telescope/previewers.lua index 29442fa..705b73d 100644 --- a/lua/telescope/previewers.lua +++ b/lua/telescope/previewers.lua @@ -22,12 +22,12 @@ local bat_options = {"--style=plain", "--color=always", "--paging=always"} local has_less = (vim.fn.executable('less') == 1) and config.values.use_less local get_file_stat = function(filename) - return assert(vim.loop.fs_stat(vim.fn.expand(filename))) + return vim.loop.fs_stat(vim.fn.expand(filename)) or {} end local bat_maker = function(filename, lnum, start, finish) if get_file_stat(filename).type == 'directory' then - return { 'ls', '-la' } + return { 'ls', '-la', vim.fn.expand(filename) } end local command = {"bat"} @@ -61,7 +61,7 @@ end -- TODO: Add other options for cat to do this better local cat_maker = function(filename, _, _, _) if get_file_stat(filename).type == 'directory' then - return { 'ls', '-la' } + return { 'ls', '-la', vim.fn.expand(filename) } end if 1 == vim.fn.executable('file') then