1
0
Fork 0
mirror of synced 2024-12-22 08:11:08 -05:00

Make micro use transparent theme, update plugins

This commit is contained in:
dr460nf1r3 2021-05-16 19:58:23 +02:00
parent 97e5c3d781
commit 65fb156ff6
No known key found for this signature in database
GPG key ID: BE75B9D9767036C2
7 changed files with 78 additions and 31 deletions

View file

@ -1,4 +1,4 @@
VERSION = "1.2.0"
VERSION = "1.2.1"
local micro = import("micro")
local shell = import("micro/shell")
@ -38,36 +38,36 @@ local lock = false
local next = nil
function runAspell(buf, onExit, ...)
local text = util.String(buf:Bytes())
-- Escape for aspell (it interprets lines that start
-- with % @ ^ ! etc.)
text = text:gsub("\n", "\n^"):gsub("^", "^")
-- Enable terse mode
text = "!\n" .. text
-- Escape for shell
text = "'" .. text:gsub("'", "'\\''") .. "'"
local options = ""
-- FIXME: we should support non-utf8 encodings with '--encoding'
local options = {"pipe", "--encoding=utf-8"}
if filterModes[buf:FileType()] then
options = options .. " --mode=" .. filterModes[buf:FileType()]
options[#options + 1] = "--mode=" .. filterModes[buf:FileType()]
end
if buf.Settings["aspell.lang"] ~= "" then
options = options .. " --lang=" .. buf.Settings["aspell.lang"]
options[#options + 1] = "--lang=" .. buf.Settings["aspell.lang"]
end
if buf.Settings["aspell.dict"] ~= "" then
options = options .. " --master=" .. buf.Settings["aspell.dict"]
options[#options + 1] = "--master=" .. buf.Settings["aspell.dict"]
end
if buf.Settings["aspell.sugmode"] ~= "" then
options = options .. " --sug-mode=" .. buf.Settings["aspell.sugmode"]
options[#options + 1] = "--sug-mode=" .. buf.Settings["aspell.sugmode"]
end
if buf.Settings["aspell.args"] ~= "" then
options = options .. " " .. buf.Settings["aspell.args"]
for _, argument in ipairs(split(buf.Settings["aspell.args"], " ")) do
options[#options + 1] = argument
end
shell.JobStart("printf %s " .. text .. " | aspell pipe" .. options, nil,
local job = shell.JobSpawn("aspell", options, nil,
nil, onExit, buf, unpack(arg))
-- Enable terse mode
shell.JobSend(job, "!\n")
for i=0, buf:LinesNum() - 1 do
local line = util.String(buf:LineBytes(i))
-- Escape for aspell (it interprets lines that start
-- with % @ ^ ! etc.)
line = "^" .. line .. "\n"
shell.JobSend(job, line)
end
job.Stdin:Close()
end
function spellcheck(buf)
@ -196,23 +196,23 @@ function addpersonal(bp, args)
local wordInBuf = util.String(buf:Substr(misspell.mstart, misspell.mend))
if loc:GreaterEqual(misspell.mstart) and loc:LessEqual(misspell.mend)
and wordInBuf == misspell.word then
local options = ""
local options = {"pipe", "--encoding=utf-8"}
if buf.Settings["aspell.lang"] ~= "" then
options = options .. " --lang="
.. buf.Settings["aspell.lang"]
options[#options + 1] = "--lang=" .. buf.Settings["aspell.lang"]
end
if buf.Settings["aspell.dict"] ~= "" then
options = options .. " --master="
.. buf.Settings["aspell.dict"]
options[#options + 1] = "--master=" .. buf.Settings["aspell.dict"]
end
if buf.Settings["aspell.args"] ~= "" then
options = options .. " " .. buf.Settings["aspell.args"]
for _, argument in ipairs(split(buf.Settings["aspell.args"], " ")) do
options[#options + 1] = argument
end
shell.ExecCommand("sh", "-c", "echo '*" .. misspell.word
.. "\n#\n' | aspell pipe" .. options)
local job = shell.JobSpawn("aspell", options, nil, nil, function ()
spellcheck(buf)
end)
shell.JobSend(job, "*" .. misspell.word .. "\n#\n")
job.Stdin:Close()
spellcheck(buf)
if args then
return
end

View file

@ -5,7 +5,8 @@ of XML, HTML, TeX and Markdown. On C++, C and Perl only comments and string
literals will be checked.
You need to have Aspell installed and available in your PATH. It does not come
with this plugin. This plugin also currently doesn't work on Windows.
with this plugin. If you are on Windows, you can install Aspell through
[MSYS2](https://www.msys2.org/).
## Options

View file

@ -4,6 +4,13 @@
"Tags": ["spellchecking", "spelling", "aspell", "spellchecker"],
"Website": "https://github.com/priner/micro-aspell-plugin",
"Versions": [
{
"Version": "1.2.1",
"Url": "https://github.com/priner/micro-aspell-plugin/archive/v1.2.1.zip",
"Require": {
"micro": ">=2.0.7"
}
},
{
"Version": "1.2.0",
"Url": "https://github.com/priner/micro-aspell-plugin/archive/v1.2.0.zip",

View file

@ -0,0 +1,7 @@
# Misspell Plugin for Micro
This repository holds the misspell plugin for micro.
Install with `> plugin install misspell`,
https://github.com/client9/misspell needs to be in your PATH.
This plugin will lint text for spelling mistakes.

View file

@ -0,0 +1,9 @@
VERSION = "0.2.0"
local config = import("micro/config")
function init()
-- uses the default linter plugin
-- matches any filetype
linter.makeLinter("misspell", "", "misspell", {"%f"}, "%f:%l:%c: %m", {}, false, true)
end

View file

@ -0,0 +1,22 @@
[{
"Name": "misspell",
"Description": "plugin that corrects commonly misspelled words",
"Tags": ["spell", "check", "misspell"],
"Website": "https://github.com/onodera-punpun/micro-misspell-plugin",
"Versions": [
{
"Version": "0.2.0",
"Url": "https://github.com/micro-editor/updated-plugins/releases/download/v1.0.0/misspell-0.2.0.zip",
"Require": {
"micro": ">=2.0.0-1"
}
},
{
"Version": "0.1.0",
"Url": "https://github.com/onodera-punpun/micro-misspell-plugin/archive/0.1.0.zip",
"Require": {
"micro": ">=1.0.3"
}
}
]
}]

View file

@ -1,4 +1,5 @@
{
"autosu": true,
"colorscheme": "geany",
"mkparents": true
}