fix(spelling): use french + english dictionnaries by default

- Better ease of use
- May not capture everything, the shortcuts are there for that
This commit is contained in:
Fabrice Mouhartem 2025-02-11 16:11:32 +01:00
parent 2651b5944b
commit 623ca0a753
Signed by: fmouhart
GPG Key ID: 2C5033B228CFE4E7

View File

@ -1,5 +1,6 @@
local markdown = vim.api.nvim_create_augroup("markdown", { clear = true })
local spelling = vim.api.nvim_create_augroup("spelling", { clear = true })
local spell_keymap = require('spelling').spell_keymap
-- Recognize .md as pandoc
vim.api.nvim_create_autocmd({ "BufNew" }, {
@ -10,8 +11,8 @@ vim.api.nvim_create_autocmd({ "BufNew" }, {
vim.o.commentstring = '<!--%s-->'
require('luasnip').filetype_extend("pandoc", { "markdown" })
vim.o.spell = true
require('spelling').spell_keymap()
vim.o.spelllang = 'en'
spell_keymap()
vim.o.spelllang = 'en,fr'
vim.o.formatoptions = "qj"
-- email commands: my/msy to paste the html inside the clipboard
vim.keymap.set('', '<LocalLeader>msy', ':w !pandoc -f markdown+emoji -t html5 -s | wl-copy --type text/html<CR><CR>',
@ -24,20 +25,11 @@ vim.api.nvim_create_autocmd({ "BufNew" }, {
end
})
-- French markdown files
vim.api.nvim_create_autocmd({ "BufNew" }, {
pattern = { "*-fr.md", },
group = markdown,
callback = function()
vim.o.spelllang = 'fr'
end
})
-- Spell shortcuts
vim.api.nvim_create_autocmd({ "OptionSet" }, {
pattern = { "spell" },
group = spelling,
callback = require('spelling').spell_keymap
callback = spell_keymap
})
-- LaTeX configuration
@ -60,18 +52,21 @@ vim.api.nvim_create_autocmd("FileType", {
vim.o.foldexpr = 'vimtex#fold#level(v:lnum)'
vim.o.foldtext = 'vimtex#fold#text()'
vim.o.spell = true
require('spelling').spell_keymap()
spell_keymap()
vim.o.spellang = "en,fr"
end,
})
-- Typst bindings
-- Typst bindings + spellchecking
local typstgroup = vim.api.nvim_create_augroup("typst", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
pattern = { "typst" },
group = typstgroup,
callback = function()
vim.keymap.set('', '<LocalLeader>mp', ':TypstWatch<CR>', { noremap = true, silent = true, desc = "[M]ake [P]review" })
require('spelling').spell_keymap()
vim.o.spell = true
spell_keymap()
vim.o.spellang = "fr,en"
end,
})
@ -82,7 +77,7 @@ vim.api.nvim_create_autocmd("FileType", {
group = jjgroup,
callback = function()
vim.o.spell = true
spell_keymap()
vim.o.spelllang = "en"
require('spelling').spell_keymap()
end,
})