This commit is contained in:
Zachary Yedidia 2021-06-17 17:11:35 -04:00
commit 005442a4d0
10 changed files with 103 additions and 62 deletions

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<component>
<id>com.github.zyedidia.micro</id>
<launchable type="desktop-id">micro.desktop</launchable>
<name>Micro Text Editor</name>
<summary>A modern and intuitive terminal-based text editor</summary>
<metadata_license>MIT</metadata_license>

View file

@ -903,7 +903,7 @@ func (h *BufPane) find(useRegex bool) bool {
h.Relocate()
}
}
InfoBar.Prompt(prompt, "", "Find", eventCallback, func(resp string, canceled bool) {
findCallback := func(resp string, canceled bool) {
// Finished callback
if !canceled {
match, found, err := h.Buf.FindNext(resp, h.Buf.Start(), h.Buf.End(), h.searchOrig, true, useRegex)
@ -926,8 +926,15 @@ func (h *BufPane) find(useRegex bool) bool {
h.Cursor.ResetSelection()
}
h.Relocate()
})
}
pattern := string(h.Cursor.GetSelection())
if eventCallback != nil && pattern != "" {
eventCallback(pattern)
}
InfoBar.Prompt(prompt, pattern, "Find", eventCallback, findCallback)
if pattern != "" {
InfoBar.SelectAll()
}
return true
}

File diff suppressed because one or more lines are too long

View file

@ -53,7 +53,7 @@ following in `bindings.json`:
```json
{
"Ctrl-r": "redo"
"Ctrl-r": "Redo"
}
```

View file

@ -86,6 +86,7 @@ function preinit()
makeLinter("swiftc", "swift", "xcrun", {"swiftc", "%f"}, "%f:%l:%c:.+: %m", {"darwin"}, true)
makeLinter("swiftc", "swift", "swiftc", {"%f"}, "%f:%l:%c:.+: %m", {"linux"}, true)
makeLinter("yaml", "yaml", "yamllint", {"--format", "parsable", "%f"}, "%f:%l:%c:.+ %m")
makeLinter("nix-linter", "nix", "nix-linter", {"%f"}, "%m at %f:%l:%c", {"linux"}, true)
config.MakeCommand("lint", function(bp, args)
bp:Save()
@ -123,12 +124,11 @@ function runLinter(buf)
ftmatch = false
end
local args = {}
for k, arg in pairs(v.args) do
args[k] = arg:gsub("%%f", file):gsub("%%d", dir)
end
if ftmatch then
local args = {}
for k, arg in pairs(v.args) do
args[k] = arg:gsub("%%f", file):gsub("%%d", dir)
end
lint(buf, k, v.cmd, args, v.errorformat, v.loffset, v.coffset, v.callback)
end
end

View file

@ -7,6 +7,7 @@ rules:
- identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
- type: "\\b(auto|float|double|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\\b"
- type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
- type: "\\b[a-z_][0-9a-z_]+(_t|_T)\\b"
- type.extended: "\\b(bool)\\b"
- statement: "\\b(volatile|register)\\b"
- statement: "\\b(for|if|while|do|else|case|default|switch)\\b"

View file

@ -7,6 +7,7 @@ rules:
- identifier: "\\b[A-Z_][0-9A-Z_]*\\b"
- type: "\\b(float|double|bool|char|int|short|long|enum|void|struct|union|typedef|(un)?signed|inline)\\b"
- type: "\\b(((s?size)|((u_?)?int(8|16|32|64|ptr))|char(8|16|32))_t|wchar_t)\\b"
- type: "\\b[a-z_][0-9a-z_]+(_t|_T)\\b"
- type: "\\b(final|override)\\b"
- type.keyword: "\\b(auto|volatile|const(expr|eval|init)?|mutable|register|thread_local|static|extern|decltype|explicit|virtual)\\b"
- statement: "\\b(class|namespace|template|typename|this|friend|using|public|protected|private|noexcept)\\b"

View file

@ -38,4 +38,8 @@ rules:
start: "\\(\\*"
end: "\\*\\)"
rules:
- todo: "(TODO|FIXME|WONTFIX|NOTE|HACK):?"
- todo: "(TODO|FIXME|WONTFIX|NOTE|HACK):?"
- comment:
start: "%"
end: "$"
rules: []

View file

@ -18,7 +18,7 @@ rules:
- constant.number: "\\b0[bB][01][01_]+\\b"
- constant.number: "\\b[0-9_]((\\.?)[0-9_]+)?[eE][+\\-][0-9][0-9_]+\\b"
- constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
- comment: "[[:space:]]*#.*$"
- comment: "[[:space:]]*[^\\\\]#.*$"
- comment:
start: "\\#\\["
end: "\\]\\#"

27
runtime/syntax/nix.yaml Normal file
View file

@ -0,0 +1,27 @@
filetype: nix
detect:
filename: "\\.nix$"
rules:
- special: "\\b(Ellipsis|null|self|super|true|false|abort)\\b"
- statement: "\\b(let|in|with|import|rec|inherit)\\b"
- symbol.operator: "([~^.:;,+*|=!\\%@]|<|>|/|-|&)"
- symbol.brackets: "([(){}]|\\[|\\])"
- constant.number: "\\b[0-9](_?[0-9])*(\\.([0-9](_?[0-9])*)?)?(e[0-9](_?[0-9])*)?\\b"
- constant.string:
start: "\""
end: "\""
rules: []
- constant.string:
start: "''"
end: "''"
rules: []
- comment:
start: "#"
end: "$"
rules: []