bugfix: live_grep with underlying 'grep'

main
bhagwan 3 years ago
parent 659bd79718
commit 5472c41f20

@ -143,7 +143,7 @@ function Previewer:set_winopts(win)
end
local function set_cursor_hl(self, entry)
local lnum, col = tonumber(entry.line), tonumber(entry.col)
local lnum, col = tonumber(entry.line), tonumber(entry.col) or 1
local pattern = entry.pattern or entry.text
if not lnum or lnum < 1 then
@ -309,6 +309,8 @@ function Previewer:display_entry(entry)
else
-- mark the buffer for unloading the next call
self.preview_bufloaded = true
-- make sure the file is readable (or bad entry.path)
if not vim.loop.fs_stat(entry.path) then return end
-- read the file into the buffer
utils.read_file_async(entry.path, vim.schedule_wrap(function(data)
if not vim.api.nvim_buf_is_valid(bufnr) then

@ -193,6 +193,7 @@ end
M.grep_curbuf = function(opts)
if not opts then opts = {} end
opts.rg_opts = config.globals.grep.rg_opts .. " --with-filename"
opts.grep_opts = config.globals.grep.grep_opts .. " --with-filename"
opts.filename = vim.api.nvim_buf_get_name(0)
if #opts.filename > 0 then
opts.filename = path.relative(opts.filename, vim.loop.cwd())

Loading…
Cancel
Save