Update syntax files

This commit is contained in:
Zachary Yedidia
2016-04-08 09:22:36 -04:00
parent cc80722c18
commit 739e50d4fe
3 changed files with 79 additions and 38 deletions

15
runtime/syntax/LICENSE Normal file
View File

@@ -0,0 +1,15 @@
micro syntax files
Copyright (C) 2016+ Zachary Yedidia et al.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

View File

@@ -10,3 +10,31 @@ Micro syntax files are almost identical to Nano's, except for some key differenc
* For example, `icolor green ".*"` would become `color green (i) ".*"`
* Micro does not support `start="..." end="..."`. Instead use the `s` flag to match newlines and put `.*?` in the middle
* For example `color green start="hello" end="world"` would become `color green (s) "hello.*?world"`
# Using with colorschemes
Not all of these files have been converted to use micro's colorscheme feature. Most of them just hardcode the colors, which
can be problematic depending on the colorscheme you use.
Here is a list of the files that have been converted to properly use colorschemes:
* vi
* go
* c
* d
* markdown
* html
* lua
* swift
* rust
* java
* javascript
* python
* ruby
* sh
* git
# License
Because the nano syntax files I have modified are distributed under the GNU GPLv3 license, these files are also distributed
under that license. See [LICENSE](runtime/syntax/LICENSE).

View File

@@ -1,12 +1,10 @@
syntax "git-config" "git(config|modules)$|\.git/config$"
color brightcyan "\<(true|false)\>"
color cyan "^[[:space:]]*[^=]*="
color brightmagenta "^[[:space:]]*\[.*\]$"
color yellow ""(\\.|[^"])*"|'(\\.|[^'])*'"
color brightblack "(^|[[:space:]])#([^{].*)?$"
color ,green "[[:space:]]+$"
color ,red " +"
color constant "\<(true|false)\>"
color keyword "^[[:space:]]*[^=]*="
color constant "^[[:space:]]*\[.*\]$"
color constant ""(\\.|[^"])*"|'(\\.|[^'])*'"
color comment "(^|[[:space:]])#([^{].*)?$"
# This code is free software; you can redistribute it and/or modify it under
# the terms of the new BSD License.
@@ -19,62 +17,62 @@ color ,red " +"
syntax "git-commit" "COMMIT_EDITMSG|TAG_EDITMSG"
# Commit message
color yellow ".*"
color ignore ".*"
# Comments
color brightblack "^#.*"
color comment "^#.*"
# Files changes
color white "#[[:space:]](deleted|modified|new file|renamed):[[:space:]].*"
color red "#[[:space:]]deleted:"
color green "#[[:space:]]modified:"
color brightgreen "#[[:space:]]new file:"
color brightblue "#[[:space:]]renamed:"
color keyword "#[[:space:]](deleted|modified|new file|renamed):[[:space:]].*"
color keyword "#[[:space:]]deleted:"
color keyword "#[[:space:]]modified:"
color keyword "#[[:space:]]new file:"
color keyword "#[[:space:]]renamed:"
# Untracked filenames
color black "^# [^/?*:;{}\\]+\.[^/?*:;{}\\]+$"
color error "^# [^/?*:;{}\\]+\.[^/?*:;{}\\]+$"
color brightmagenta "^#[[:space:]]Changes.*[:]"
color brightred "^#[[:space:]]Your branch and '[^']+"
color brightblack "^#[[:space:]]Your branch and '"
color brightwhite "^#[[:space:]]On branch [^ ]+"
color brightblack "^#[[:space:]]On branch"
color keyword "^#[[:space:]]Changes.*[:]"
color keyword "^#[[:space:]]Your branch and '[^']+"
color keyword "^#[[:space:]]Your branch and '"
color keyword "^#[[:space:]]On branch [^ ]+"
color keyword "^#[[:space:]]On branch"
# Recolor hash symbols
# Recolor hash symbols
color brightblack "#"
color special "#"
# Trailing spaces (+LINT is not ok, git uses tabs)
color ,red "[[:space:]]+$"
color ,error "[[:space:]]+$"
# This syntax format is used for interactive rebasing
syntax "git-rebase-todo" "git-rebase-todo"
# Default
color yellow ".*"
color ignore ".*"
# Comments
color brightblack "^#.*"
color comment "^#.*"
# Rebase commands
color green "^(e|edit) [0-9a-f]{7,40}"
color green "^# (e, edit)"
color brightgreen "^(f|fixup) [0-9a-f]{7,40}"
color brightgreen "^# (f, fixup)"
color brightwhite "^(p|pick) [0-9a-f]{7,40}"
color brightwhite "^# (p, pick)"
color blue "^(r|reword) [0-9a-f]{7,40}"
color blue "^# (r, reword)"
color brightred "^(s|squash) [0-9a-f]{7,40}"
color brightred "^# (s, squash)"
color yellow "^(x|exec) [^ ]+ [0-9a-f]{7,40}"
color yellow "^# (x, exec)"
color keyword "^(e|edit) [0-9a-f]{7,40}"
color keyword "^# (e, edit)"
color keyword "^(f|fixup) [0-9a-f]{7,40}"
color keyword "^# (f, fixup)"
color keyword "^(p|pick) [0-9a-f]{7,40}"
color keyword "^# (p, pick)"
color keyword "^(r|reword) [0-9a-f]{7,40}"
color keyword "^# (r, reword)"
color keyword "^(s|squash) [0-9a-f]{7,40}"
color keyword "^# (s, squash)"
color keyword "^(x|exec) [^ ]+ [0-9a-f]{7,40}"
color keyword "^# (x, exec)"
# Recolor hash symbols
color brightblack "#"
color special "#"
# Commit IDs
color brightblue "[0-9a-f]{7,40}"
color identifier "[0-9a-f]{7,40}"