priner / micro-aspell-plugin

Spellchecker plugin for Micro editor
MIT License
15 stars 5 forks source link

toggling #11

Closed prez closed 2 years ago

prez commented 3 years ago

Would you accept a PR that adds a function to toggle the spellchecking?

Pro: having it on all the times is annoying, I don't know how anyone can cope with aspell underlining everything when you write code

Contra: It's a hack, a real solution would be to add a command to micro that toggles buffer settings (however in this case, the spellchecker needs to re-run, so the real solution would need onBufferModified() too)

This is what I have in my local fork currently:

function togglecheck(bp, args)
    local buf = bp.Buf
    if buf.Settings["aspell.check"] == "on" then
        buf.Settings["aspell.check"] = "off"
    else
        buf.Settings["aspell.check"] = "on"
    end
    spellcheck(buf)
end