use fresh vim.api autocmds

This commit is contained in:
2022-03-27 17:40:54 +03:00
parent 5b24edb775
commit 211420b3fb
2 changed files with 21 additions and 10 deletions

View File

@@ -1,3 +1,9 @@
vim.cmd([[ local group = vim.api.nvim_create_augroup("RootGroup", { clear = true })
au TextYankPost * silent! lua vim.highlight.on_yank({timeout = 200})
]]) vim.api.nvim_create_autocmd("TextYankPost", {
pattern = "*",
group = group,
callback = function()
vim.highlight.on_yank({ timeout = 200 })
end,
})

View File

@@ -44,17 +44,22 @@ null_ls.setup({
formatting.shfmt, formatting.shfmt,
}, },
on_attach = function() on_attach = function()
vim.cmd([[ local group = vim.api.nvim_create_augroup("NullLsLspFormatting", { clear = true })
augroup LspFormatting vim.api.nvim_create_autocmd("BufWritePre", {
autocmd! * <buffer> pattern = "*",
autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync() group = group,
augroup END callback = vim.lsp.buf.formatting_sync,
]]) })
end, end,
}) })
-- Other formats that work weird with null_ls -- Other formats that work weird with null_ls
vim.cmd([[autocmd BufWritePre *.svelte lua vim.lsp.buf.formatting_sync(nil, 1000)]]) local group = vim.api.nvim_create_augroup("OtherLspFormatting", { clear = true })
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = { "*.svelte" },
group = group,
callback = vim.lsp.buf.formatting_sync,
})
local completion_trigger = "<C-space>" local completion_trigger = "<C-space>"
if vim.fn.has("win32") == 1 then if vim.fn.has("win32") == 1 then