1
0
Fork 0
mirror of synced 2024-12-22 08:11:08 -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>
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"

View file

@ -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

View file

@ -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`.

View file

@ -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",