nvim: Fix group argument to nvim_create_autocmd
This commit is contained in:
parent
8fd4ae0da9
commit
918df63073
2 changed files with 12 additions and 12 deletions
|
@ -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 = {
|
local aucmd_dict = {
|
||||||
TermOpen = {
|
TermOpen = {
|
||||||
{
|
{
|
||||||
group = "custom_group",
|
group = custom_augroup_id,
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
command = "startinsert"
|
command = "startinsert"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
group = "custom_group",
|
group = custom_augroup_id,
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
command = "setlocal listchars= nonumber norelativenumber"
|
command = "setlocal listchars= nonumber norelativenumber"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
VimResized = {
|
VimResized = {
|
||||||
{
|
{
|
||||||
group = "custom_group",
|
group = custom_augroup_id,
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
command = ":wincmd ="
|
command = ":wincmd ="
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
InsertEnter = {
|
InsertEnter = {
|
||||||
{
|
{
|
||||||
group = "custom_group",
|
group = custom_augroup_id,
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
command = "setlocal nohlsearch"
|
command = "setlocal nohlsearch"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
TextYankPost = {
|
TextYankPost = {
|
||||||
{
|
{
|
||||||
group = "custom_group",
|
group = custom_augroup_id,
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
callback = function ()
|
callback = function ()
|
||||||
require("vim.highlight").on_yank({timeout = 1000})
|
require("vim.highlight").on_yank({timeout = 1000})
|
||||||
|
@ -38,7 +38,7 @@ local aucmd_dict = {
|
||||||
},
|
},
|
||||||
VimLeave = {
|
VimLeave = {
|
||||||
{
|
{
|
||||||
group = "custom_group",
|
group = custom_augroup_id,
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
command = "set guicursor=a:hor1-blinkon0"
|
command = "set guicursor=a:hor1-blinkon0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,19 +110,19 @@ local on_attach = function(client, bufnr)
|
||||||
end
|
end
|
||||||
|
|
||||||
if client.server_capabilities.codeLensProvider or client.server_capabilities.documentHighlightProvider then
|
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
|
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_buf_set_keymap(bufnr, "n", "<Leader>l", "<cmd>lua vim.lsp.codelens.run()<CR>", opts)
|
||||||
vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI", "InsertLeave"}, {
|
vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI", "InsertLeave"}, {
|
||||||
group = "LSP",
|
group = lsp_augroup_id,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = function ()
|
callback = function ()
|
||||||
vim.lsp.codelens.refresh()
|
vim.lsp.codelens.refresh()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI"}, {
|
vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI"}, {
|
||||||
group = "LSP",
|
group = lsp_augroup_id,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = function ()
|
callback = function ()
|
||||||
lightbulb.update_lightbulb()
|
lightbulb.update_lightbulb()
|
||||||
|
@ -132,14 +132,14 @@ local on_attach = function(client, bufnr)
|
||||||
|
|
||||||
if client.server_capabilities.documentHighlightProvider then
|
if client.server_capabilities.documentHighlightProvider then
|
||||||
vim.api.nvim_create_autocmd("CursorHold", {
|
vim.api.nvim_create_autocmd("CursorHold", {
|
||||||
group = "LSP",
|
group = lsp_augroup_id,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = function ()
|
callback = function ()
|
||||||
vim.lsp.buf.document_highlight()
|
vim.lsp.buf.document_highlight()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
vim.api.nvim_create_autocmd("CursorMoved", {
|
vim.api.nvim_create_autocmd("CursorMoved", {
|
||||||
group = "LSP",
|
group = lsp_augroup_id,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = function ()
|
callback = function ()
|
||||||
vim.lsp.buf.clear_references()
|
vim.lsp.buf.clear_references()
|
||||||
|
|
Loading…
Reference in a new issue