Something went wrong. Try again.
my neovim config
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263-- TODO: one commandvim.api.nvim_create_user_command("Mkspell", function() local spellfiles = vim.bo.spellfile:gsub(" ", "\\ ") -- local afffile = vim.g.spell_aff:gsub(" ", "\\ ") -- local cmd = ("mkspell! " .. spellfile .. " " .. afffile) for spellfile in vim.gsplit(spellfiles, ",") do local cmd = ("mkspell! " .. spellfile) vim.cmd(cmd) endend, {})
vim.api.nvim_create_user_command("Edspell", function() local spellfile = vim.bo.spellfile:gsub(" ", "\\ ") vim.cmd("edit " .. spellfile)end, {})
local H = {}
function H.get_spell() local lines = vim.fn.getregion(vim.fn.getpos("v"), vim.fn.getpos("."), { type = vim.fn.mode() }) local results = {} for _, line in ipairs(lines) do while true do local word, type = unpack(vim.fn.spellbadword(line)) if word == "" or type ~= "bad" then break end results[#results + 1] = word -- vim.cmd.spellgood(word) end end return resultsend
function H.spell_all_good() local lines = vim.fn.getregion(vim.fn.getpos("v"), vim.fn.getpos("."), { type = vim.fn.mode() }) for _, line in ipairs(lines) do while true do local word, type = unpack(vim.fn.spellbadword(line)) if word == "" or type ~= "bad" then break end vim.cmd.spellgood(word) end end -- exit visual mode local esc = vim.api.nvim_replace_termcodes("<esc>", true, false, true) vim.api.nvim_feedkeys(esc, vim.fn.mode(), false)end
function H.enhanced_spell_good() local cword = vim.fn.expand("<cword>") vim.ui.input({ default = cword:lower(), prompt = "spell good" }, function(input) if not input then return vim.notify("Aborted") end input = vim.trim(input) vim.cmd.spellgood(input) end)end
return H