Public Access
added skip list for spellcheck
This commit is contained in:
+15
-1
@@ -17,8 +17,22 @@ vim.keymap.set("v", "k", "gk", { noremap = true, silent = true })
|
|||||||
|
|
||||||
-- Spellchecker
|
-- Spellchecker
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
-- pattern = { "markdown", "text", "typst" },
|
|
||||||
callback = function()
|
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.spell = true
|
||||||
vim.opt_local.spelllang = "en"
|
vim.opt_local.spelllang = "en"
|
||||||
end,
|
end,
|
||||||
|
|||||||
Reference in New Issue
Block a user