22 lines
482 B
Lua
22 lines
482 B
Lua
|
|
-- Set spelling
|
||
|
|
local function set_lang(buf)
|
||
|
|
if string.match(vim.api.nvim_buf_get_name(buf), "en.md$") ~= nil then
|
||
|
|
vim.opt_local.spelllang = "en"
|
||
|
|
else
|
||
|
|
vim.opt_local.spelllang = "es"
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||
|
|
pattern = "markdown",
|
||
|
|
callback = function(event)
|
||
|
|
set_lang(event.buf)
|
||
|
|
end,
|
||
|
|
})
|
||
|
|
|
||
|
|
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
|
||
|
|
if vim.api.nvim_get_option_value("filetype", { buf = buf }) == "markdown" then
|
||
|
|
set_lang(buf)
|
||
|
|
end
|
||
|
|
end
|