From 6d26e62ceeb4e6ef0c27c708da6e5715e819d179 Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Sun, 24 Dec 2023 22:42:24 +0100 Subject: [PATCH] Add augroup to autocommand --- lua/autocommands.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/autocommands.lua b/lua/autocommands.lua index 65ff3f8..d30fddd 100644 --- a/lua/autocommands.lua +++ b/lua/autocommands.lua @@ -1,6 +1,9 @@ +local markdown = vim.api.nvim_create_augroup("markdown", { clear = true }) + -- Recognize .md as pandoc vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, { pattern = {"*.md", }, + group = markdown, callback = function() vim.o.filetype = 'pandoc' vim.o.spell = true @@ -15,6 +18,7 @@ vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, { -- French markdown files vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, { pattern = {"*-fr.md", }, + group = markdown, callback = function() vim.o.spelllang = 'fr' end @@ -23,6 +27,7 @@ vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, { -- Spell shortcuts vim.api.nvim_create_autocmd({"OptionSet"}, { pattern = { "spell" }, + group = markdown, callback = function() if vim.o.spell == true then vim.keymap.set("n", "i", "mz[s1z=`z", {noremap = true, silent = true})