added skip list for spellcheck

This commit is contained in:
2025-06-03 14:34:44 +02:00
parent ad70ada381
commit e63b46fc68
+19 -5
View File
@@ -17,11 +17,25 @@ vim.keymap.set("v", "k", "gk", { noremap = true, silent = true })
-- Spellchecker
vim.api.nvim_create_autocmd("FileType", {
-- pattern = { "markdown", "text", "typst" },
callback = function()
vim.opt_local.spell = true
vim.opt_local.spelllang = "en"
end,
callback = function()
local buftype = vim.api.nvim_buf_get_option(0, "buftype")
local filetype = vim.api.nvim_buf_get_option(0, "filetype")
local skip_buftypes = { "nofile", "prompt", "terminal" }
local skip_filetypes = { "cmp_menu", "cmp_doc", "TelescopePrompt", "NvimTree" }
-- If current buffer is in skip list, do nothing
for _, bt in ipairs(skip_buftypes) do
if buftype == bt then return end
end
for _, ft in ipairs(skip_filetypes) do
if filetype == ft then return end
end
-- Else, enable spellcheck
vim.opt_local.spell = true
vim.opt_local.spelllang = "en"
end,
})
-- Clear search highlights when entering insert mode.