Public Access
added skip list for spellcheck
This commit is contained in:
+19
-5
@@ -17,11 +17,25 @@ 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")
|
||||||
vim.opt_local.spell = true
|
local filetype = vim.api.nvim_buf_get_option(0, "filetype")
|
||||||
vim.opt_local.spelllang = "en"
|
|
||||||
end,
|
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.
|
-- Clear search highlights when entering insert mode.
|
||||||
|
|||||||
Reference in New Issue
Block a user