feat: Migrate autocmd in on_attach to pure Lua call

Migrated, following TeeJ_Dv's advice, the auto-command creation to a Lua
function.  As this auto-command only cares for the on_attach Lua scope,
it seems correct to have this one defined as a Lua function instead of
the legacy Vimscript.
This commit is contained in:
Dionisio E Alonso 2022-08-07 23:36:34 -03:00
parent 099f247c2e
commit 82697ea146
1 changed files with 7 additions and 1 deletions

View File

@ -46,7 +46,13 @@ lua << EOF
local nvim_lsp = require("lspconfig")
local on_attach = function(client, bufnr)
vim.api.nvim_command("autocmd CursorHoldI <buffer> lua vim.diagnostic.open_float({focusable = false, header = ''})")
vim.api.nvim_create_autocmd("CursorHoldI", {
buffer = bufnr,
callback = function()
vim.diagnostic.open_float({ focusable = false, header = "" })
end
})
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
update_in_insert = true,