]> git.lizzy.rs Git - micro.git/commitdiff
Merge
authorZachary Yedidia <zyedidia@gmail.com>
Sun, 27 Feb 2022 02:33:35 +0000 (18:33 -0800)
committerZachary Yedidia <zyedidia@gmail.com>
Sun, 27 Feb 2022 02:33:35 +0000 (18:33 -0800)
go.mod
go.sum
internal/display/statusline.go
runtime/help/defaultkeys.md
runtime/help/options.md
runtime/help/plugins.md
runtime/syntax/git-commit.yaml
runtime/syntax/groovy.yaml [changed mode: 0755->0644]
runtime/syntax/odin.yaml [new file with mode: 0644]
runtime/syntax/perl.yaml

diff --git a/go.mod b/go.mod
index 8a4e06d1203fde42796814d685366319428d4492..f5b85ab53fdc10edcb46291b29c27be30c12628b 100644 (file)
--- 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
 )
 
@@ -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 3cdc362b516a4222e45e017040df99b51427696d..c3b38c59324daac606ba38c07a666789e2ea82ab 100644 (file)
--- 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=
@@ -68,7 +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=
-layeh.com/gopher-luar v1.0.7 h1:53iv6CCkRs5wyofZ+qVXcyAYQOIG52s6pt4xkqZdq7k=
-layeh.com/gopher-luar v1.0.7/go.mod h1:TPnIVCZ2RJBndm7ohXyaqfhzjlZ+OA2SZR/YwL8tECk=
+gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
index 947a3ee7b48b828dce783829f0367ac6f8ddfa2f..be808eeec8c8604279b09b2dee453c1e5f44dd24 100644 (file)
@@ -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) {
index b724ab5632a7e596bf9767c396d63395d6ab73ca..31941491e0e76c38159606c38de160d48a6a34e0 100644 (file)
@@ -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
 
index 6b872398a0b2bb3e9f9f826408b73deb3d2baf02..89d85396cb95e3b4bea8c8db27296be9bc1c6717 100644 (file)
@@ -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`
 
@@ -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.
 
@@ -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`
 
index d959488ca5aa2cb4f1112674b48837dd3fd4a340..c2e202ac84394c368a2f98cae2d8616e49a86d9b 100644 (file)
@@ -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.
index 9f8ef0d9dfb077d6037bd0ff35d606b1d559693f..07a71c26e0af5a5412cb169f9884964edafdf0e4 100644 (file)
@@ -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
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/runtime/syntax/odin.yaml b/runtime/syntax/odin.yaml
new file mode 100644 (file)
index 0000000..1326356
--- /dev/null
@@ -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(\\(.*\\))?:?"
index 3fcb8703434817caeb24038ecbec47cd21f3dd84..edcc9f056007a59a7b3697d5ec7d3bed3ed387c8 100644 (file)
@@ -1,33 +1,52 @@
 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: "(,|\\.)"
-
-    - identifier:
-        start: "[\\$@%]"
-        end: "\\W"
+    
+    #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_]*'
+
+    - constant.string:
+        start: "'"
+        end: "'"
+        skip: "\\\\'"
         rules: []
-
+    
+    - comment:
+        start: "#"
+        end: "$"
+        rules: []
+    
     - constant.string: "\"\\(.*\\)\"|qq?\\|.*\\||qq?\\{.*\\}|qq?\\/.*\\/"
-    - default: "[sm]/.*/"
+    - 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: "#"
-        end: "$"
-        rules: []
-
     - comment:
         start: "^="
         end: "^=cut"