1
0
Fork 0
mirror of synced 2024-11-22 01:55:36 -05:00

Update aspell plugin

This commit is contained in:
Nico 2022-08-14 13:47:06 +02:00
parent c1c8218741
commit 2987bba053
No known key found for this signature in database
GPG key ID: CB0F39958FA44FA8
4 changed files with 38 additions and 5 deletions

View file

@ -2,7 +2,7 @@
# Maintainer: Librewish <librewish@gmail.com> # Maintainer: Librewish <librewish@gmail.com>
pkgname=garuda-common-settings pkgname=garuda-common-settings
pkgver=2.6.5 pkgver=2.6.6
pkgrel=1 pkgrel=1
arch=('any') arch=('any')
url="https://gitlab.com/garuda-linux/themes-and-settings/settings/$pkgname" url="https://gitlab.com/garuda-linux/themes-and-settings/settings/$pkgname"

View file

@ -1,4 +1,4 @@
VERSION = "1.2.1" VERSION = "1.3.0"
local micro = import("micro") local micro = import("micro")
local shell = import("micro/shell") local shell = import("micro/shell")
@ -16,6 +16,7 @@ config.RegisterCommonOption("aspell", "args", "")
function init() function init()
config.MakeCommand("addpersonal", addpersonal, config.NoComplete) config.MakeCommand("addpersonal", addpersonal, config.NoComplete)
config.MakeCommand("acceptsug", acceptsug, config.NoComplete) config.MakeCommand("acceptsug", acceptsug, config.NoComplete)
config.MakeCommand("togglecheck", togglecheck, config.NoComplete)
config.AddRuntimeFile("aspell", config.RTHelp, "help/aspell.md") config.AddRuntimeFile("aspell", config.RTHelp, "help/aspell.md")
end end
@ -30,6 +31,10 @@ local filterModes = {
perl6 = "perl", perl6 = "perl",
tex = "tex", tex = "tex",
markdown = "markdown", markdown = "markdown",
groff = "nroff",
man = "nroff",
["git-commit"] = "url",
mail = "email"
-- Aspell has comment mode, in which only lines starting with # are checked -- Aspell has comment mode, in which only lines starting with # are checked
-- but it doesn't work for some reason -- but it doesn't work for some reason
} }
@ -72,7 +77,8 @@ end
function spellcheck(buf) function spellcheck(buf)
local check = buf.Settings["aspell.check"] 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 if lock then
next = buf next = buf
else else
@ -187,6 +193,21 @@ function parseMessages(messages)
return misspells return misspells
end 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) function addpersonal(bp, args)
local buf = bp.Buf local buf = bp.Buf

View file

@ -11,8 +11,9 @@ with this plugin. If you are on Windows, you can install Aspell through
## Options ## Options
* `aspell.check`: controls whether spellchecking is performed. Possible values * `aspell.check`: controls whether spellchecking is performed. Possible values
are `on`, `off` and `auto`. When set to `auto`, only XML, C++, C, HTML, Perl are `on`, `off` and `auto`. When set to `auto`, the file will be checked
TeX and Markdown documents will be spellchecked. Defaults to `auto`. 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 * `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 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 ## 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 * `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 that it won't be highlighted as a misspell anymore. You can bind it to a key
as `lua:aspell.addpersonal`. as `lua:aspell.addpersonal`.

View file

@ -4,6 +4,13 @@
"Tags": ["spellchecking", "spelling", "aspell", "spellchecker"], "Tags": ["spellchecking", "spelling", "aspell", "spellchecker"],
"Website": "https://github.com/priner/micro-aspell-plugin", "Website": "https://github.com/priner/micro-aspell-plugin",
"Versions": [ "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", "Version": "1.2.1",
"Url": "https://github.com/priner/micro-aspell-plugin/archive/v1.2.1.zip", "Url": "https://github.com/priner/micro-aspell-plugin/archive/v1.2.1.zip",