From 1cf8cbe54676f725635b5df895d51b5caaeb49ff Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Thu, 6 Jan 2022 18:11:02 -0800 Subject: [PATCH 1/9] Update luar import path Fixes #2306 --- go.mod | 2 ++ go.sum | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 8a4e06d1..53f4d190 100644 --- a/go.mod +++ b/go.mod @@ -26,4 +26,6 @@ replace github.com/kballard/go-shellquote => github.com/zyedidia/go-shellquote v replace github.com/mattn/go-runewidth => github.com/zyedidia/go-runewidth v0.0.12 +replace layeh.com/gopher-luar => github.com/layeh/gopher-luar v1.0.7 + go 1.16 diff --git a/go.sum b/go.sum index 3cdc362b..9a8bf656 100644 --- a/go.sum +++ b/go.sum @@ -17,6 +17,8 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/layeh/gopher-luar v1.0.7 h1:wnfZhYiJM748y1A4qYBfcFeMY9HWbdERny+ZL0f/jWc= +github.com/layeh/gopher-luar v1.0.7/go.mod h1:TPnIVCZ2RJBndm7ohXyaqfhzjlZ+OA2SZR/YwL8tECk= github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac= github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM= @@ -70,5 +72,3 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -layeh.com/gopher-luar v1.0.7 h1:53iv6CCkRs5wyofZ+qVXcyAYQOIG52s6pt4xkqZdq7k= -layeh.com/gopher-luar v1.0.7/go.mod h1:TPnIVCZ2RJBndm7ohXyaqfhzjlZ+OA2SZR/YwL8tECk= From 80d0654847993ec891e37607a13863480ab44755 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Jan 2022 18:14:50 -0800 Subject: [PATCH 2/9] Bump gopkg.in/yaml.v2 from 2.2.7 to 2.2.8 (#2329) Bumps [gopkg.in/yaml.v2](https://github.com/go-yaml/yaml) from 2.2.7 to 2.2.8. - [Release notes](https://github.com/go-yaml/yaml/releases) - [Commits](https://github.com/go-yaml/yaml/compare/v2.2.7...v2.2.8) --- updated-dependencies: - dependency-name: gopkg.in/yaml.v2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 53f4d190..f5b85ab5 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/zyedidia/tcell/v2 v2.0.8 github.com/zyedidia/terminal v0.0.0-20180726154117-533c623e2415 golang.org/x/text v0.3.2 - gopkg.in/yaml.v2 v2.2.7 + gopkg.in/yaml.v2 v2.2.8 layeh.com/gopher-luar v1.0.7 ) diff --git a/go.sum b/go.sum index 9a8bf656..c3b38c59 100644 --- a/go.sum +++ b/go.sum @@ -70,5 +70,5 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogR gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo= -gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= From f20179519f8cff31263e3695edb51a9402b083ca Mon Sep 17 00:00:00 2001 From: Andrew <48300131+andrewmjordan@users.noreply.github.com> Date: Sat, 8 Jan 2022 19:51:15 -0800 Subject: [PATCH 3/9] Detect more file types for git syntax highlighting (#2330) * Update git-commit.yaml This will enable syntax highlighting for merge commit messages * Update git-commit.yaml --- runtime/syntax/git-commit.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/syntax/git-commit.yaml b/runtime/syntax/git-commit.yaml index 9f8ef0d9..07a71c26 100644 --- a/runtime/syntax/git-commit.yaml +++ b/runtime/syntax/git-commit.yaml @@ -1,7 +1,7 @@ filetype: git-commit detect: - filename: "^(.*[\\/])?(COMMIT_EDITMSG|TAG_EDITMSG)$" + filename: "^(.*[\\/])?(COMMIT_EDITMSG|TAG_EDITMSG|MERGE_MSG|git-rebase-todo)$" rules: # File changes From 9ece5c8a3fca1663994fd76f5e21c218973efe09 Mon Sep 17 00:00:00 2001 From: Shura Date: Sat, 12 Feb 2022 01:13:27 +0300 Subject: [PATCH 4/9] Perl syntax improvement (#2359) * Perl syntax improvement Fixed \" inside strings Fixed comment coloring Improved integer, float, strings variable coloring Added regex coloring * Update perl.yaml --- runtime/syntax/perl.yaml | 45 ++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/runtime/syntax/perl.yaml b/runtime/syntax/perl.yaml index 3fcb8703..edcc9f05 100644 --- a/runtime/syntax/perl.yaml +++ b/runtime/syntax/perl.yaml @@ -1,32 +1,51 @@ filetype: perl detect: - filename: "\\.p[lm]$" + filename: "\\.pp[lmp]$" header: "^#!.*/(env +)?perl( |$)" rules: - - type: "\\b(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\\b|\\b(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\\b|\\b(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\\b|\\b(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\\b|\\b(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\\b" + - type: "\\b(accept|alarm|atan2|bin(d|mode)|c(aller|homp|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\\b|\\b(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\\b|\\b(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|say|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\\b|\\b(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\\b|\\b(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\\b" - statement: "\\b(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\\b" - special: "\\-\\>" - symbol: "(,|\\.)" + + #regexes + - identifier.macro: "m?\\/.*?\\/[a-z]*" + - identifier.macro: "m?\\|.*?\\|[a-z]*" + - identifier.macro: "\\bs/.*?/.*?/[a-z]*" + - identifier.macro: "\\bs\\|.*?\\|.*?\\|[a-z]*" + + - constant.string: + start: '"' + end: '"' + skip: '\\"' + rules: + - identifier.var: '[\\$@%].[a-zA-Z0-9_]*' - - identifier: - start: "[\\$@%]" - end: "\\W" + - constant.string: + start: "'" + end: "'" + skip: "\\\\'" rules: [] - - - constant.string: "\"\\(.*\\)\"|qq?\\|.*\\||qq?\\{.*\\}|qq?\\/.*\\/" - - default: "[sm]/.*/" - - preproc: - start: "(^use| = new)" - end: ";" - rules: [] - + - comment: start: "#" end: "$" rules: [] + + - constant.string: "\"\\(.*\\)\"|qq?\\|.*\\||qq?\\{.*\\}|qq?\\/.*\\/" + - constant.number: "\\b([0-9]*[.])?[0-9]+" + - constant.number: "\\b[0-9]+" + - constant.number: "\\b0x[a-f0-9]+" + - constant.string.url: "`(.+?)`" + - identifier.var: '[\\$@%].[a-zA-Z0-9_]*' + + - preproc: + start: "(^use| = new)" + end: ";" + rules: [] - comment: start: "^=" From 031d953ed542f9ba627f8f763fb2135bec6f2174 Mon Sep 17 00:00:00 2001 From: Andrey Bienkowski Date: Fri, 11 Feb 2022 22:13:35 +0000 Subject: [PATCH 5/9] Help: mention (un)indent in defaultkeys (#2358) --- runtime/help/defaultkeys.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/help/defaultkeys.md b/runtime/help/defaultkeys.md index b724ab56..31941491 100644 --- a/runtime/help/defaultkeys.md +++ b/runtime/help/defaultkeys.md @@ -83,6 +83,8 @@ can change it! | Alt-DownArrow | Move current line or selected lines down | | Alt-Backspace or Alt-Ctrl-h | Delete word left | | Ctrl-a | Select all | +| Tab | Indent selected text | +| Shift-Tab | Unindent selected text | ### Macros From 9ca89ad300225bdf899786ac45fb5905be50e8ca Mon Sep 17 00:00:00 2001 From: Evan Shimoniak Date: Fri, 11 Feb 2022 14:15:26 -0800 Subject: [PATCH 6/9] Made apparent the functionality of the ftoptions plugin (#2321) * Clarified meaning of indentchar setting The description "sets the indentation character" combined with the default value of a space led me to believe that this was a way to set a preference for tabs/spaces and choose a number of spaces per indentation all at once. I've updated the description to try to make its true function clearer. * Added note on rmtrailingws This behavior was unexpected for me, so it's probably good to let other users know which option has precedence. * Added details to help command Initially I kept trying to use `help ` rather than `help commands` * Added warning about ftoptions and tabstospaces The current description for ftoptions states that it "alters some default options depending on the filetype", which hints at this behavior, but does not explicitly state it. * Clarified specific functionality of ftoptions --- runtime/help/options.md | 6 +++++- runtime/help/plugins.md | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/runtime/help/options.md b/runtime/help/options.md index 6b872398..0c6019ec 100644 --- a/runtime/help/options.md +++ b/runtime/help/options.md @@ -369,7 +369,11 @@ Here are the available options: default value: `4` -* `tabstospaces`: use spaces instead of tabs. +* `tabstospaces`: use spaces instead of tabs. Note: This option will be + overridden by [the `ftoptions` plugin](https://github.com/zyedidia/micro/blob/master/runtime/plugins/ftoptions/ftoptions.lua) + for certain filetypes. To disable this behavior, add `"ftoptions": false` to + your config. See [issue #2213](https://github.com/zyedidia/micro/issues/2213) + for more details. default value: `false` diff --git a/runtime/help/plugins.md b/runtime/help/plugins.md index d959488c..c2e202ac 100644 --- a/runtime/help/plugins.md +++ b/runtime/help/plugins.md @@ -401,7 +401,7 @@ There are 6 default plugins that come pre-installed with micro. These are * `autoclose`: automatically closes brackets, quotes, etc... * `comment`: provides automatic commenting for a number of languages -* `ftoptions`: alters some default options depending on the filetype +* `ftoptions`: alters some default options (notably indentation) depending on the filetype * `linter`: provides extensible linting for many languages * `literate`: provides advanced syntax highlighting for the Literate programming tool. From d3b9b37b07c754f0671c1d9fc56e3a053535acd9 Mon Sep 17 00:00:00 2001 From: ftphikari Date: Fri, 11 Feb 2022 14:15:34 -0800 Subject: [PATCH 7/9] runtime/syntax: add rudimentary Odin support (#2296) Odin is a general-purpose programming language with distinct typing, built for high performance, modern systems, and built-in data-oriented data types. The Odin Programming Language, the C alternative for the joy of programming. The Data-Oriented Language for Sane Software Development. https://odin-lang.org/ https://odin-lang.org/docs/overview/ https://github.com/odin-lang/Odin --- runtime/syntax/groovy.yaml | 0 runtime/syntax/odin.yaml | 64 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) mode change 100755 => 100644 runtime/syntax/groovy.yaml create mode 100644 runtime/syntax/odin.yaml diff --git a/runtime/syntax/groovy.yaml b/runtime/syntax/groovy.yaml old mode 100755 new mode 100644 diff --git a/runtime/syntax/odin.yaml b/runtime/syntax/odin.yaml new file mode 100644 index 00000000..1326356c --- /dev/null +++ b/runtime/syntax/odin.yaml @@ -0,0 +1,64 @@ +filetype: odin + +detect: + filename: "\\.odin$" + +rules: + # Conditionals and control flow + - special: "\\b(asm|auto_cast|break|case|cast|context|continue|do|dynamic|fallthrough|return|transmute|using|where)\\b" + - statement: "\\b(else|for|if|switch|in|not_in|or_else|or_return|when)\\b" + - preproc: "\\b(assert|package|foreign|import|proc|defer|make|new|free|delete|copy|len|cap|append|raw_data)\\b" + - preproc: "\\b((size|align|offset|type|type_info|typeid)_of|offset_of_by_string)\\b" + - preproc: "\\b(swizzle|complex|quaternion|real|imag|jmag|kmag|conj|expand_to_tuple|min|max|abs|clamp|soa_zip|soa_unzip|transpose|outer_product|hadamard_product|matrix_flatten)\\b" + - symbol.operator: "[-+/*=<>!~%&|^@]|:\\s*=|:\\s*:|\\?" + + # Types + - symbol: "(,|\\.)" + - type: "\\b(b(8|16|32|64)|(i|u)(8|(16|32|64|128)(le|be)?)|f(16|32|64)(le|be)?|complex(32|64|128)|quaternion(64|128|256))\\b" + - type: "\\b(any|bool|byte|rune|u?int|uintptr|rawptr|c?string|map|matrix|typeid)\\b" + - type.keyword: "\\b(distinct|struct|enum|union|bit_set)\\b" + - constant.bool: "\\b(true|false|nil)\\b" + + # Brackets + - symbol.brackets: "(\\{|\\})" + - symbol.brackets: "(\\(|\\))" + - symbol.brackets: "(\\[|\\])" + + # Numbers and strings + - constant.number: "\\b(0b[01]*|0o[0-7]*|0x[0-9a-fA-F]*|[0-9_]+|0d[0-9]*|0z[0-9abAB]*)\\b|'.'" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "%." + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{1,3}|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - error: "..+" + - constant.specialChar: "%." + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{1,3}|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})" + + - constant.string: + start: "`" + end: "`" + rules: [] + + - comment: + start: "//" + end: "$" + rules: + - todo: "TODO:?|NOTE(\\(.*\\))?:?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "TODO:?|NOTE(\\(.*\\))?:?" From fe59e18e69b0811a754be7c3321c88c670ad3899 Mon Sep 17 00:00:00 2001 From: Philippe Eberli Date: Mon, 14 Feb 2022 22:32:46 +0100 Subject: [PATCH 8/9] Error in documentation of +LINE:COL (#2205) Its +LINE:COL not +LINE,COL --- runtime/help/options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/help/options.md b/runtime/help/options.md index 0c6019ec..4d12687a 100644 --- a/runtime/help/options.md +++ b/runtime/help/options.md @@ -238,7 +238,7 @@ Here are the available options: given line and column 0. Note that with this option enabled it is not possible to open a file such as `file.txt:10:5`, where `:10:5` is part of the filename. It is also possible to open a file with a certain cursor location by using the - `+LINE,COL` flag syntax. See `micro -help` for the command line options. + `+LINE:COL` flag syntax. See `micro -help` for the command line options. default value: `false` From 987e40907137323a97c94dfcdca0cbb96ab05cbc Mon Sep 17 00:00:00 2001 From: 0x5c Date: Tue, 22 Feb 2022 04:31:32 -0500 Subject: [PATCH 9/9] Added lines and percentage statusbar directives (#2055) - "lines" for the number of lines in the buffer - "percentage" for the percentage of the file at the current line Fixes zyedidia#2049 --- internal/display/statusline.go | 6 ++++++ runtime/help/options.md | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/display/statusline.go b/internal/display/statusline.go index 947a3ee7..be808eee 100644 --- a/internal/display/statusline.go +++ b/internal/display/statusline.go @@ -47,6 +47,12 @@ var statusInfo = map[string]func(*buffer.Buffer) string{ } return "" }, + "lines": func(b *buffer.Buffer) string { + return strconv.Itoa(b.LinesNum()) + }, + "percentage": func(b *buffer.Buffer) string { + return strconv.Itoa((b.GetActiveCursor().Y + 1) * 100 / b.LinesNum()) + }, } func SetStatusInfoFnLua(fn string) { diff --git a/runtime/help/options.md b/runtime/help/options.md index 4d12687a..89d85396 100644 --- a/runtime/help/options.md +++ b/runtime/help/options.md @@ -333,7 +333,7 @@ Here are the available options: * `statusformatl`: format string definition for the left-justified part of the statusline. Special directives should be placed inside `$()`. Special - directives include: `filename`, `modified`, `line`, `col`, `opt`, `bind`. + directives include: `filename`, `modified`, `line`, `col`, `lines`, `percentage`, `opt`, `bind`. The `opt` and `bind` directives take either an option or an action afterward and fill in the value of the option or the key bound to the action.