nvim: Fix group argument to nvim_create_autocmd

This commit is contained in:
Sanchayan Maity 2022-05-06 11:55:30 +05:30
parent 8fd4ae0da9
commit 918df63073
2 changed files with 12 additions and 12 deletions

View file

@ -1,35 +1,35 @@
vim.api.nvim_create_augroup("custom_group", {clear = true})
local custom_augroup_id = vim.api.nvim_create_augroup("custom_group", {clear = true})
local aucmd_dict = {
TermOpen = {
{
group = "custom_group",
group = custom_augroup_id,
pattern = "*",
command = "startinsert"
},
{
group = "custom_group",
group = custom_augroup_id,
pattern = "*",
command = "setlocal listchars= nonumber norelativenumber"
},
},
VimResized = {
{
group = "custom_group",
group = custom_augroup_id,
pattern = "*",
command = ":wincmd ="
}
},
InsertEnter = {
{
group = "custom_group",
group = custom_augroup_id,
pattern = "*",
command = "setlocal nohlsearch"
}
},
TextYankPost = {
{
group = "custom_group",
group = custom_augroup_id,
pattern = "*",
callback = function ()
require("vim.highlight").on_yank({timeout = 1000})
@ -38,7 +38,7 @@ local aucmd_dict = {
},
VimLeave = {
{
group = "custom_group",
group = custom_augroup_id,
pattern = "*",
command = "set guicursor=a:hor1-blinkon0"
}

View file

@ -110,19 +110,19 @@ local on_attach = function(client, bufnr)
end
if client.server_capabilities.codeLensProvider or client.server_capabilities.documentHighlightProvider then
vim.api.nvim_create_augroup("LSP", {clear = true})
local lsp_augroup_id = vim.api.nvim_create_augroup("LSP", {clear = true})
if client.server_capabilities.codeLensProvider then
vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>l", "<cmd>lua vim.lsp.codelens.run()<CR>", opts)
vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI", "InsertLeave"}, {
group = "LSP",
group = lsp_augroup_id,
buffer = bufnr,
callback = function ()
vim.lsp.codelens.refresh()
end,
})
vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI"}, {
group = "LSP",
group = lsp_augroup_id,
buffer = bufnr,
callback = function ()
lightbulb.update_lightbulb()
@ -132,14 +132,14 @@ local on_attach = function(client, bufnr)
if client.server_capabilities.documentHighlightProvider then
vim.api.nvim_create_autocmd("CursorHold", {
group = "LSP",
group = lsp_augroup_id,
buffer = bufnr,
callback = function ()
vim.lsp.buf.document_highlight()
end,
})
vim.api.nvim_create_autocmd("CursorMoved", {
group = "LSP",
group = lsp_augroup_id,
buffer = bufnr,
callback = function ()
vim.lsp.buf.clear_references()