nvim-config-kickstart/lua/autocommands.lua

32 lines
796 B
Lua

-- Recognize .md as pandoc
vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
pattern = {"*.md", },
callback = function()
vim.o.filetype = 'pandoc'
vim.o.spell = true
vim.o.spelllang = 'en'
end
})
-- French markdown files
vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
pattern = {"*-fr.md", },
callback = function()
vim.o.spelllang = 'fr'
end
})
-- Spell shortcuts
vim.api.nvim_create_autocmd({"OptionSet"}, {
pattern = { "spell" },
callback = function()
if vim.o.spell == true then
vim.keymap.set("n", "<Leader>i", "mz[s1z=`z", {noremap = true, silent = true})
vim.keymap.set("n", "à", "]s", {noremap = true, silent = true})
else
vim.keymap.del("n", "<Leader>i")
vim.keymap.del("n", "à")
end
end
})