Skip to content

Commit bb710f4

Browse files
authored
fix: do not activate in special buffers (fixes #164) (#165)
Check bufname and do not attach to special buffers, eg. 'fugitive://'
1 parent 1cb2d24 commit bb710f4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lua/quarto/init.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,20 @@ M.searchHelp = function(cmd_input)
159159
vim.fn.jobstart(cmd)
160160
end
161161

162+
-- from https://github.com/neovim/nvim-lspconfig/blob/f98fa715acc975c2dd5fb5ba7ceddeb1cc725ad2/lua/lspconfig/util.lua#L23
163+
function M.bufname_valid(bufname)
164+
if bufname:match '^/' or bufname:match '^[a-zA-Z]:' or bufname:match '^zipfile://' or bufname:match '^tarfile:' then
165+
return true
166+
end
167+
return false
168+
end
169+
162170
M.activate = function()
171+
local bufname = vim.api.nvim_buf_get_name(0)
172+
-- do not activate in special buffers, for example 'fugitive://...'
173+
if not M.bufname_valid(bufname) then
174+
return
175+
end
163176
local tsquery = nil
164177
if cfg.config.lspFeatures.chunks == 'curly' then
165178
tsquery = [[

0 commit comments

Comments
 (0)