diff --git a/PKGBUILD b/PKGBUILD index c490694..9be5e71 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -2,7 +2,7 @@ # Maintainer: Librewish pkgname=garuda-common-settings -pkgver=2.6.5 +pkgver=2.6.6 pkgrel=1 arch=('any') url="https://gitlab.com/garuda-linux/themes-and-settings/settings/$pkgname" diff --git a/etc/skel/.config/micro/plug/aspell/aspell.lua b/etc/skel/.config/micro/plug/aspell/aspell.lua index 736e4ec..653abb7 100644 --- a/etc/skel/.config/micro/plug/aspell/aspell.lua +++ b/etc/skel/.config/micro/plug/aspell/aspell.lua @@ -1,4 +1,4 @@ -VERSION = "1.2.1" +VERSION = "1.3.0" local micro = import("micro") local shell = import("micro/shell") @@ -16,6 +16,7 @@ config.RegisterCommonOption("aspell", "args", "") function init() config.MakeCommand("addpersonal", addpersonal, config.NoComplete) config.MakeCommand("acceptsug", acceptsug, config.NoComplete) + config.MakeCommand("togglecheck", togglecheck, config.NoComplete) config.AddRuntimeFile("aspell", config.RTHelp, "help/aspell.md") end @@ -30,6 +31,10 @@ local filterModes = { perl6 = "perl", tex = "tex", markdown = "markdown", + groff = "nroff", + man = "nroff", + ["git-commit"] = "url", + mail = "email" -- Aspell has comment mode, in which only lines starting with # are checked -- but it doesn't work for some reason } @@ -72,7 +77,8 @@ end function spellcheck(buf) local check = buf.Settings["aspell.check"] - if check == "on" or (check == "auto" and filterModes[buf:FileType()]) then + local readcheck = buf.Type.Readonly + if (check == "on" or (check == "auto" and filterModes[buf:FileType()])) and (not readcheck) then if lock then next = buf else @@ -187,6 +193,21 @@ function parseMessages(messages) return misspells end +function togglecheck(bp, args) + local buf = bp.Buf + local check = buf.Settings["aspell.check"] + if check == "on" or (check == "auto" and filterModes[buf:FileType()]) then + buf.Settings["aspell.check"] = "off" + else + buf.Settings["aspell.check"] = "on" + end + spellcheck(buf) + if args then + return + end + return true +end + function addpersonal(bp, args) local buf = bp.Buf diff --git a/etc/skel/.config/micro/plug/aspell/help/aspell.md b/etc/skel/.config/micro/plug/aspell/help/aspell.md index 10b2a8e..1493b43 100644 --- a/etc/skel/.config/micro/plug/aspell/help/aspell.md +++ b/etc/skel/.config/micro/plug/aspell/help/aspell.md @@ -11,8 +11,9 @@ with this plugin. If you are on Windows, you can install Aspell through ## Options * `aspell.check`: controls whether spellchecking is performed. Possible values - are `on`, `off` and `auto`. When set to `auto`, only XML, C++, C, HTML, Perl - TeX and Markdown documents will be spellchecked. Defaults to `auto`. + are `on`, `off` and `auto`. When set to `auto`, the file will be checked + only if it's one of these filetypes: XML, C++, C, HTML, Perl, TeX, + Markdown, Groff/Troff, Manpage, Email or Git commit. Defaults to `auto`. * `aspell.lang`: language to use. Two letter language code, optionally followed by an underscore or a dash and a two letter country code. It will be passed @@ -52,6 +53,10 @@ You can also disable or enable spellchecking for specific file types in your ## Commands +* `togglecheck`: turns the spellchecking on/off. You can bind it to a key as + `lua:aspell.addpersonal`. The effect's the same as changing `aspell.check` + using `setlocal`. + * `addpersonal`: adds the word the cursor is on to your personal dictionary, so that it won't be highlighted as a misspell anymore. You can bind it to a key as `lua:aspell.addpersonal`. diff --git a/etc/skel/.config/micro/plug/aspell/repo.json b/etc/skel/.config/micro/plug/aspell/repo.json index 2fa3c1b..40a7fb1 100644 --- a/etc/skel/.config/micro/plug/aspell/repo.json +++ b/etc/skel/.config/micro/plug/aspell/repo.json @@ -4,6 +4,13 @@ "Tags": ["spellchecking", "spelling", "aspell", "spellchecker"], "Website": "https://github.com/priner/micro-aspell-plugin", "Versions": [ + { + "Version": "1.3.0", + "Url": "https://github.com/priner/micro-aspell-plugin/archive/v1.3.0.zip", + "Require": { + "micro": ">=2.0.7" + } + }, { "Version": "1.2.1", "Url": "https://github.com/priner/micro-aspell-plugin/archive/v1.2.1.zip",