summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorSimon Hauser <Simon-Hauser@outlook.de>2020-11-16 21:43:31 +0100
committerGitHub <noreply@github.com>2020-11-16 15:43:31 -0500
commit57a7769845fba5df8beef692695363933c0c6ae0 (patch)
treeb99d0b2d2dec20d6017660427ddf71c888a8d1d8 /lua
parenteaa7011f8499f2c8c473a5beb50100f1cae006cf (diff)
Fix #250 (#251)
Diffstat (limited to 'lua')
-rw-r--r--lua/telescope/previewers.lua6
1 files 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