autocommands for pandoc
This commit is contained in:
31
lua/autocommands.lua
Normal file
31
lua/autocommands.lua
Normal file
@ -0,0 +1,31 @@
|
||||
-- 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
|
||||
})
|
Reference in New Issue
Block a user