autocommands for pandoc
This commit is contained in:
parent
d377f3432a
commit
fad7bc2ae5
1
init.lua
1
init.lua
@ -65,6 +65,7 @@ require('neorg-configure')
|
||||
-- Customizations
|
||||
require('bepo')
|
||||
require('restore-position')
|
||||
require('autocommands')
|
||||
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
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
|
||||
})
|
Loading…
Reference in New Issue
Block a user