diff options
| author | Subeet Kumar Dutta <34621179+SubeetKD@users.noreply.github.com> | 2020-09-06 01:19:01 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-05 15:49:01 -0400 |
| commit | d3c9b65252ab1fa532811fee0212f68b50b30601 (patch) | |
| tree | e5d2c8068af492ac0e19eca0444d2b400fdb63bb /lua | |
| parent | 639497ae6dc720859e90fd6e5df0ac25da145528 (diff) | |
added preview for files which spaces in names. (#35)
TODO: Still need to do better escaping.
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/telescope/previewers.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lua/telescope/previewers.lua b/lua/telescope/previewers.lua index 6df7f78..2978e03 100644 --- a/lua/telescope/previewers.lua +++ b/lua/telescope/previewers.lua @@ -140,10 +140,10 @@ previewers.vim_buffer_or_bat = defaulter(function(_) local file_name = vim.split(value, ":")[1] - log.trace("Previewing File: %s", file_name) + log.trace("Previewing File: '%s'", file_name) -- vim.fn.termopen( - -- string.format("bat --color=always --style=grid %s"), + -- string.format("bat --color=always --style=grid '%s'"), -- vim.fn.fnamemodify(file_name, ":p") local bufnr = vim.fn.bufadd(file_name) @@ -159,7 +159,7 @@ previewers.vim_buffer_or_bat = defaulter(function(_) vim.api.nvim_win_set_option(status.preview_win, 'signcolumn', 'no') vim.api.nvim_win_set_option(status.preview_win, 'foldlevel', 100) else - vim.api.nvim_buf_set_lines(status.preview_bufnr, 0, -1, false, vim.fn.systemlist(string.format('bat %s', file_name))) + vim.api.nvim_buf_set_lines(status.preview_bufnr, 0, -1, false, vim.fn.systemlist(string.format('bat "%s"', file_name))) end end, } @@ -168,9 +168,9 @@ end, {}) previewers.cat = defaulter(function(opts) return previewers.new { setup = function() - local command_string = "cat %s" + local command_string = "cat '%s'" if 1 == vim.fn.executable("bat") then - command_string = "bat %s --style=grid --paging=always" + command_string = "bat '%s' --style=grid --paging=always" end return { @@ -203,9 +203,9 @@ end, {}) previewers.vimgrep = defaulter(function(_) return previewers.new { setup = function() - local command_string = "cat %s" + local command_string = "cat '%s'" if vim.fn.executable("bat") then - command_string = "bat %s --highlight-line %s -r %s:%s" .. bat_options + command_string = "bat '%s' --highlight-line '%s' -r '%s':'%s'" .. bat_options end return { @@ -244,9 +244,9 @@ end, {}) previewers.qflist = defaulter(function(_) return previewers.new { setup = function() - local command_string = "cat %s" + local command_string = "cat '%s'" if vim.fn.executable("bat") then - command_string = "bat %s --highlight-line %s -r %s:%s" .. bat_options + command_string = "bat '%s' --highlight-line '%s' -r '%s':'%s'" .. bat_options end return { |
