RishabhRD / nvim-lsputils

Better defaults for nvim-lsp actions
456 stars 19 forks source link

Fix string format line for preview with `bat` #50

Closed TonyWu20 closed 2 years ago

TonyWu20 commented 2 years ago

The current preview command does not put double quotes to the 'item.filename', which will cause an error when passed to bat if the file path contains space. Change the line

local cmd = string.format('bat %s --color=always --paging=always --plain -n --pager="less -RS" -H %s -r %s:', item.filename, item.lnum, startPoint)

to

local cmd = string.format('bat "%s" --color=always --paging=always --plain -n --pager="less -RS" -H %s -r %s:', item.filename, item.lnum, startPoint)
RishabhRD commented 2 years ago

LGTM Thanks