fix: Set and unset report to what's needed when deleting buffers. (#282)

Fixes #105.
This commit is contained in:
Julian Berman
2020-12-03 14:23:19 -05:00
committed by GitHub
parent be8f5ec8dc
commit 863a0d42c9
2 changed files with 6 additions and 6 deletions

View File

@@ -17,12 +17,6 @@ if 1 ~= vim.fn.has('nvim-0.5') then
return return
end end
if 2 > vim.o.report then
vim.api.nvim_err_writeln(string.format("[telescope] It seems you have `set report=%s`", vim.o.report))
vim.api.nvim_err_writeln("[telescope] Instead, change 'report' back to its default value. `set report=2`.")
vim.api.nvim_err_writeln("[telescope] If you do not, you will have a bad experience")
end
local builtin = {} local builtin = {}
builtin.live_grep = require('telescope.builtin.files').live_grep builtin.live_grep = require('telescope.builtin.files').live_grep

View File

@@ -141,9 +141,15 @@ end
function utils.buf_delete(bufnr) function utils.buf_delete(bufnr)
if bufnr == nil then return end if bufnr == nil then return end
-- Suppress the buffer deleted message for those with &report<2
start_report = vim.o.report
if start_report < 2 then vim.o.report = 2 end
if vim.api.nvim_buf_is_valid(bufnr) and vim.api.nvim_buf_is_loaded(bufnr) then if vim.api.nvim_buf_is_valid(bufnr) and vim.api.nvim_buf_is_loaded(bufnr) then
vim.cmd(string.format("bdelete! %s", bufnr)) vim.cmd(string.format("bdelete! %s", bufnr))
end end
if start_report < 2 then vim.o.report = start_report end
end end
function utils.max_split(s, pattern, maxsplit) function utils.max_split(s, pattern, maxsplit)