Fix - disable popup in 'nofile' buffer types

This commit is contained in:
edluffy 2021-03-29 19:49:24 +01:00
parent bd9456ac3c
commit 0efbbaf5ee

View file

@ -15,6 +15,9 @@ function M.on_cursor_moved()
end end
function M.show_specs() function M.show_specs()
local buftype = vim.api.nvim_buf_get_option(0, 'buftype')
if buftype == 'nofile' then return end
local cursor_col = vim.fn.wincol()-1 local cursor_col = vim.fn.wincol()-1
local cursor_row = vim.fn.winline()-1 local cursor_row = vim.fn.winline()-1
local bufh = vim.api.nvim_create_buf(false, true) local bufh = vim.api.nvim_create_buf(false, true)
@ -29,8 +32,6 @@ function M.show_specs()
vim.api.nvim_win_set_option(win_id, 'winhl', 'Normal:'.. opts.popup.winhl) vim.api.nvim_win_set_option(win_id, 'winhl', 'Normal:'.. opts.popup.winhl)
vim.api.nvim_win_set_option(win_id, "winblend", opts.popup.blend) vim.api.nvim_win_set_option(win_id, "winblend", opts.popup.blend)
local cnt = 0 local cnt = 0
local config = vim.api.nvim_win_get_config(win_id) local config = vim.api.nvim_win_get_config(win_id)
local timer = vim.loop.new_timer() local timer = vim.loop.new_timer()