diff options
| author | Julian Berman <Julian@GrayVines.com> | 2020-12-03 14:23:19 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-03 14:23:19 -0500 |
| commit | 863a0d42c966f6f7cff1f0425388a594b60904db (patch) | |
| tree | 287026355f7ef50dc3b20f01172799c69b9464e5 /lua | |
| parent | be8f5ec8dcff357ef95d75de9e1dfb797e8556f8 (diff) | |
fix: Set and unset report to what's needed when deleting buffers. (#282)
Fixes #105.
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/telescope/builtin/init.lua | 6 | ||||
| -rw-r--r-- | lua/telescope/utils.lua | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lua/telescope/builtin/init.lua b/lua/telescope/builtin/init.lua index 078a3e6..c9dd1fd 100644 --- a/lua/telescope/builtin/init.lua +++ b/lua/telescope/builtin/init.lua @@ -17,12 +17,6 @@ if 1 ~= vim.fn.has('nvim-0.5') then return 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 = {} builtin.live_grep = require('telescope.builtin.files').live_grep diff --git a/lua/telescope/utils.lua b/lua/telescope/utils.lua index 22ee245..1e091e8 100644 --- a/lua/telescope/utils.lua +++ b/lua/telescope/utils.lua @@ -141,9 +141,15 @@ end function utils.buf_delete(bufnr) 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 vim.cmd(string.format("bdelete! %s", bufnr)) end + + if start_report < 2 then vim.o.report = start_report end end function utils.max_split(s, pattern, maxsplit) |
