nvim: lsp: Do not attach LSP if file is opened via git
We might use Git show to view git revision of the file
on another branch and we do not want to attach LSP to
this file. This file will be opened as a temporary with
path /tmp/nvim/<something>.
On similar lines to commit 1eec783a20
.
This commit is contained in:
parent
e3ff05fa11
commit
036b6652a9
1 changed files with 8 additions and 0 deletions
|
@ -264,6 +264,10 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
|||
return
|
||||
end
|
||||
|
||||
if string.find(file_name, "/tmp/") then
|
||||
return
|
||||
end
|
||||
|
||||
for _, mappings in pairs(lsp_key_mappings) do
|
||||
local capability, mode, lhs, rhs = unpack(mappings)
|
||||
if client.supports_method(capability) then
|
||||
|
@ -286,6 +290,10 @@ vim.api.nvim_create_autocmd("LspDetach", {
|
|||
return
|
||||
end
|
||||
|
||||
if string.find(file_name, "/tmp/") then
|
||||
return
|
||||
end
|
||||
|
||||
for _, mappings in pairs(lsp_key_mappings) do
|
||||
local capability, mode, lhs, _ = unpack(mappings)
|
||||
if client.supports_method(capability) then
|
||||
|
|
Loading…
Reference in a new issue