├── .gitignore
├── .tool-versions
├── runtime
├── files
│ ├── colorschemes
│ │ ├── in_progress
│ │ │ ├── monochrome.micro
│ │ │ ├── monochrome-paper.micro
│ │ │ ├── paper-tc.micro
│ │ │ ├── symbian-tc.micro
│ │ │ ├── gameboy-tc.micro
│ │ │ ├── geany-alt-tc.micro
│ │ │ ├── codeblocks.micro
│ │ │ ├── github.micro
│ │ │ ├── mc.micro
│ │ │ ├── codeblocks-paper.micro
│ │ │ ├── paper.micro
│ │ │ ├── nano.micro
│ │ │ └── funky-cactus.micro
│ │ ├── gruvbox.micro
│ │ ├── geany.micro
│ │ ├── zenburn.micro
│ │ ├── bubblegum.micro
│ │ ├── solarized.micro
│ │ ├── simple.micro
│ │ ├── gruvbox-tc.micro
│ │ ├── github-tc.micro
│ │ ├── solarized-tc.micro
│ │ ├── atom-dark-tc.micro
│ │ ├── railscast.micro
│ │ ├── default.micro
│ │ ├── monokai.micro
│ │ ├── darcula.micro
│ │ ├── twilight.micro
│ │ ├── material-tc.micro
│ │ ├── cmc-paper.micro
│ │ ├── cmc-tc.micro
│ │ └── cmc-16.micro
│ └── syntax
│ │ ├── patch.yaml
│ │ ├── conf.yaml
│ │ ├── man.yaml
│ │ ├── po.yaml
│ │ ├── xml.yaml
│ │ ├── pkg-config.yaml
│ │ ├── sed.yaml
│ │ ├── yum.yaml
│ │ ├── git-config.yaml
│ │ ├── xresources.yaml
│ │ ├── inputrc.yaml
│ │ ├── reST.yaml
│ │ ├── sls.yaml
│ │ ├── privoxy-filter.yaml
│ │ ├── mpdconf.yaml
│ │ ├── vue.yaml
│ │ ├── ledger.yaml
│ │ ├── peg.yaml
│ │ ├── git-rebase-todo.yaml
│ │ ├── lisp.yaml
│ │ ├── colortest.yaml
│ │ ├── caddyfile.yaml
│ │ ├── lfe.yaml
│ │ ├── haml.yaml
│ │ ├── kickstart.yaml
│ │ ├── mail.yaml
│ │ ├── ini.yaml
│ │ ├── keymap.yaml
│ │ ├── pov.yaml
│ │ ├── gentoo-etc-portage.yaml
│ │ ├── vi.yaml
│ │ ├── tex.yaml
│ │ ├── groff.yaml
│ │ ├── privoxy-config.yaml
│ │ ├── json.yaml
│ │ ├── git-commit.yaml
│ │ ├── r.yaml
│ │ ├── syntax_checker.go
│ │ ├── dockerfile.yaml
│ │ ├── yaml.yaml
│ │ ├── coffeescript.yaml
│ │ ├── toml.yaml
│ │ ├── scala.yaml
│ │ ├── dot.yaml
│ │ ├── vala.yaml
│ │ ├── elm.yaml
│ │ ├── glsl.yaml
│ │ ├── java.yaml
│ │ ├── clojure.yaml
│ │ ├── nanorc.yaml
│ │ ├── LICENSE
│ │ ├── markdown.yaml
│ │ ├── julia.yaml
│ │ ├── cmake.yaml
│ │ ├── graphql.yaml
│ │ ├── ruby.yaml
│ │ ├── crontab.yaml
│ │ ├── rust.yaml
│ │ ├── html5.yaml
│ │ ├── micro.yaml
│ │ ├── pony.yaml
│ │ ├── makefile.yaml
│ │ ├── asciidoc.yaml
│ │ ├── html4.yaml
│ │ ├── zig.yaml
│ │ ├── c++.yaml
│ │ ├── cython.yaml
│ │ ├── puppet.yaml
│ │ ├── dart.yaml
│ │ ├── ocaml.yaml
│ │ ├── awk.yaml
│ │ ├── privoxy-action.yaml
│ │ ├── ada.yaml
│ │ ├── perl6.yaml
│ │ ├── haskell.yaml
│ │ ├── solidity.yaml
│ │ ├── html.yaml
│ │ ├── c.yaml
│ │ ├── elixir.yaml
│ │ ├── typescript.yaml
│ │ ├── perl.yaml
│ │ ├── fsharp.yaml
│ │ ├── rpmspec.yaml
│ │ ├── go.yaml
│ │ ├── pascal.yaml
│ │ ├── crystal.yaml
│ │ ├── cpp.yaml
│ │ ├── kotlin.yaml
│ │ ├── sh.yaml
│ │ ├── csharp.yaml
│ │ ├── fish.yaml
│ │ ├── tcl.yaml
│ │ ├── javascript.yaml
│ │ ├── zsh.yaml
│ │ ├── sql.yaml
│ │ ├── gentoo-ebuild.yaml
│ │ ├── nim.yaml
│ │ ├── vhdl.yaml
│ │ ├── erb.yaml
│ │ ├── gdscript.yaml
│ │ ├── objc.yaml
│ │ ├── twig.yaml
│ │ ├── python2.yaml
│ │ ├── python3.yaml
│ │ ├── README.md
│ │ ├── erlang.yaml
│ │ ├── php.yaml
│ │ ├── octave.yaml
│ │ ├── fortran.yaml
│ │ ├── arduino.yaml
│ │ └── lilypond.yaml
├── files.go
└── assets_generate.go
├── go.mod
├── scrollbar.go
├── stack.go
├── LICENSE
├── LICENSE-THIRD-PARTY
├── settings.go
├── cmd
└── femto
│ └── femto.go
├── loc.go
├── README.md
└── rtfiles.go
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 |
--------------------------------------------------------------------------------
/.tool-versions:
--------------------------------------------------------------------------------
1 | golang 1.15.6
2 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/in_progress/monochrome.micro:
--------------------------------------------------------------------------------
1 | #Monochrome
2 | #This makes micro use only the terminal's default
3 | # foreground and background colours.
--------------------------------------------------------------------------------
/runtime/files.go:
--------------------------------------------------------------------------------
1 | //go:generate go run assets_generate.go
2 |
3 | package runtime
4 |
5 | import "github.com/pgavlin/femto"
6 |
7 | var Files = femto.NewRuntimeFiles(files)
8 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/in_progress/monochrome-paper.micro:
--------------------------------------------------------------------------------
1 | #Monochrome Paper theme.
2 | #Edit your files on a white background without colors.
3 | color-link default "black,white"
4 | color-link statusline "white,black"
5 | color-link tabbar "white,black"
--------------------------------------------------------------------------------
/runtime/files/syntax/patch.yaml:
--------------------------------------------------------------------------------
1 | filetype: patch
2 |
3 | detect:
4 | filename: "\\.(patch|diff)$"
5 |
6 | rules:
7 | - brightgreen: "^\\+.*"
8 | - green: "^\\+\\+\\+.*"
9 | - brightblue: "^ .*"
10 | - brightred: "^-.*"
11 | - red: "^---.*"
12 | - brightyellow: "^@@.*"
13 | - magenta: "^diff.*"
14 |
--------------------------------------------------------------------------------
/runtime/files/syntax/conf.yaml:
--------------------------------------------------------------------------------
1 | filetype: conf
2 |
3 | detect:
4 | filename: "\\.c[o]?nf$"
5 |
6 | rules:
7 | - constant.string:
8 | start: "\""
9 | end: "\""
10 | skip: "\\\\."
11 | rules: []
12 |
13 | - comment:
14 | start: "#"
15 | end: "$"
16 | rules: []
17 |
18 |
--------------------------------------------------------------------------------
/runtime/files/syntax/man.yaml:
--------------------------------------------------------------------------------
1 | filetype: man
2 |
3 | detect:
4 | filename: "\\.[1-9]x?$"
5 |
6 | rules:
7 | - green: "\\.(S|T)H.*$"
8 | - brightgreen: "\\.(S|T)H|\\.TP"
9 | - brightred: "\\.(BR?|I[PR]?).*$"
10 | - brightblue: "\\.(BR?|I[PR]?|PP)"
11 | - brightwhite: "\\\\f[BIPR]"
12 | - yellow: "\\.(br|DS|RS|RE|PD)"
13 |
--------------------------------------------------------------------------------
/runtime/files/syntax/po.yaml:
--------------------------------------------------------------------------------
1 | filetype: po
2 |
3 | detect:
4 | filename: "\\.pot?$"
5 |
6 | rules:
7 | - preproc: "\\b(msgid|msgstr)\\b"
8 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
9 | - special: "\\\\.?"
10 | - comment: "(^|[[:space:]])#([^{].*)?$"
11 | - indent-char.whitespace: "[[:space:]]+$"
12 | - indent-char: " + +| + +"
13 |
--------------------------------------------------------------------------------
/runtime/files/syntax/xml.yaml:
--------------------------------------------------------------------------------
1 | filetype: xml
2 |
3 | detect:
4 | filename: "\\.(xml|sgml?|rng|plist)$"
5 |
6 | rules:
7 | - identifier: "<.*?>"
8 | - comment:
9 | start: ""
11 | rules: []
12 | - comment:
13 | start: ""
15 | rules: []
16 | - special: "&[^;]*;"
17 |
--------------------------------------------------------------------------------
/runtime/assets_generate.go:
--------------------------------------------------------------------------------
1 | // +build ignore
2 |
3 | package main
4 |
5 | import (
6 | "log"
7 | "net/http"
8 |
9 | "github.com/shurcooL/vfsgen"
10 | )
11 |
12 | func main() {
13 | fs := http.Dir("./files")
14 |
15 | err := vfsgen.Generate(fs, vfsgen.Options{
16 | PackageName: "runtime",
17 | VariableName: "files",
18 | })
19 | if err != nil {
20 | log.Fatalln(err)
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/runtime/files/syntax/pkg-config.yaml:
--------------------------------------------------------------------------------
1 | filetype: pc
2 |
3 | detect:
4 | filename: "\\.pc$"
5 |
6 | rules:
7 | - preproc: "^(Name|Description|URL|Version|Conflicts|Cflags):"
8 | - preproc: "^(Requires|Libs)(\\.private)?:"
9 | - symbol.operator: "="
10 | - identifier.var: "\\$\\{[A-Za-z_][A-Za-z0-9_]*\\}"
11 | - indent-char.whitespace: "[[:space:]]+$"
12 | - indent-char: " + +| + +"
13 |
--------------------------------------------------------------------------------
/runtime/files/syntax/sed.yaml:
--------------------------------------------------------------------------------
1 | filetype: sed
2 |
3 | detect:
4 | filename: "\\.sed$"
5 | header: "^#!.*bin/(env +)?sed( |$)"
6 |
7 | rules:
8 | - symbol.operator: "[|^$.*+]"
9 | - constant.number: "\\{[0-9]+,?[0-9]*\\}"
10 | - constant.specialChar: "\\\\."
11 | - comment: "(^|[[:space:]])#([^{].*)?$"
12 | - indent-char.whitespace: "[[:space:]]+$"
13 | - indent-char: " + +| + +"
14 |
--------------------------------------------------------------------------------
/runtime/files/syntax/yum.yaml:
--------------------------------------------------------------------------------
1 | filetype: yum
2 |
3 | detect:
4 | filename: "\\.repo$|yum.*\\.conf$"
5 |
6 | rules:
7 | - identifier: "^[[:space:]]*[^=]*="
8 | - constant.specialChar: "^[[:space:]]*\\[.*\\]$"
9 | - statement: "\\$(releasever|arch|basearch|uuid|YUM[0-9])"
10 | - comment: "(^|[[:space:]])#([^{].*)?$"
11 | - indent-char.whitespace: "[[:space:]]+$"
12 | - indent-char: " + +| + +"
13 |
--------------------------------------------------------------------------------
/runtime/files/syntax/git-config.yaml:
--------------------------------------------------------------------------------
1 | filetype: git-config
2 |
3 | detect:
4 | filename: "git(config|modules)$|\\.git/config$"
5 |
6 | rules:
7 | - constant: "\\<(true|false)\\>"
8 | - type.keyword: "^[[:space:]]*[^=]*="
9 | - constant: "^[[:space:]]*\\[.*\\]$"
10 | - constant: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
11 | - comment:
12 | start: "#"
13 | end: "$"
14 | rules: []
15 |
--------------------------------------------------------------------------------
/runtime/files/syntax/xresources.yaml:
--------------------------------------------------------------------------------
1 | filetype: xresources
2 |
3 | detect:
4 | filename: "X(defaults|resources)$"
5 |
6 | rules:
7 | - special: "^[[:alnum:]]+\\*"
8 | - identifier.var: "\\*[[:alnum:]]+\\:"
9 | - constant.number: "\\b[0-9]+\\b"
10 | - symbol.operator: "[*:=]"
11 | - constant.bool: "\\b(true|false)\\b"
12 | - comment: "(^|[[:space:]])!([^{].*)?$"
13 | - indent-char.whitespace: "[[:space:]]+$"
14 | - indent-char: " + +| + +"
15 |
--------------------------------------------------------------------------------
/runtime/files/syntax/inputrc.yaml:
--------------------------------------------------------------------------------
1 | filetype: inputrc
2 |
3 | detect:
4 | filename: "inputrc$"
5 |
6 | rules:
7 | - constant.bool.false: "\\b(off|none)\\b"
8 | - constant.bool.true: "\\bon\\b"
9 | - preproc: "\\bset|\\$include\\b"
10 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
11 | - constant.specialChar: "\\\\.?"
12 | - comment: "(^|[[:space:]])#([^{].*)?$"
13 | - indent-char.whitespace: "[[:space:]]+$"
14 | - indent-char: " + +| + +"
15 |
--------------------------------------------------------------------------------
/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/pgavlin/femto
2 |
3 | go 1.12
4 |
5 | require (
6 | github.com/atotto/clipboard v0.1.2
7 | github.com/gdamore/tcell/v2 v2.1.0
8 | github.com/mattn/go-runewidth v0.0.9
9 | github.com/rivo/tview v0.0.0-20201204190810-5406288b8e4e
10 | github.com/sergi/go-diff v1.1.0
11 | github.com/zyedidia/micro v1.4.1
12 | golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e // indirect
13 | golang.org/x/text v0.3.4 // indirect
14 | gopkg.in/yaml.v2 v2.4.0 // indirect
15 | )
16 |
--------------------------------------------------------------------------------
/runtime/files/syntax/reST.yaml:
--------------------------------------------------------------------------------
1 | filetype: rst
2 |
3 | detect:
4 | filename: "\\.rest$|\\.rst$"
5 |
6 | rules:
7 | - statement: "\\*\\*[^*]+\\*\\*"
8 | - preproc: "::"
9 | - constant.string: "`[^`]+`_{1,2}"
10 | - constant.string: "``[^`]+``"
11 | - identifier: "^\\.\\. .*$"
12 | - identifier: "^__ .*$"
13 | - type: "^###+$"
14 | - type: "^\\*\\*\\*+$"
15 | - special: "^===+$"
16 | - special: "^---+$"
17 | - special: "^\\^\\^\\^+$"
18 | - special: "^\"\"\"+$"
19 |
--------------------------------------------------------------------------------
/runtime/files/syntax/sls.yaml:
--------------------------------------------------------------------------------
1 | filetype: salt
2 |
3 | detect:
4 | filename: "\\.sls$"
5 |
6 | rules:
7 | - identifier.var: "^[^ -].*:$"
8 | - identifier.var: ".*:"
9 | - default: "salt:"
10 | - constant.number: "/*[0-9]/*"
11 | - constant.bool: "\\b(True|False)\\b"
12 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
13 | - special: "\\b(grain|grains|compound|pcre|grain_pcre|list|pillar)\\b"
14 | - comment: "^#.*"
15 | - statement: "\\b(if|elif|else|or|not|and|endif|end)\\b"
16 |
--------------------------------------------------------------------------------
/runtime/files/syntax/privoxy-filter.yaml:
--------------------------------------------------------------------------------
1 | filetype: privoxy-filter
2 |
3 | detect:
4 | filename: "\\.filter$"
5 |
6 | rules:
7 | - statement: "^(FILTER|CLIENT-HEADER-FILTER|CLIENT-HEADER-TAGGER|SERVER-HEADER-FILTER|SERVER-HEADER-TAGGER): [a-z-]+"
8 | - identifier: "^(FILTER|CLIENT-HEADER-FILTER|CLIENT-HEADER-TAGGER|SERVER-HEADER-FILTER|SERVER-HEADER-TAGGER):"
9 | - constant.specialChar: "\\\\.?"
10 | - comment: "(^|[[:space:]])#([^{].*)?$"
11 | - indent-char.whitespace: "[[:space:]]+$"
12 | - indent-char: " + +| + +"
13 |
--------------------------------------------------------------------------------
/runtime/files/syntax/mpdconf.yaml:
--------------------------------------------------------------------------------
1 | filetype: mpd
2 |
3 | detect:
4 | filename: "mpd\\.conf$"
5 |
6 | rules:
7 | - statement: "\\b(user|group|bind_to_address|host|port|plugin|name|type)\\b"
8 | - statement: "\\b((music|playlist)_directory|(db|log|state|pid|sticker)_file)\\b"
9 | - special: "^(input|audio_output|decoder)[[:space:]]*\\{|\\}"
10 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
11 | - comment: "(^|[[:space:]])#([^{].*)?$"
12 | - indent-char.whitespace: "[[:space:]]+$"
13 | - indent-char: " + +| + +"
14 |
--------------------------------------------------------------------------------
/runtime/files/syntax/vue.yaml:
--------------------------------------------------------------------------------
1 | filetype: vue
2 |
3 | detect:
4 | filename: "\\.vue$"
5 |
6 | rules:
7 | - default:
8 | start: ""
9 | end: ""
10 | rules:
11 | - include: "html5"
12 |
13 | - default:
14 | start: ""
15 | end: ""
16 | rules:
17 | - include: "javascript"
18 |
19 | - default:
20 | start: ""
21 | end: ""
22 | rules:
23 | - include: "css"
24 |
--------------------------------------------------------------------------------
/runtime/files/syntax/ledger.yaml:
--------------------------------------------------------------------------------
1 | filetype: ledger
2 |
3 | detect:
4 | filename: "(^|\\.|/)(ledger|ldgr|beancount|bnct)$"
5 |
6 | rules:
7 | - special: "^([0-9]{4}(/|-)[0-9]{2}(/|-)[0-9]{2}|[=~]) .*"
8 | - constant: "^[0-9]{4}(/|-)[0-9]{2}(/|-)[0-9]{2}"
9 | - statement: "^~ .*"
10 | - identifier.var: "^= .*"
11 | - identifier: "^[[:space:]]+(![[:space:]]+)?\\(?[A-Za-z ]+(:[A-Za-z ]+)*\\)?"
12 | - identifier: "^[[:space:]]+(![[:space:]]+)?\\(?[A-Za-z_\\-]+(:[A-Za-z_\\-]+)*\\)?"
13 | - symbol: "[*!]"
14 | - comment: "^[[:space:]]*;.*"
15 |
--------------------------------------------------------------------------------
/runtime/files/syntax/peg.yaml:
--------------------------------------------------------------------------------
1 | filetype: peg
2 |
3 | detect:
4 | filename: "\\.l?peg$"
5 |
6 | rules:
7 | - identifier: "^[[:space:]]*[A-Za-z][A-Za-z0-9_]*[[:space:]]*<-"
8 | - constant.number: "\\^[+-]?[0-9]+"
9 | - symbol.operator: "[-+*?^/!&]|->|<-|=>"
10 | - identifier.var: "%[A-Za-z][A-Za-z0-9_]*"
11 | - special: "\\[[^]]*\\]"
12 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
13 | - comment: "(^|[[:space:]])\\-\\-.*$"
14 | - todo: "TODO:?"
15 | - indent-char.whitespace: "[[:space:]]+$"
16 | - indent-char: " + +| + +"
17 |
--------------------------------------------------------------------------------
/runtime/files/syntax/git-rebase-todo.yaml:
--------------------------------------------------------------------------------
1 | filetype: git-rebase-todo
2 |
3 | detect:
4 | filename: "^(.*[\\/])?git\\-rebase\\-todo$"
5 |
6 | rules:
7 | # Rebase commands
8 | - statement: "^(p(ick)?|r(eword)?|e(dit)?|s(quash)?|f(ixup)?|x|exec|d(rop)?)\\b"
9 | # Commit IDs
10 | - identifier: "\\b([0-9a-f]{7,40})\\b"
11 |
12 | # Color keywords for Github (and others)
13 | - type.keyword: "\\b(?i)((fix(es|ed)?|close(s|d)?) #[0-9]+)\\b"
14 |
15 | # Comments
16 | - comment.line:
17 | start: "^#"
18 | end: "$"
19 | rules: []
20 |
--------------------------------------------------------------------------------
/runtime/files/syntax/lisp.yaml:
--------------------------------------------------------------------------------
1 | filetype: lisp
2 |
3 | detect:
4 | filename: "(emacs|zile)$|\\.(el|li?sp|scm|ss)$"
5 |
6 | rules:
7 | - default: "\\([a-z-]+"
8 | - symbol: "\\(([\\-+*/<>]|<=|>=)|'"
9 | - constant.number: "\\b[0-9]+b>"
10 | - special: "\\bnil\\b"
11 | - preproc: "\\b[tT]b>"
12 | - constant.string: "\\\"(\\\\.|[^\"])*\\\""
13 | - constant.specialChar: "'[A-Za-z][A-Za-z0-9_-]+"
14 | - constant.specialChar: "\\\\.?"
15 | - comment: "(^|[[:space:]]);.*"
16 | - indent-char.whitespace: "[[:space:]]+$"
17 | - indent-char: " + +| + +"
18 |
--------------------------------------------------------------------------------
/runtime/files/syntax/colortest.yaml:
--------------------------------------------------------------------------------
1 | filetype: colortest
2 |
3 | detect:
4 | filename: "ColorTest$"
5 |
6 | rules:
7 | - black: "\\bPLAIN\\b"
8 | - red: "\\bred\\b"
9 | - green: "\\bgreen\\b"
10 | - yellow: "\\byellow\\b"
11 | - blue: "\\bblue\\b"
12 | - magenta: "\\bmagenta\\b"
13 | - cyan: "\\bcyan\\b"
14 | - brightred: "\\bbrightred\\b"
15 | - brightgreen: "\\bbrightgreen\\b"
16 | - brightyellow: "\\bbrightyellow\\b"
17 | - brightblue: "\\bbrightblue\\b"
18 | - brightmagenta: "\\bbrightmagenta\\b"
19 | - brightcyan: "\\bbrightcyan\\b"
20 |
--------------------------------------------------------------------------------
/runtime/files/syntax/caddyfile.yaml:
--------------------------------------------------------------------------------
1 | filetype: caddyfile
2 |
3 | detect:
4 | filename: "Caddyfile"
5 |
6 | rules:
7 | - identifier: "^\\s*\\S+(\\s|$)"
8 | - type: "^([\\w.:/-]+,? ?)+[,{]$"
9 | - constant.specialChar: "\\s{$"
10 | - constant.specialChar: "^\\s*}$"
11 | - constant.string:
12 | start: "\""
13 | end: "\""
14 | skip: "\\\\."
15 | rules:
16 | - constant.specialChar: "\\\\."
17 |
18 | - preproc: "\\{(\\w+|\\$\\w+|%\\w+%)\\}"
19 | - comment:
20 | start: "#"
21 | end: "$"
22 | rules: []
23 |
24 |
--------------------------------------------------------------------------------
/runtime/files/syntax/lfe.yaml:
--------------------------------------------------------------------------------
1 | filetype: lfe
2 |
3 | detect:
4 | filename: "lfe$|\\.lfe$"
5 |
6 | rules:
7 | - symbol.brackets: "\\(|\\)"
8 | - type: "defun|define-syntax|define|defmacro|defmodule|export"
9 | - constant: "\\ [A-Za-z][A-Za-z0-9_-]+\\ "
10 | - symbol.operator: "\\(([\\-+*/<>]|<=|>=)|'"
11 | - constant.number: "\\b[0-9]+\\b"
12 | - constant.string: "\\\"(\\\\.|[^\"])*\\\""
13 | - special: "['|`][A-Za-z][A-Za-z0-9_\\-]+"
14 | - constant.specialChar: "\\\\.?"
15 | - comment: "(^|[[:space:]]);.*"
16 | - indent-char.whitespace: "[[:space:]]+$"
17 | - indent-char: " + +| + +"
18 |
--------------------------------------------------------------------------------
/scrollbar.go:
--------------------------------------------------------------------------------
1 | package femto
2 |
3 | import (
4 | "github.com/gdamore/tcell/v2"
5 | )
6 |
7 | // ScrollBar represents an optional scrollbar that can be used
8 | type ScrollBar struct {
9 | view *View
10 | }
11 |
12 | // Display shows the scrollbar
13 | func (sb *ScrollBar) Display(screen tcell.Screen) {
14 | style := defStyle.Reverse(true)
15 | screen.SetContent(sb.view.x+sb.view.width-1, sb.view.y+sb.pos(), ' ', nil, style)
16 | }
17 |
18 | func (sb *ScrollBar) pos() int {
19 | numlines := sb.view.Buf.NumLines
20 | h := sb.view.height
21 | filepercent := float32(sb.view.Topline) / float32(numlines)
22 |
23 | return int(filepercent * float32(h))
24 | }
25 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/gruvbox.micro:
--------------------------------------------------------------------------------
1 | color-link default "223,235"
2 | color-link comment "243,235"
3 | color-link constant "175,235"
4 | color-link constant.string "142,235"
5 | color-link identifier "109,235"
6 | color-link statement "124,235"
7 | color-link symbol "124,235"
8 | color-link preproc "72,235"
9 | color-link type "214,235"
10 | color-link special "172,235"
11 | color-link underlined "underline 109,235"
12 | color-link error "235,124"
13 | color-link todo "bold 223,235"
14 | color-link line-number "243,237"
15 | color-link current-line-number "172,237"
16 | color-link cursor-line "237"
17 | color-link color-column "237"
18 | color-link statusline "223,237"
19 | color-link tabbar "223,237"
--------------------------------------------------------------------------------
/runtime/files/syntax/haml.yaml:
--------------------------------------------------------------------------------
1 | filetype: haml
2 |
3 | detect:
4 | filename: "\\.haml$"
5 |
6 | rules:
7 | - symbol: "-|="
8 | - default: "->|=>"
9 | - constant: "([ ]|^)%[0-9A-Za-z_]+>"
10 | - special: ":[0-9A-Za-z_]+>"
11 | - type: "\\.[A-Za-z_]+>"
12 | - constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!"
13 | - constant.string: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!"
14 | - identifier: "#\\{[^}]*\\}"
15 | - identifier.var: "(@|@@)[0-9A-Z_a-z]+"
16 | - comment: "#[^{].*$|#$"
17 |
--------------------------------------------------------------------------------
/runtime/files/syntax/kickstart.yaml:
--------------------------------------------------------------------------------
1 | filetype: kickstart
2 |
3 | detect:
4 | filename: "\\.ks$|\\.kickstart$"
5 |
6 | rules:
7 | - special: "%[a-z]+"
8 | - statement: "^[[:space:]]*(install|cdrom|text|graphical|volgroup|logvol|reboot|timezone|lang|keyboard|authconfig|firstboot|rootpw|user|firewall|selinux|repo|part|partition|clearpart|bootloader)"
9 | - constant: "--(name|mirrorlist|baseurl|utc)(=|\\>)"
10 | - statement: "\\$(releasever|basearch)\\>"
11 | - brightblack: "^@[A-Za-z][A-Za-z-]*"
12 | - brightred: "^-@[a-zA-Z0-9*-]+"
13 | - red: "^-[a-zA-Z0-9*-]+"
14 | - comment: "(^|[[:space:]])#([^{].*)?$"
15 | - indent-char.whitespace: "[[:space:]]+$"
16 | - indent-char: " + +| + +"
17 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/in_progress/paper-tc.micro:
--------------------------------------------------------------------------------
1 | #Paper theme, true color edition
2 | #Edit on an *actual* white background!
3 | color-link default "#000000,#efefef"
4 | color-link comment ""
5 | color-link constant ""
6 | color-link constant.string ""
7 | color-link constant.string.url "underline #0000dd"
8 | color-link identifier ""
9 | color-link identifier.var ""
10 | color-link special ""
11 | color-link statement ""
12 | color-link symbol ""
13 | color-link symbol.brackets ""
14 | color-link symbol.tag ""
15 | color-link type ""
16 | color-link statusline ""
17 | color-link tabbar ""
18 | color-link error ""
19 | color-link todo ""
20 | color-link color-column ""
21 | color-link gutter-error ""
22 | color-link gutter-warning ""
--------------------------------------------------------------------------------
/runtime/files/syntax/mail.yaml:
--------------------------------------------------------------------------------
1 | filetype: mail
2 |
3 | detect:
4 | filename: "(.*/mutt-.*|\\.eml)$"
5 | header: "^From .* \\d+:\\d+:\\d+ \\d+"
6 |
7 | rules:
8 | - type: "^From .*"
9 | - identifier: "^[^[:space:]]+:"
10 | - preproc: "^List-(Id|Archive|Subscribe|Unsubscribe|Post|Help):"
11 | - constant: "^(To|From):"
12 | - constant.string:
13 | start: "^Subject:.*"
14 | end: "$"
15 | rules:
16 | - constant.specialChar: "\\\\."
17 | - statement: "[^@[:space:]]+@[^[:space:]]+>?"
18 | - default:
19 | start: "^\\n\\n"
20 | end: ".*"
21 | rules: []
22 | - comment:
23 | start: "^>.*"
24 | end: "$"
25 | rules: []
26 |
--------------------------------------------------------------------------------
/runtime/files/syntax/ini.yaml:
--------------------------------------------------------------------------------
1 | filetype: ini
2 |
3 | detect:
4 | filename: "\\.(ini|desktop|lfl|override|tscn|tres)$|(mimeapps\\.list|pinforc|setup\\.cfg|project\\.godot)$|weechat/.+\\.conf$"
5 |
6 | rules:
7 | - constant.bool.true: "\\btrue\\b"
8 | - constant.bool.false: "\\bfalse\\b"
9 | - identifier: "^[[:space:]]*[^=]*="
10 | - special: "^[[:space:]]*\\[.*\\]$"
11 | - statement: "[=;]"
12 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
13 |
14 | - comment:
15 | start: "#"
16 | end: "$"
17 | rules:
18 | - todo: "(TODO|XXX|FIXME):?"
19 | - comment:
20 | start: ";"
21 | end: "$"
22 | rules:
23 | - todo: "(TODO|XXX|FIXME):?"
24 |
--------------------------------------------------------------------------------
/runtime/files/syntax/keymap.yaml:
--------------------------------------------------------------------------------
1 | filetype: keymap
2 |
3 | detect:
4 | filename: "\\.(k|key)?map$|Xmodmap$"
5 |
6 | rules:
7 | - statement: "\\b(add|clear|compose|keycode|keymaps|keysym|remove|string)\\b"
8 | - statement: "\\b(control|alt|shift)\\b"
9 | - constant.number: "\\b[0-9]+\\b"
10 | - special: "="
11 | - constant.string:
12 | start: "\""
13 | end: "\""
14 | skip: "\\\\."
15 | rules:
16 | - constant.specialChar: "\\\\."
17 | - constant.string:
18 | start: "'"
19 | end: "'"
20 | skip: "\\\\."
21 | rules:
22 | - constant.specialChar: "\\\\."
23 | - comment:
24 | start: "^!"
25 | end: "$"
26 | rules: []
27 |
28 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/geany.micro:
--------------------------------------------------------------------------------
1 | #Geany
2 | color-link comment "red"
3 | color-link constant "default"
4 | color-link constant.number
5 | color-link constant.string "bold yellow"
6 | color-link identifier "default"
7 | color-link preproc "cyan"
8 | color-link special "blue"
9 | color-link statement "blue"
10 | color-link symbol "default"
11 | color-link symbol.tag "bold blue"
12 | color-link type "blue"
13 | color-link type.extended "default"
14 | color-link error "red"
15 | color-link todo "bold cyan"
16 | color-link indent-char "bold black"
17 | color-link line-number ""
18 | color-link current-line-number ""
19 | color-link statusline "black,white"
20 | color-link tabbar "black,white"
21 | color-link color-column "bold geren"
22 | color-link gutter-error ",red"
23 | color-link gutter-warning "red"
--------------------------------------------------------------------------------
/runtime/files/colorschemes/in_progress/symbian-tc.micro:
--------------------------------------------------------------------------------
1 | #Symbian
2 | color-link default "#000000,#ff8a00"
3 | color-link comment "#8c0000"
4 | color-link constant "#8c0000"
5 | color-link identifier "#ffff8c"
6 | color-link preproc "#ffff8c,#8c0000"
7 | color-link special "#8c0000"
8 | color-link statement "#8c0000"
9 | color-link symbol "#8c0000"
10 | color-link type "#8c0000"
11 | color-link error "#ffff8c,#8c0000"
12 | color-link todo "#8c0000,#ffff8c"
13 | color-link statusline "#ffff8c,#8c0000"
14 | color-link tabbar "#ffff8c,#8c0000"
15 | color-link color-column "#8c0000"
16 | color-link line-number "#ffff8c,#8c0000"
17 | color-link current-line-number "#000000,#ff8a00"
18 | color-link gutter-error "#ffff8c,#8c0000"
19 | color-link gutter-warning "default"
20 | #000000
21 | #8c0000
22 | #ff8a00
23 | #ffff8c
--------------------------------------------------------------------------------
/runtime/files/colorschemes/in_progress/gameboy-tc.micro:
--------------------------------------------------------------------------------
1 | #Gameboy theme
2 | color-link default "#3f3f3f,#bfc180"
3 | color-link comment "#7d7343"
4 | color-link constant "#7d7343"
5 | color-link identifier "#ddde7d"
6 | color-link preproc "#ddde7d,#7d7343"
7 | color-link special "#7d7343"
8 | color-link statement "#7d7343"
9 | color-link symbol "#7d7343"
10 | color-link type "#7d7343"
11 | color-link error "#ddde7d,#7d7343"
12 | color-link todo "#7d7343,#ddde7d"
13 | color-link statusline "#ddde7d,#7d7343"
14 | color-link tabbar "#ddde7d,#7d7343"
15 | color-link color-column "#7d7343"
16 | color-link line-number "#ddde7d,#7d7343"
17 | color-link current-line-number "#3f3f3f,#bfc180"
18 | color-link gutter-error "#ddde7d,#7d7343"
19 | color-link gutter-warning "default"
20 | #3f3f3f
21 | #7d7343
22 | #bfc180
23 | #ddde76
--------------------------------------------------------------------------------
/runtime/files/colorschemes/in_progress/geany-alt-tc.micro:
--------------------------------------------------------------------------------
1 | #Geany Alternate theme
2 | color-link default "#000000,#fefefe"
3 | color-link comment "#808080"
4 | color-link constant "default"
5 | color-link constant.bool "#003030"
6 | color-link constant.number "#300008"
7 | color-link constant.string "#008000"
8 | color-link identifier "default"
9 | color-link preproc "#bbbb77"
10 | color-link special "#003030"
11 | color-link statement "#003030"
12 | color-link symbol "#300008"
13 | color-link symbol.tag "bold #4e9d71"
14 | color-link type "#003030"
15 | color-link error "#a52a2a"
16 | color-link todo "#ffa500"
17 | color-link line-number "#000000,#d0d0d0"
18 | color-link current-line-number "#000000,#d0d0d0"
19 | color-link color-column "#c2ebc2"
20 | color-link cursor-line "#f0f0f0"
21 | color-link type.extended "default"
--------------------------------------------------------------------------------
/runtime/files/syntax/pov.yaml:
--------------------------------------------------------------------------------
1 | filetype: pov
2 |
3 | detect:
4 | filename: "\\.(pov|POV|povray|POVRAY)$"
5 |
6 | rules:
7 | - preproc: "^[[:space:]]*#[[:space:]]*(declare)"
8 | - statement: "\\b(sphere|cylinder|translate|matrix|rotate|scale)\\b"
9 | - statement: "\\b(orthographic|location|up|right|direction|clipped_by)\\b"
10 | - statement: "\\b(fog_type|fog_offset|fog_alt|rgb|distance|transform)\\b"
11 | - identifier: "^\\b(texture)\\b"
12 | - identifier: "\\b(light_source|background)\\b"
13 | - identifier: "\\b(fog|object|camera)\\b"
14 | - symbol.operator: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)"
15 | - special: "\\b(union|group|subgroup)\\b"
16 | - comment: "//.*"
17 | - comment:
18 | start: "/\\*"
19 | end: "\\*/"
20 | rules: []
21 |
22 |
--------------------------------------------------------------------------------
/runtime/files/syntax/gentoo-etc-portage.yaml:
--------------------------------------------------------------------------------
1 | filetype: etc-portage
2 |
3 | detect:
4 | filename: "\\.(keywords|mask|unmask|use)(/.+)?$"
5 |
6 | rules:
7 | # Use flags:
8 | - constant.bool.false: "[[:space:]]+\\+?[a-zA-Z0-9_-]+"
9 | - constant.bool.true: "[[:space:]]+-[a-zA-Z0-9_-]+"
10 | # Likely version numbers:
11 | - special: "-[[:digit:]].*([[:space:]]|$)"
12 | # Accepted arches:
13 | - identifier.class: "[~-]?\\b(alpha|amd64|arm|hppa|ia64|mips|ppc|ppc64|s390|sh|sparc|x86|x86-fbsd)\\b"
14 | - identifier.class: "[[:space:]][~-]?\\*"
15 | # Categories:
16 | - statement: "^[[:space:]]*.*/"
17 | # Masking regulators:
18 | - symbol: "^[[:space:]]*(=|~|<|<=|=<|>|>=|=>)"
19 | # Comments:
20 | - comment:
21 | start: "#"
22 | end: "$"
23 | rules: []
24 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/zenburn.micro:
--------------------------------------------------------------------------------
1 | color-link default "188,237"
2 | color-link comment "108,237"
3 | color-link constant.string "174,237"
4 | color-link constant.number "116,237"
5 | color-link constant "181,237"
6 | color-link identifier "223,237"
7 | color-link statement "223,237"
8 | color-link symbol "223,237"
9 | color-link preproc "223,237"
10 | color-link type "187,237"
11 | color-link special "181,237"
12 | color-link underlined "188,237"
13 | color-link error "115,236"
14 | color-link todo "bold 254,237"
15 | color-link statusline "186,236"
16 | color-link tabbar "186,236"
17 | color-link indent-char "238,237"
18 | color-link line-number "248,238"
19 | color-link gutter-error "237,174"
20 | color-link gutter-warning "174,237"
21 | color-link cursor-line "238"
22 | color-link color-column "238"
23 | color-link current-line-number "188,237"
24 |
--------------------------------------------------------------------------------
/runtime/files/syntax/vi.yaml:
--------------------------------------------------------------------------------
1 | filetype: vi
2 |
3 | detect:
4 | filename: "(^|/|\\.)(ex|vim)rc$|\\.vim"
5 |
6 | rules:
7 | - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"
8 | - statement: "\\b([nvxsoilc]?(nore|un)?map|[nvlx]n|[ico]?no|[cilovx][um]|s?unm)\\b"
9 | - statement: "\\b(snor|nun|nm|set|if|endif|let|unlet)\\b"
10 | - statement: "[!&=]"
11 | - constant.number: "\\b[0-9]+\\b"
12 |
13 | - constant.string:
14 | start: "\""
15 | end: "\""
16 | skip: "\\\\."
17 | rules:
18 | - constant.specialChar: "\\\\."
19 |
20 | - constant.string:
21 | start: "'"
22 | end: "'"
23 | skip: "\\\\."
24 | rules:
25 | - constant.specialChar: "\\\\."
26 |
27 | - constant.comment:
28 | start: "\""
29 | end: "$"
30 | rules: []
31 |
32 |
33 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/bubblegum.micro:
--------------------------------------------------------------------------------
1 | color-link default "241,231"
2 | color-link comment "246,231"
3 | color-link constant "130,231"
4 | color-link constant.string "136,231"
5 | color-link constant.number "131,231"
6 | color-link identifier "133,231"
7 | color-link statement "32,231"
8 | color-link symbol "32,231"
9 | color-link preproc "28,231"
10 | color-link type "61,231"
11 | color-link special "167,231"
12 | color-link error "231, 160"
13 | color-link underlined "underline 241,231"
14 | color-link todo "246,231"
15 | color-link statusline "241,254"
16 | color-link tabbar "241,254"
17 | color-link gutter-error "197,231"
18 | color-link gutter-warning "134,231"
19 | color-link line-number "246,254"
20 | color-link cursor-line "254"
21 | color-link color-column "254"
22 | #No extended types (bool in C, &c.) and plain brackets
23 | color-link type.extended "default"
24 | color-link symbol.brackets "default"
--------------------------------------------------------------------------------
/runtime/files/colorschemes/in_progress/codeblocks.micro:
--------------------------------------------------------------------------------
1 | #Theme based on Code::Blocks IDE's default syntax highlighting.
2 | color-link comment "bold black"
3 | color-link constant "blue"
4 | color-link constant.string "bold blue"
5 | color-link constant.number "bold magenta"
6 | color-link identifier "default"
7 | color-link preproc "green"
8 | color-link statement "blue"
9 | color-link symbol "red"
10 | color-link symbol.brackets "blue"
11 | color-link type "blue"
12 | color-link special "magenta"
13 | color-link ignore "default"
14 | color-link error ",brightred"
15 | color-link todo "bold black,brightyellow"
16 | color-link indent-char "bold black"
17 | color-link line-number "black,white"
18 | color-link statusline "white,red"
19 | color-link tabbar "white,red"
20 | color-link current-line-number "red"
21 | color-link gutter-error ",red"
22 | color-link gutter-warning "red"
23 | color-link color-column "white"
--------------------------------------------------------------------------------
/runtime/files/syntax/tex.yaml:
--------------------------------------------------------------------------------
1 | filetype: tex
2 |
3 | detect:
4 | filename: "\\.tex$|\\.bib$|\\.cls$"
5 |
6 | rules:
7 | # colorize the identifiers of {} and []
8 | - identifier:
9 | start: "\\{"
10 | end: "\\}"
11 | rules: []
12 | - identifier:
13 | start: "\\["
14 | end: "\\]"
15 | rules: []
16 | # numbers
17 | - constant.number: "\\b[0-9]+(\\.[0-9]+)?([[:space:]](pt|mm|cm|in|ex|em|bp|pc|dd|cc|nd|nc|sp))?\\b"
18 | # let brackets have the default color again
19 | - default: "[{}\\[\\]]"
20 | - special: "[&\\\\]"
21 | # macros
22 | - statement: "\\\\@?[a-zA-Z_]+"
23 | # comments
24 | - comment:
25 | start: "%"
26 | end: "$"
27 | rules: []
28 | - comment:
29 | start: "\\\\begin\\{comment\\}"
30 | end: "\\\\end\\{comment\\}"
31 | rules: []
32 |
--------------------------------------------------------------------------------
/runtime/files/syntax/groff.yaml:
--------------------------------------------------------------------------------
1 | filetype: groff
2 |
3 | detect:
4 | filename: "\\.m[ems]$|\\.rof|\\.tmac$|^tmac."
5 |
6 | rules:
7 | - statement: "^\\.(ds|nr) [^[[:space:]]]*"
8 | - constant.specialChar: "\\\\."
9 | - constant.specialChar: "\\\\f.|\\\\f\\(..|\\\\s(\\+|\\-)?[0-9]"
10 | - constant: "(\\\\|\\\\\\\\)n(.|\\(..)"
11 | - constant:
12 | start: "(\\\\|\\\\\\\\)n\\["
13 | end: "]"
14 | rules: []
15 |
16 | - type: "^\\.[[:space:]]*[^[[:space:]]]*"
17 | - comment: "^\\.\\\\\".*$"
18 | - constant.string: "(\\\\|\\\\\\\\)\\*(.|\\(..)"
19 | - constant.string:
20 | start: "(\\\\|\\\\\\\\)\\*\\["
21 | end: "]"
22 | rules: []
23 |
24 | - constant.specialChar: "\\\\\\(.."
25 | - constant.specialChar:
26 | start: "\\\\\\["
27 | end: "]"
28 | rules: []
29 |
30 | - identifier.macro: "\\\\\\\\\\$[1-9]"
31 |
--------------------------------------------------------------------------------
/runtime/files/syntax/privoxy-config.yaml:
--------------------------------------------------------------------------------
1 | filetype: privoxy-config
2 |
3 | detect:
4 | filename: "privoxy/config$"
5 |
6 | rules:
7 | - statement: "(accept-intercepted-requests|actionsfile|admin-address|allow-cgi-request-crunching|buffer-limit|compression-level|confdir|connection-sharing|debug|default-server-timeout|deny-access|enable-compression|enable-edit-actions|enable-remote-http-toggle|enable-remote-toggle|enforce-blocks|filterfile|forward|forwarded-connect-retries|forward-socks4|forward-socks4a|forward-socks5|handle-as-empty-doc-returns-ok|hostname|keep-alive-timeout|listen-address|logdir|logfile|max-client-connections|permit-access|proxy-info-url|single-threaded|socket-timeout|split-large-forms|templdir|toggle|tolerate-pipelining|trustfile|trust-info-url|user-manual)[[:space:]]"
8 | - comment: "(^|[[:space:]])#([^{].*)?$"
9 | - indent-char.whitespace: "[[:space:]]+$"
10 | - indent-char: " + +| + +"
11 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/solarized.micro:
--------------------------------------------------------------------------------
1 | color-link comment "bold brightgreen"
2 | color-link constant "cyan"
3 | color-link constant.specialChar "red"
4 | color-link identifier "blue"
5 | color-link statement "green"
6 | color-link symbol "green"
7 | color-link preproc "brightred"
8 | color-link type "yellow"
9 | color-link special "blue"
10 | color-link underlined "magenta"
11 | color-link error "bold brightred"
12 | color-link todo "bold magenta"
13 | color-link statusline "black,brightblue"
14 | color-link tabbar "black,brightblue"
15 | color-link indent-char "black"
16 | color-link line-number "bold brightgreen,black"
17 | color-link current-line-number "bold brightgreen,default"
18 | color-link gutter-error "black,brightred"
19 | color-link gutter-warning "brightred,default"
20 | color-link cursor-line "black"
21 | color-link color-column "black"
22 | color-link type.extended "default"
23 | color-link symbol.brackets "default"
24 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/simple.micro:
--------------------------------------------------------------------------------
1 | color-link comment "blue"
2 | color-link constant "red"
3 | color-link identifier "cyan"
4 | color-link statement "yellow"
5 | color-link symbol "yellow"
6 | color-link preproc "magenta"
7 | color-link type "green"
8 | color-link special "magenta"
9 | color-link ignore "default"
10 | color-link error ",brightred"
11 | color-link todo ",brightyellow"
12 | color-link indent-char "black"
13 | color-link line-number "yellow"
14 | color-link current-line-number "red"
15 | color-link gutter-error ",red"
16 | color-link gutter-warning "red"
17 | #Cursor line causes readability issues. Disabled for now.
18 | #color-link cursor-line "white,black"
19 | color-link color-column "white"
20 | #No extended types. (bool in C)
21 | color-link type.extended "default"
22 | #No bracket highlighting.
23 | color-link symbol.brackets "default"
24 | #Color shebangs the comment color
25 | color-link preproc.shebang "comment"
26 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/gruvbox-tc.micro:
--------------------------------------------------------------------------------
1 | color-link default "#ebdbb2,#282828"
2 | color-link comment "#928374,#282828"
3 | color-link symbol "#d79921,#282828"
4 | color-link constant "#d3869b,#282828"
5 | color-link constant.string "#b8bb26,#282828"
6 | color-link constant.string.char "#b8bb26,#282828"
7 | color-link identifier "#8ec07c,#282828"
8 | color-link statement "#fb4934,#282828"
9 | color-link preproc "#fb4934,235"
10 | color-link type "#fb4934,#282828"
11 | color-link special "#d79921,#282828"
12 | color-link underlined "underline #282828"
13 | color-link error "#9d0006,#282828"
14 | color-link gutter-error "#fb4934,#282828"
15 | color-link gutter-warning "#d79921,#282828"
16 | color-link line-number "#665c54,#282828"
17 | color-link current-line-number "#665c54,#3c3836"
18 | color-link cursor-line "#3c3836"
19 | color-link color-column "#79740e"
20 | color-link statusline "#ebdbb2,#665c54"
21 | color-link tabbar "#ebdbb2,#665c54"
22 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/in_progress/github.micro:
--------------------------------------------------------------------------------
1 | #Theme based on Github's syntax highlighting.
2 | color-link comment "bold black"
3 | color-link constant "cyan"
4 | color-link constant.number "cyan"
5 | color-link constant.specialChar "bold blue"
6 | color-link constant.string "bold blue"
7 | color-link constant.bool "cyan"
8 | color-link identifier "magenta"
9 | color-link preproc "bold magenta"
10 | color-link special "magenta"
11 | color-link statement "magenta"
12 | color-link symbol "default"
13 | color-link type "magenta"
14 | color-link error "bold ,brightred"
15 | color-link todo "white"
16 | color-link indent-char "default"
17 | color-link line-number "bold black"
18 | color-link current-line-number "bold black"
19 | color-link gutter-error ",red"
20 | color-link gutter-warning "bold yellow"
21 | color-link statusline "bold white,black"
22 | color-link tabbar "bold white,black"
23 | #Plain brackets.
24 | #color-link symbol.brackets "default"
--------------------------------------------------------------------------------
/runtime/files/colorschemes/in_progress/mc.micro:
--------------------------------------------------------------------------------
1 | #Midnight Commander inspired theme.
2 | color-link default "white,blue"
3 | color-link comment "bold black"
4 | color-link constant "bold white"
5 | color-link constant.string "bold yellow"
6 | color-link identifier "bold red"
7 | color-link statement "bold cyan"
8 | color-link symbol "white"
9 | color-link symbol.brackets "white"
10 | color-link symbol.tag "bold green"
11 | color-link preproc "black,cyan"
12 | color-link type "green"
13 | color-link special "magenta"
14 | color-link ignore "default"
15 | color-link error ",brightred"
16 | color-link todo ",brightyellow"
17 | color-link indent-char ",cyan"
18 | color-link line-number "green"
19 | color-link statusline "black,cyan"
20 | color-link tabbar "black,cyan"
21 | color-link current-line-number "black,cyan"
22 | color-link cursor-line "black,cyan"
23 | color-link gutter-error ",red"
24 | color-link gutter-warning "red"
25 | color-link color-column "cyan"
26 |
--------------------------------------------------------------------------------
/runtime/files/syntax/json.yaml:
--------------------------------------------------------------------------------
1 | filetype: json
2 |
3 | detect:
4 | filename: "\\.json$"
5 | header: "^\\{$"
6 |
7 | rules:
8 | - constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b"
9 | - constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
10 | - constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
11 | - constant: "\\b(null)\\b"
12 | - constant: "\\b(true|false)\\b"
13 | - constant.string:
14 | start: "\""
15 | end: "\""
16 | skip: "\\\\."
17 | rules:
18 | - constant.specialChar: "\\\\."
19 | - constant.string:
20 | start: "'"
21 | end: "'"
22 | skip: "\\\\."
23 | rules:
24 | - constant.specialChar: "\\\\."
25 |
26 | - statement: "\\\"(\\\\\"|[^\"])*\\\"[[:space:]]*:\" \"'(\\'|[^'])*'[[:space:]]*:"
27 | - constant: "\\\\u[0-9a-fA-F]{4}|\\\\[bfnrt'\"/\\\\]"
28 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/in_progress/codeblocks-paper.micro:
--------------------------------------------------------------------------------
1 | #A colorscheme based on Code::Blocks IDE
2 | #but with a white background.
3 | color-link default "black,white"
4 | color-link comment "bold black"
5 | color-link constant "blue"
6 | color-link constant.number "bold magenta"
7 | color-link constant.string "bold blue"
8 | color-link identifier "black"
9 | color-link preproc "green"
10 | color-link statement "blue"
11 | color-link symbol "red"
12 | color-link symbol.brackets "blue"
13 | color-link type "blue"
14 | color-link special "magenta"
15 | color-link ignore "default"
16 | color-link error "bold white,brightred"
17 | color-link todo "bold black,brightyellow"
18 | color-link indent-char "bold black"
19 | color-link line-number "black,white"
20 | color-link statusline "white,red"
21 | color-link tabbar "white,red"
22 | color-link current-line-number "red,black"
23 | color-link gutter-error ",red"
24 | color-link gutter-warning "red"
25 | color-link color-column "black"
--------------------------------------------------------------------------------
/runtime/files/syntax/git-commit.yaml:
--------------------------------------------------------------------------------
1 | filetype: git-commit
2 |
3 | detect:
4 | filename: "^(.*[\\/])?(COMMIT_EDITMSG|TAG_EDITMSG)$"
5 |
6 | rules:
7 | # File changes
8 | - type.keyword: "#[[:space:]](deleted|modified|new file|renamed):[[:space:]].*"
9 | - type.keyword: "#[[:space:]]deleted:"
10 | - type.keyword: "#[[:space:]]modified:"
11 | - type.keyword: "#[[:space:]]new file:"
12 | - type.keyword: "#[[:space:]]renamed:"
13 | - type.keyword: "^#[[:space:]]Changes.*[:]"
14 | - type.keyword: "^#[[:space:]]Your branch and '[^']+"
15 | - type.keyword: "^#[[:space:]]Your branch and '"
16 | - type.keyword: "^#[[:space:]]On branch [^ ]+"
17 | - type.keyword: "^#[[:space:]]On branch"
18 | # Color keywords for closing issues (such as on Github)
19 | - type.keyword: "\\b(?i)((fix(es|ed)?|close(s|d)?) #[0-9]+)\\b"
20 |
21 | # Comments
22 | - comment.line:
23 | start: "^#"
24 | end: "$"
25 | rules: []
26 |
--------------------------------------------------------------------------------
/runtime/files/syntax/r.yaml:
--------------------------------------------------------------------------------
1 | filetype: r
2 |
3 | detect:
4 | filename: "\\.(r|R)$"
5 |
6 | rules:
7 |
8 | - statement: "\\b(library|require|break|else|for|function|if|ifelse|in|next|names|switch|repeat|print|try|tryCatch|isTRUE|return|while)\\b"
9 | - constant: "\\b(T|TRUE|F|FALSE|NULL|Inf|NaN|NA|NA_integer_|NA_real_|NA_complex_|NA_character_)\\b"
10 | - constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)"
11 | - symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&|\\^|\\$)"
12 |
13 | - comment:
14 | start: "#"
15 | end: "$"
16 | rules:
17 | - todo: "(TODO|XXX|FIXME):?"
18 |
19 | - constant.string:
20 | start: "\""
21 | end: "\""
22 | skip: "\\\\."
23 | rules:
24 | - constant.specialChar: "\\\\."
25 |
26 | - constant.string:
27 | start: "'"
28 | end: "'"
29 | skip: "\\\\."
30 | rules:
31 | - constant.specialChar: "\\\\."
32 |
33 |
--------------------------------------------------------------------------------
/runtime/files/syntax/syntax_checker.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "io/ioutil"
6 | "strings"
7 |
8 | "github.com/zyedidia/micro/cmd/micro/highlight"
9 | )
10 |
11 | func main() {
12 | files, _ := ioutil.ReadDir(".")
13 |
14 | hadErr := false
15 | for _, f := range files {
16 | if strings.HasSuffix(f.Name(), ".yaml") {
17 | input, _ := ioutil.ReadFile(f.Name())
18 | //fmt.Println("Checking file -> ", f.Name())
19 | file, err := highlight.ParseFile(input)
20 | if err != nil {
21 | hadErr = true
22 | fmt.Printf("Could not parse file -> %s:\n", f.Name())
23 | fmt.Println(err)
24 | continue
25 | }
26 | _, err1 := highlight.ParseDef(file, nil)
27 | if err1 != nil {
28 | hadErr = true
29 | fmt.Printf("Could not parse input file using highlight.ParseDef(%s):\n", f.Name())
30 | fmt.Println(err1)
31 | continue
32 | }
33 | }
34 | }
35 | if !hadErr {
36 | fmt.Println("No issues found!")
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/runtime/files/syntax/dockerfile.yaml:
--------------------------------------------------------------------------------
1 | filetype: dockerfile
2 |
3 | detect:
4 | filename: "(Dockerfile[^/]*$|\\.dockerfile$)"
5 |
6 | rules:
7 | ## Keywords
8 | - type.keyword: "(?i)^(FROM|MAINTAINER|RUN|CMD|LABEL|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD|ARG|HEALTHCHECK|STOPSIGNAL|SHELL)[[:space:]]"
9 |
10 | ## Brackets & parenthesis
11 | - statement: "(\\(|\\)|\\[|\\])"
12 |
13 | ## Double ampersand
14 | - special: "&&"
15 |
16 | ## Comments
17 | - comment:
18 | start: "#"
19 | end: "$"
20 | rules:
21 | - todo: "(TODO|XXX|FIXME):?"
22 |
23 | - constant.string:
24 | start: "\""
25 | end: "\""
26 | skip: "\\\\."
27 | rules:
28 | - constant.specialChar: "\\\\."
29 |
30 | - constant.string:
31 | start: "'"
32 | end: "'"
33 | skip: "\\\\."
34 | rules:
35 | - constant.specialChar: "\\\\."
36 |
37 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/github-tc.micro:
--------------------------------------------------------------------------------
1 | #True color theme based on Github's syntax highlighting.
2 | #Warning, this is based on how it rendered in my Firefox!
3 | #Yours may look different.
4 | color-link comment "bold #969896"
5 | color-link constant "#0086B9"
6 | color-link constant.number "#0086B9"
7 | color-link constant.specialChar "bold #1836BD"
8 | color-link constant.string "bold #1836BD"
9 | color-link constant.bool "#0086B9"
10 | color-link identifier "#A71D5D"
11 | color-link preproc "bold #A71D5D"
12 | color-link special "#A71D5D"
13 | color-link statement "#A71D5D"
14 | color-link symbol "default"
15 | color-link type "#A71D5D"
16 | color-link error "bold ,#E34234"
17 | color-link todo "white"
18 | color-link indent-char "default"
19 | color-link line-number "bold #969896"
20 | color-link current-line-number "bold #969896"
21 | color-link gutter-error "bold ,#E34234"
22 | color-link gutter-warning "bold #f26522"
23 | color-link statusline "bold #c8c9cb,#24292e"
24 | color-link tabbar "bold #c8c9cb,#24292e"
--------------------------------------------------------------------------------
/runtime/files/syntax/yaml.yaml:
--------------------------------------------------------------------------------
1 | filetype: yaml
2 |
3 | detect:
4 | filename: "\\.ya?ml$"
5 | header: "%YAML"
6 |
7 | rules:
8 | - type: "(^| )!!(binary|bool|float|int|map|null|omap|seq|set|str) "
9 | - constant: "\\b(YES|yes|Y|y|ON|on|TRUE|True|true|NO|no|N|n|OFF|off|FALSE|False|false)\\b"
10 | - statement: "(:[[:space:]]|\\[|\\]|:[[:space:]]+[|>]|^[[:space:]]*- )"
11 | - identifier: "[[:space:]][\\*&][A-Za-z0-9]+"
12 | - type: "[-.\\w]+:"
13 | - statement: ":"
14 | - special: "(^---|^\\.\\.\\.|^%YAML|^%TAG)"
15 |
16 | - constant.string:
17 | start: "(^| )\""
18 | end: "\""
19 | skip: "\\\\."
20 | rules:
21 | - constant.specialChar: "\\\\."
22 |
23 | - constant.string:
24 | start: "(^| )'"
25 | end: "'"
26 | skip: "(\\\\.)|('')"
27 | rules:
28 | - constant.specialChar: "\\\\."
29 |
30 | - comment:
31 | start: "#"
32 | end: "$"
33 | rules: []
34 |
35 |
36 |
--------------------------------------------------------------------------------
/stack.go:
--------------------------------------------------------------------------------
1 | package femto
2 |
3 | // Stack is a simple implementation of a LIFO stack for text events
4 | type Stack struct {
5 | Top *Element
6 | Size int
7 | }
8 |
9 | // An Element which is stored in the Stack
10 | type Element struct {
11 | Value *TextEvent
12 | Next *Element
13 | }
14 |
15 | // Len returns the stack's length
16 | func (s *Stack) Len() int {
17 | return s.Size
18 | }
19 |
20 | // Push a new element onto the stack
21 | func (s *Stack) Push(value *TextEvent) {
22 | s.Top = &Element{value, s.Top}
23 | s.Size++
24 | }
25 |
26 | // Pop removes the top element from the stack and returns its value
27 | // If the stack is empty, return nil
28 | func (s *Stack) Pop() (value *TextEvent) {
29 | if s.Size > 0 {
30 | value, s.Top = s.Top.Value, s.Top.Next
31 | s.Size--
32 | return
33 | }
34 | return nil
35 | }
36 |
37 | // Peek returns the top element of the stack without removing it
38 | func (s *Stack) Peek() *TextEvent {
39 | if s.Size > 0 {
40 | return s.Top.Value
41 | }
42 | return nil
43 | }
44 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/in_progress/paper.micro:
--------------------------------------------------------------------------------
1 | #Paper theme, Edit on a white background.
2 | color-link default "black,white"
3 | color-link comment "bold black"
4 | color-link constant "cyan"
5 | color-link constant.string "bold green"
6 | color-link identifier "blue"
7 | color-link identifier.macro "bold red"
8 | color-link identifier.var "bold blue"
9 | color-link identifier.class "bold green"
10 | color-link statement "green"
11 | color-link symbol "red"
12 | color-link symbol.brackets "default"
13 | color-link symbol.tag "bold blue"
14 | color-link preproc "bold cyan"
15 | color-link type "green"
16 | color-link special "magenta"
17 | color-link ignore "default"
18 | color-link error ",brightred"
19 | color-link todo ",brightyellow"
20 | color-link indent-char ",brightgreen"
21 | color-link line-number "black"
22 | color-link statusline "white,black"
23 | color-link tabbar "white,black"
24 | color-link current-line-number "blue"
25 | color-link gutter-error ",red"
26 | color-link gutter-warning "red"
27 | color-link color-column "black"
28 |
--------------------------------------------------------------------------------
/runtime/files/syntax/coffeescript.yaml:
--------------------------------------------------------------------------------
1 | filetype: coffeescript
2 |
3 | detect:
4 | filename: "\\.coffee$"
5 |
6 | rules:
7 | - symbol.operator: "[!&|=/*+-<>]|\\b(and|or|is|isnt|not)\\b"
8 | - identifier.class: "([A-Za-z_][A-Za-z0-9_]*:[[:space:]]*(->|\\()|->)"
9 | - symbol.brackets: "[()]"
10 | - statement: "\\b(for|of|continue|break|isnt|null|unless|this|else|if|return)\\b"
11 | - statement: "\\b(try|catch|finally|throw|new|delete|typeof|in|instanceof)\\b"
12 | - statement: "\\b(debugger|switch|while|do|class|extends|super)\\b"
13 | - statement: "\\b(undefined|then|unless|until|loop|of|by|when)\\b"
14 | - constant.bool: "\\b(true|false|yes|no|on|off)\\b"
15 | - identifier: "@[A-Za-z0-9_]*"
16 |
17 | - constant.string:
18 | start: "\""
19 | end: "\""
20 | skip: "\\\\."
21 | rules:
22 | - constant.specialChar: "\\\\."
23 |
24 | - comment:
25 | start: "#"
26 | end: "$"
27 | rules:
28 | - todo: "(TODO|XXX|FIXME):?"
29 |
30 |
--------------------------------------------------------------------------------
/runtime/files/syntax/toml.yaml:
--------------------------------------------------------------------------------
1 | filetype: toml
2 |
3 | detect:
4 | filename: "\\.toml"
5 |
6 | rules:
7 | - statement: "(.*)[[:space:]]="
8 | - special: "="
9 |
10 | # Bracket thingies
11 | - special: "(\\[|\\])"
12 |
13 | # Numbers and strings
14 | - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
15 | - constant.number: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
16 |
17 | - constant.string:
18 | start: "\""
19 | end: "\""
20 | skip: "\\\\."
21 | rules:
22 | - constant.specialChar: "\\\\."
23 |
24 | - constant.string:
25 | start: "'"
26 | end: "'"
27 | skip: "\\\\."
28 | rules:
29 | - constant.specialChar: "\\\\."
30 |
31 | - constant.string:
32 | start: "`"
33 | end: "`"
34 | rules:
35 | - constant.specialChar: "\\\\."
36 |
37 | - comment:
38 | start: "#"
39 | end: "$"
40 | rules:
41 | - todo: "(TODO|XXX|FIXME):?"
42 |
43 |
--------------------------------------------------------------------------------
/runtime/files/syntax/scala.yaml:
--------------------------------------------------------------------------------
1 | filetype: scala
2 |
3 | detect:
4 | filename: "\\.scala$"
5 |
6 | rules:
7 | - type: "\\b(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\\b"
8 | - statement: "\\b(match|val|var|break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\\b"
9 | - statement: "\\b(def|object|case|trait|lazy|implicit|abstract|class|extends|with|final|implements|override|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile|sealed)\\b"
10 | - constant.string:
11 | start: "\""
12 | end: "\""
13 | skip: "\\\\."
14 | rules:
15 | - constant.specialChar: "\\\\."
16 | - constant: "\\b(true|false|null)\\b"
17 | - comment:
18 | start: "//"
19 | end: "$"
20 | rules: []
21 | - comment:
22 | start: "/\\*"
23 | end: "\\*/"
24 | rules: []
25 | - comment:
26 | start: "/\\*\\*"
27 | end: "\\*/"
28 | rules: []
29 |
30 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/solarized-tc.micro:
--------------------------------------------------------------------------------
1 | color-link default "#839496,#002833"
2 | color-link comment "#586E75,#002833"
3 | color-link identifier "#268BD2,#002833"
4 | color-link constant "#2AA198,#002833"
5 | color-link constant.specialChar "#DC322F,#002833"
6 | color-link statement "#859900,#002833"
7 | color-link symbol "#859900,#002833"
8 | color-link preproc "#CB4B16,#002833"
9 | color-link type "#B58900,#002833"
10 | color-link special "#268BD2,#002833"
11 | color-link underlined "#D33682,#002833"
12 | color-link error "bold #CB4B16,#002833"
13 | color-link todo "bold #D33682,#002833"
14 | color-link statusline "#003541,#839496"
15 | color-link tabbar "#003541,#839496"
16 | color-link indent-char "#003541,#002833"
17 | color-link line-number "#586E75,#003541"
18 | color-link current-line-number "#586E75,#002833"
19 | color-link gutter-error "#003541,#CB4B16"
20 | color-link gutter-warning "#CB4B16,#002833"
21 | color-link cursor-line "#003541"
22 | color-link color-column "#003541"
23 | color-link type.extended "#839496,#002833"
24 | color-link symbol.brackets "#839496,#002833"
25 |
--------------------------------------------------------------------------------
/runtime/files/syntax/dot.yaml:
--------------------------------------------------------------------------------
1 | filetype: dot
2 |
3 | detect:
4 | filename: "\\.(dot|gv)$"
5 |
6 | rules:
7 | - type: "\\b(digraph|edge|graph|node|subgraph)\\b"
8 | - statement: "\\b(arrow(head|size|tail)|(bg|fill|font)?color|center|constraint|decorateP|dir|distortion|font(name|size)|head(clip|label)|height|label(angle|distance|font(color|name|size))?|layer(s)?|margin|mclimit|minlen|name|nodesep|nslimit|ordering|orientation|page(dir)?|peripheries|port_label_distance|rank(dir|sep)?|ratio|regular|rotate|same(head|tail)|shape(file)?|sides|size|skew|style|tail(clip|label)|URL|weight|width)\\b"
9 | - symbol: "=|->|--"
10 |
11 | - constant.string:
12 | start: "\""
13 | end: "\""
14 | skip: "\\\\."
15 | rules:
16 | - constant.specialChar: "\\\\."
17 |
18 | - comment:
19 | start: "//"
20 | end: "$"
21 | rules:
22 | - todo: "(TODO|XXX|FIXME):?"
23 |
24 | - comment:
25 | start: "/\\*"
26 | end: "\\*/"
27 | rules:
28 | - todo: "(TODO|XXX|FIXME):?"
29 |
30 |
--------------------------------------------------------------------------------
/runtime/files/syntax/vala.yaml:
--------------------------------------------------------------------------------
1 | filetype: vala
2 |
3 | detect:
4 | filename: "\\.vala$"
5 |
6 | rules:
7 | - type: "\\b(float|double|bool|u?char|u?int(8|16|32|64)?|u?short|u?long|void|s?size_t|unichar)\\b"
8 | - identifier.class: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"
9 | - statement: "\\b(for|if|while|do|else|case|default|switch|try|throw|catch)\\b"
10 | - statement: "\\b(inline|typedef|struct|enum|union|extern|static|const)\\b"
11 | - statement: "\\b(operator|new|delete|return|null)\\b"
12 | - statement: "\\b(class|override|private|public|signal|this|weak)\\b"
13 | - special: "\\b(goto|break|continue)\\b"
14 | - constant.bool: "\\b(true|false)\\b"
15 | - constant.number: "\\b([0-9]+)\\b"
16 | - symbol.operator: "[\\-+/*=<>?:!~%&|]|->"
17 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
18 | - comment: "(^|[[:space:]])//.*"
19 | - comment:
20 | start: "/\\*"
21 | end: "\\*/"
22 | rules: []
23 |
24 | - todo: "TODO:?"
25 | - indent-char.whitespace: "[[:space:]]+$"
26 | - indent-char: " + +| + +"
27 |
--------------------------------------------------------------------------------
/runtime/files/syntax/elm.yaml:
--------------------------------------------------------------------------------
1 | filetype: elm
2 |
3 | detect:
4 | filename: "\\.elm$"
5 |
6 | rules:
7 | - statement: "\\b(as|alias|case|else|exposing|if|import|in|let|module|of|port|then|type|)\\b"
8 | - statement: "(\\=|\\:|\\->)"
9 | - type: "\\b([A-Z][A-Za-z\\d]*)\\b"
10 | - identifier: "^([a-z][A-Za-z\\d]*)\\b"
11 | - constant.string:
12 | start: "\"\"\""
13 | end: "\"\"\""
14 | skip: "\\\\."
15 | rules:
16 | - constant.specialChar: "\\\\."
17 | - constant.string:
18 | start: "\""
19 | end: "\""
20 | skip: "\\\\."
21 | rules:
22 | - constant.specialChar: "\\\\."
23 | - constant.string:
24 | start: "'"
25 | end: "'"
26 | skip: "\\\\."
27 | rules:
28 | - constant.specialChar: "\\\\."
29 | - comment:
30 | start: "--"
31 | end: "$"
32 | rules:
33 | - todo: "(TODO|XXX|FIXME):?"
34 | - comment:
35 | start: "\\{-"
36 | end: "-\\}"
37 | rules:
38 | - todo: "(TODO|XXX|FIXME):?"
39 |
--------------------------------------------------------------------------------
/runtime/files/syntax/glsl.yaml:
--------------------------------------------------------------------------------
1 | filetype: glsl
2 |
3 | detect:
4 | filename: "\\.(frag|vert|fp|vp|glsl)$"
5 |
6 | rules:
7 | - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"
8 | - type: "\\b(void|bool|bvec2|bvec3|bvec4|int|ivec2|ivec3|ivec4|float|vec2|vec3|vec4|mat2|mat3|mat4|struct|sampler1D|sampler2D|sampler3D|samplerCUBE|sampler1DShadow|sampler2DShadow)\\b"
9 | - identifier: "\\bgl_(DepthRangeParameters|PointParameters|MaterialParameters|LightSourceParameters|LightModelParameters|LightModelProducts|LightProducts|FogParameters)\\b"
10 | - statement: "\\b(const|attribute|varying|uniform|in|out|inout|if|else|return|discard|while|for|do)\\b"
11 | - statement: "\\b(break|continue)\\b"
12 | - constant.bool: "\\b(true|false)\\b"
13 | - symbol.operator: "[-+/*=<>?:!~%&|^]"
14 | - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b"
15 |
16 | - comment:
17 | start: "//"
18 | end: "$"
19 | rules:
20 | - todo: "TODO:?"
21 |
22 | - comment:
23 | start: "/\\*"
24 | end: "\\*/"
25 | rules:
26 | - todo: "TODO:?"
27 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/atom-dark-tc.micro:
--------------------------------------------------------------------------------
1 | color-link default "#C5C8C6,#1D1F21"
2 | color-link comment "#7C7C7C,#1D1F21"
3 | color-link identifier "#F9EE98,#1D1F21"
4 | color-link constant "#FF73FD,#1D1F21"
5 | color-link constant.string "#A8FF60,#1D1F21"
6 | color-link statement "#96CBFE,#1D1F21"
7 | color-link symbol "#96CBFE,#1D1F21"
8 | color-link preproc "#62B1FE,#1D1F21"
9 | color-link type "#C6C5FE,#1D1F21"
10 | color-link special "#A6E22E,#1D1F21"
11 | color-link underlined "#D33682,#1D1F21"
12 | color-link error "bold #FF4444,#1D1F21"
13 | color-link todo "bold #FF8844,#1D1F21"
14 | color-link statusline "#1D1F21,#C5C8C6"
15 | color-link tabbar "#1D1F21,#C5C8C6"
16 | color-link indent-char "#505050,#1D1F21"
17 | color-link line-number "#656866,#232526"
18 | color-link current-line-number "#656866,#1D1F21"
19 | color-link gutter-error "#FF4444,#1D1F21"
20 | color-link gutter-warning "#EEEE77,#1D1F21"
21 | color-link cursor-line "#2D2F31"
22 | color-link color-column "#2D2F31"
23 | #color-link symbol.brackets "#96CBFE,#1D1F21"
24 | #No extended types (bool in C, etc.)
25 | #color-link type.extended "default"
26 | #Plain brackets
27 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019: Pat Gavlin, et al.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining
6 | a copy of this software and associated documentation files (the
7 | "Software"), to deal in the Software without restriction, including
8 | without limitation the rights to use, copy, modify, merge, publish,
9 | distribute, sublicense, and/or sell copies of the Software, and to
10 | permit persons to whom the Software is furnished to do so, subject to
11 | the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be
14 | included in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/runtime/files/syntax/java.yaml:
--------------------------------------------------------------------------------
1 | filetype: java
2 |
3 | detect:
4 | filename: "\\.java$"
5 |
6 | rules:
7 | - type: "\\b(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\\b"
8 | - statement: "\\b(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\\b"
9 | - type: "\\b(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\\b"
10 | - constant: "\\b(true|false|null)\\b"
11 | - constant.number: "\\b[0-9]+\\b"
12 |
13 | - constant.string:
14 | start: "\""
15 | end: "\""
16 | skip: "\\\\."
17 | rules:
18 | - constant.specialChar: "\\\\."
19 |
20 | - constant.string:
21 | start: "'"
22 | end: "'"
23 | skip: "\\\\."
24 | rules:
25 | - preproc: "..+"
26 | - constant.specialChar: "\\\\."
27 |
28 | - comment:
29 | start: "//"
30 | end: "$"
31 | rules: []
32 |
33 | - comment:
34 | start: "/\\*"
35 | end: "\\*/"
36 | rules: []
37 |
38 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/railscast.micro:
--------------------------------------------------------------------------------
1 | color-link default "#e6e1dc,#2b2b2b"
2 | color-link comment "#bc9458,#2b2b2b"
3 | color-link statement "#cc7833,#2b2b2b"
4 | color-link constant "#a5c261,#2b2b2b"
5 | color-link constant.bool "#6d9cbe,#2b2b2b"
6 | color-link type "#6d9cbe,#2b2b2b"
7 | color-link preproc "#cc7833,#2b2b2b"
8 | color-link special "#cc7833,#2b2b2b"
9 | color-link underlined "#cc7833,#2b2b2b"
10 | color-link todo "bold #cc7833,#2b2b2b"
11 | color-link error "bold #cc7833,#2b2b2b"
12 | color-link gutter-error "#cc7833,#11151C"
13 | color-link indent-char "#414141,#2b2b2b"
14 | color-link line-number "#a1a1a1,#353535"
15 | color-link current-line-number "#e6e1dc,#2b2b2b"
16 | color-link gutter-warning "#a5c261,#11151C"
17 | color-link symbol "#edb753,#2b2b2b"
18 | color-link identifier "#edb753,#2b2b2b"
19 | color-link statusline "#a1a1a1,#414141"
20 | color-link tabbar "bold #a1a1a1,#414141"
21 | color-link cursor-line "#353535"
22 | color-link color-column "#353535"
23 | color-link space "underline #e6e1dc,#2b2b2b"
24 |
25 | #the Python syntax definition are wrong. This is not how you should do decorators!
26 | color-link brightgreen "#edb753,#2b2b2b"
27 |
--------------------------------------------------------------------------------
/runtime/files/syntax/clojure.yaml:
--------------------------------------------------------------------------------
1 | filetype: clojure
2 |
3 | detect:
4 | filename: "\\.(clj[sc]?|edn)$"
5 |
6 | rules:
7 |
8 | # Constants
9 | - constant.bool: "\\b(true|false)\\b"
10 | - constant.macro: "\\b(nil)\\b"
11 | # Valid numbers
12 | - constant.number: "[\\-]?[0-9]+?\\b"
13 | - constant.number: "0x[0-9][A-Fa-f]+?\\b"
14 | - constant.number: "[\\-]?(3[0-6]|2[0-9]|1[0-9]|[2-9])r[0-9A-Z]+?\\b"
15 | # Invalid numbers
16 | - error: "[\\-]?([4-9][0-9]|3[7-9]|1|0)r[0-9A-Z]+?\\b"
17 |
18 | # Symbols
19 | - symbol.operator: "[=>+\\-*/'?]"
20 |
21 | # Types/casting
22 | - type: "\\b(byte|short|(big)?int(eger)?|long|float|num|bigdec|rationalize)\\b"
23 |
24 | # String highlighting
25 | - constant.string:
26 | start: "\""
27 | end: "\""
28 | skip: "\\\\."
29 | rules:
30 | - constant.specialChar: "(\\\\u[0-9A-fa-f]{4,4}|\\\\newline|\\\\space|\\\\tab|\\\\formfeed|\\\\backspace|\\\\return|\\\\.)"
31 |
32 | # Comments
33 | - comment:
34 | start: ";"
35 | end: "$"
36 | rules:
37 | - todo: "(TODO|XXX|FIXME):?"
38 |
39 |
--------------------------------------------------------------------------------
/runtime/files/syntax/nanorc.yaml:
--------------------------------------------------------------------------------
1 | filetype: nanorc
2 |
3 | detect:
4 | filename: "\\.?nanorc$"
5 |
6 | rules:
7 | - default: "(?i)^[[:space:]]*((un)?set|include|syntax|i?color).*$"
8 | - type: "(?i)^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct)\\>|^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|undo|view|whitespace|wordbounds)\\b"
9 | - preproc: "(?i)^[[:space:]]*(set|unset|include|syntax|header)\\b"
10 | - constant.bool.true: "(?i)(set)\\b"
11 | - constant.bool.false: "(?i)(unset)\\b"
12 | - identifier: "(?i)^[[:space:]]*(i)?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\\b"
13 | - special: "(?i)^[[:space:]]*(i)?color\\b|\\b(start|end)="
14 | - constant.string: "\"(\\\\.|[^\"])*\""
15 | - comment: "^[[:space:]]*#.*$"
16 | - comment.bright: "^[[:space:]]*##.*$"
17 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/default.micro:
--------------------------------------------------------------------------------
1 | color-link default "#F8F8F2,#282828"
2 | color-link comment "#75715E,#282828"
3 | color-link identifier "#66D9EF,#282828"
4 | color-link constant "#AE81FF,#282828"
5 | color-link constant.string "#E6DB74,#282828"
6 | color-link constant.string.char "#BDE6AD,#282828"
7 | color-link statement "#F92672,#282828"
8 | color-link symbol "#F92672,#282828"
9 | color-link preproc "#CB4B16,#282828"
10 | color-link type "#66D9EF,#282828"
11 | color-link special "#A6E22E,#282828"
12 | color-link underlined "#D33682,#282828"
13 | color-link error "bold #CB4B16,#282828"
14 | color-link todo "bold #D33682,#282828"
15 | color-link statusline "#282828,#F8F8F2"
16 | color-link tabbar "#282828,#F8F8F2"
17 | color-link indent-char "#505050,#282828"
18 | color-link line-number "#AAAAAA,#323232"
19 | color-link current-line-number "#AAAAAA,#282828"
20 | color-link gutter-error "#CB4B16,#282828"
21 | color-link gutter-warning "#E6DB74,#282828"
22 | color-link cursor-line "#323232"
23 | color-link color-column "#323232"
24 | #No extended types; Plain brackets.
25 | color-link type.extended "default"
26 | #color-link symbol.brackets "default"
27 | color-link symbol.tag "#AE81FF,#282828"
28 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/monokai.micro:
--------------------------------------------------------------------------------
1 | color-link default "#F8F8F2,#282828"
2 | color-link comment "#75715E,#282828"
3 | color-link identifier "#66D9EF,#282828"
4 | color-link constant "#AE81FF,#282828"
5 | color-link constant.string "#E6DB74,#282828"
6 | color-link constant.string.char "#BDE6AD,#282828"
7 | color-link statement "#F92672,#282828"
8 | color-link symbol "#F92672,#282828"
9 | color-link preproc "#CB4B16,#282828"
10 | color-link type "#66D9EF,#282828"
11 | color-link special "#A6E22E,#282828"
12 | color-link underlined "#D33682,#282828"
13 | color-link error "bold #CB4B16,#282828"
14 | color-link todo "bold #D33682,#282828"
15 | color-link statusline "#282828,#F8F8F2"
16 | color-link tabbar "#282828,#F8F8F2"
17 | color-link indent-char "#505050,#282828"
18 | color-link line-number "#AAAAAA,#323232"
19 | color-link current-line-number "#AAAAAA,#282828"
20 | color-link gutter-error "#CB4B16,#282828"
21 | color-link gutter-warning "#E6DB74,#282828"
22 | color-link cursor-line "#323232"
23 | color-link color-column "#323232"
24 | #No extended types; Plain brackets.
25 | color-link type.extended "default"
26 | #color-link symbol.brackets "default"
27 | color-link symbol.tag "#AE81FF,#282828"
28 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/in_progress/nano.micro:
--------------------------------------------------------------------------------
1 | #Colorscheme styled after default Debian nano.
2 | color-link comment "bold blue"
3 | color-link comment.bright "cyan"
4 | color-link constant "red"
5 | color-link constant.bool "yellow"
6 | color-link constant.bool.true "bold green"
7 | color-link constant.bool.false "bold red"
8 | color-link constant.number "default"
9 | color-link constant.specialChar "bold magenta"
10 | color-link constant.string "bold yellow"
11 | color-link identifier "bold blue"
12 | color-link identifier.macro "bold red"
13 | color-link statement "bold green"
14 | color-link symbol "green"
15 | #color-link symbol.tag "blue"
16 | color-link preproc "brightcyan"
17 | color-link type "green"
18 | color-link special "magenta"
19 | color-link ignore "default"
20 | color-link error "white,black"
21 | color-link todo "bold cyan"
22 | color-link indent-char ",green"
23 | color-link line-number "default"
24 | color-link current-line-number "default"
25 | color-link gutter-error ",white"
26 | color-link gutter-warning "white"
27 | color-link cursor-line "default"
28 | color-link color-column "white"
29 | #No extended types ( bool in C ); Plain brackets
30 | color-link type.extended "default"
31 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/darcula.micro:
--------------------------------------------------------------------------------
1 | color-link default "#CCCCCC,#242424"
2 | color-link comment "#707070,#242424"
3 | color-link identifier "#FFC66D,#242424"
4 | color-link constant "#7A9EC2,#242424"
5 | color-link constant.string "#6A8759,#242424"
6 | color-link constant.string.char "#6A8759,#242424"
7 | color-link statement "#CC8242,#242424"
8 | color-link symbol "#CCCCCC,#242424"
9 | color-link preproc "#CC8242,#242424"
10 | color-link type "#CC8242,#242424"
11 | color-link special "#CC8242,#242424"
12 | color-link underlined "#D33682,#242424"
13 | color-link error "bold #CB4B16,#242424"
14 | color-link todo "bold #D33682,#242424"
15 | color-link statusline "#242424,#CCCCCC"
16 | color-link tabbar "#242424,#CCCCCC"
17 | color-link indent-char "#4F4F4F,#242424"
18 | color-link line-number "#666666,#242424"
19 | color-link current-line-number "#666666,#242424"
20 | color-link gutter-error "#CB4B16,#242424"
21 | color-link gutter-warning "#E6DB74,#242424"
22 | color-link cursor-line "default,#2C2C2C"
23 | color-link color-column "default,#2C2C2C"
24 | #No extended types; Plain brackets.
25 | color-link type.extended "default"
26 | #color-link symbol.brackets "default"
27 | color-link symbol.tag "#AE81FF,#242424"
28 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/twilight.micro:
--------------------------------------------------------------------------------
1 | # Twilight color scheme
2 | color-link default "#F8F8F8,#141414"
3 | color-link color-column "#1B1B1B"
4 | color-link comment "#5F5A60"
5 | color-link constant "#CF6A4C"
6 | #color-link constant.number "#CF6A4C"
7 | color-link constant.specialChar "#DDF2A4"
8 | color-link constant.string "#8F9D6A"
9 | color-link current-line-number "#868686,#1B1B1B"
10 | color-link cursor-line "#1B1B1B"
11 | color-link divider "#1E1E1E"
12 | color-link error "#D2A8A1"
13 | color-link gutter-error "#9B859D"
14 | color-link gutter-warning "#9B859D"
15 | color-link identifier "#9B703F"
16 | color-link identifier.class "#DAD085"
17 | color-link identifier.var "#7587A6"
18 | color-link indent-char "#515151"
19 | color-link line-number "#868686"
20 | color-link preproc "#E0C589"
21 | color-link special "#E0C589"
22 | color-link statement "#CDA869"
23 | color-link statusline "#515151,#1E1E1E"
24 | color-link symbol "#AC885B"
25 | color-link symbol.brackets "#F8F8F8"
26 | color-link symbol.operator "#CDA869"
27 | color-link symbol.tag "#AC885B"
28 | color-link tabbar "#F2F0EC,#2D2D2D"
29 | color-link todo "#8B98AB"
30 | color-link type "#F9EE98"
31 | color-link type.keyword "#CDA869"
32 | color-link underlined "#8996A8"
33 |
--------------------------------------------------------------------------------
/LICENSE-THIRD-PARTY:
--------------------------------------------------------------------------------
1 | github.com/zyedidia/micro/LICENSE
2 | ================
3 |
4 | MIT License
5 |
6 | Copyright (c) 2016-2017: Zachary Yedidia, et al.
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining
9 | a copy of this software and associated documentation files (the
10 | "Software"), to deal in the Software without restriction, including
11 | without limitation the rights to use, copy, modify, merge, publish,
12 | distribute, sublicense, and/or sell copies of the Software, and to
13 | permit persons to whom the Software is furnished to do so, subject to
14 | the following conditions:
15 |
16 | The above copyright notice and this permission notice shall be
17 | included in all copies or substantial portions of the Software.
18 |
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 |
--------------------------------------------------------------------------------
/runtime/files/syntax/LICENSE:
--------------------------------------------------------------------------------
1 | Micro's syntax files are licensed under the MIT "Expat" License:
2 |
3 | Copyright (c) 2016: Zachary Yedidia, Collin Warren, et al.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining
6 | a copy of this software and associated documentation files (the
7 | "Software"), to deal in the Software without restriction, including
8 | without limitation the rights to use, copy, modify, merge, publish,
9 | distribute, sublicense, and/or sell copies of the Software, and to
10 | permit persons to whom the Software is furnished to do so, subject to
11 | the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be
14 | included in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/in_progress/funky-cactus.micro:
--------------------------------------------------------------------------------
1 | #Funky Cactus theme
2 | color-link comment "bold black"
3 | color-link constant "cyan"
4 | color-link constant.bool "bold cyan"
5 | color-link constant.bool.true "bold green"
6 | color-link constant.bool.false "bold red"
7 | color-link constant.string "yellow"
8 | color-link constant.number "constant"
9 | color-link constant.specialChar "bold magenta"
10 | color-link identifier "bold red"
11 | color-link identifier.macro "bold red"
12 | color-link identifier.var "bold blue"
13 | color-link identifier.class "bold green"
14 | color-link preproc "bold cyan"
15 | color-link statement "bold yellow"
16 | color-link symbol "red"
17 | color-link symbol.brackets "blue"
18 | color-link type "green"
19 | color-link type.keyword "bold green"
20 | color-link special "magenta"
21 | color-link ignore "default"
22 | color-link error "bold ,brightred"
23 | color-link todo "underline ,brightyellow"
24 | color-link indent-char "bold ,brightgreen"
25 | color-link line-number "green"
26 | color-link statusline "black,green"
27 | color-link tabbar "black,magenta"
28 | color-link current-line-number "bold magenta"
29 | color-link gutter-error ",red"
30 | color-link gutter-warning "red"
31 | color-link color-column "bold green"
32 |
--------------------------------------------------------------------------------
/settings.go:
--------------------------------------------------------------------------------
1 | package femto
2 |
3 | // DefaultLocalSettings returns the default local settings
4 | // Note that filetype is a local only option
5 | func DefaultLocalSettings() map[string]interface{} {
6 | return map[string]interface{}{
7 | "autoindent": true,
8 | "autosave": false,
9 | "basename": false,
10 | "colorcolumn": float64(0),
11 | "cursorline": true,
12 | "eofnewline": false,
13 | "fastdirty": true,
14 | "fileformat": "unix",
15 | "filetype": "Unknown",
16 | "hidehelp": false,
17 | "ignorecase": false,
18 | "indentchar": " ",
19 | "keepautoindent": false,
20 | "matchbrace": false,
21 | "matchbraceleft": false,
22 | "rmtrailingws": false,
23 | "ruler": true,
24 | "savecursor": false,
25 | "saveundo": false,
26 | "scrollbar": false,
27 | "scrollmargin": float64(3),
28 | "scrollspeed": float64(2),
29 | "softwrap": false,
30 | "smartpaste": true,
31 | "splitbottom": true,
32 | "splitright": true,
33 | "statusline": true,
34 | "syntax": true,
35 | "tabmovement": false,
36 | "tabsize": float64(4),
37 | "tabstospaces": false,
38 | "useprimary": true,
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/material-tc.micro:
--------------------------------------------------------------------------------
1 | color-link color-column "#263238"
2 | color-link comment "#4F6875,#263238"
3 | color-link constant "#F07178,#263238"
4 | color-link constant.number "#F78C6A,#263238"
5 | color-link constant.specialChar "#89DDF3,#263238"
6 | color-link constant.string "#C3E88D,#263238"
7 | color-link current-line-number "#80DEEA,#263238"
8 | color-link cursor-line "#3b4d56"
9 | color-link default "#EEFFFF,#263238"
10 | color-link divider "#263238,#80DEEA"
11 | color-link error "bold #263238,#F07178"
12 | color-link gutter-error "#EEFFFF,#F07178"
13 | color-link gutter-warning "#EEFFFF,#FFF176"
14 | color-link identifier "#82AAFF,#263238"
15 | color-link identifier.macro "#FFCB6B,#263238"
16 | color-link indent-char "#505050,#263238"
17 | color-link line-number "#656866,#263238"
18 | color-link preproc "#C792EA,#263238"
19 | color-link special "#C792EA,#263238"
20 | color-link statement "#C792EA,#263238"
21 | color-link statusline "#80DEEA,#3b4d56"
22 | color-link symbol "#96CBFE,#263238"
23 | color-link symbol.brackets "#89DDF3,#263238"
24 | color-link symbol.operator "#C792EA,#263238"
25 | color-link tabbar "#80DEEA,#3b4d56"
26 | color-link todo "bold #C792EA,#263238"
27 | color-link type "#FFCB6B,#263238"
28 | color-link underlined "underline #EEFFFF,#263238"
29 |
--------------------------------------------------------------------------------
/runtime/files/syntax/markdown.yaml:
--------------------------------------------------------------------------------
1 | filetype: markdown
2 |
3 | detect:
4 | filename: "\\.(md|mkd|mkdn|markdown)$"
5 |
6 | rules:
7 | # Tables (Github extension)
8 | - type: ".*[ :]\\|[ :].*"
9 |
10 | # quotes
11 | - statement: "^>.*"
12 |
13 | # Emphasis
14 | - type: "(^|[[:space:]])(_[^ ][^_]*_|\\*[^ ][^*]*\\*)"
15 |
16 | # Strong emphasis
17 | - type: "(^|[[:space:]])(__[^ ][^_]*__|\\*\\*[^ ][^*]*\\*\\*)"
18 |
19 | # strike-through
20 | - type: "(^|[[:space:]])~~[^ ][^~]*~~"
21 |
22 | # horizontal rules
23 | - special: "^(---+|===+|___+|\\*\\*\\*+)\\s*$"
24 |
25 | # headlines
26 | - special: "^#{1,6}.*"
27 |
28 | # lists
29 | - identifier: "^[[:space:]]*[\\*+-] |^[[:space:]]*[0-9]+\\. "
30 |
31 | # misc
32 | - preproc: "(\\(([CcRr]|[Tt][Mm])\\)|\\.{3}|(^|[[:space:]])\\-\\-($|[[:space:]]))"
33 |
34 | # links
35 | - constant: "\\[[^]]+\\]"
36 | - constant: "\\[([^][]|\\[[^]]*\\])*\\]\\([^)]+\\)"
37 |
38 | # images
39 | - underlined: "!\\[[^][]*\\](\\([^)]+\\)|\\[[^]]+\\])"
40 |
41 | # urls
42 | - underlined: "https?://[^ )>]+"
43 |
44 | - special: "^```$"
45 |
46 | - special:
47 | start: "`"
48 | end: "`"
49 | rules: []
50 |
--------------------------------------------------------------------------------
/runtime/files/syntax/julia.yaml:
--------------------------------------------------------------------------------
1 | filetype: julia
2 |
3 | detect:
4 | filename: "\\.jl$"
5 | header: "^#!.*/(env +)?julia( |$)"
6 |
7 | rules:
8 |
9 | # built-in objects
10 | - constant.bool: "\\b(true|false)\\b"
11 | # built-in attributes
12 | - constant: "__[A-Za-z0-9_]+__"
13 | # definitions
14 | - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
15 | # keywords
16 | - statement: "\\b(begin|break|catch|continue|function|elseif|struct|else|end|finally|for|global|local|const|if|include|import|using|require|macro|println|return|try|type|while|module)\\b"
17 | # decorators
18 | - identifier.macro: "@[A-Za-z0-9_]+"
19 | # operators
20 | - symbol.operator: "[-+*/|=%<>&~^]|\\b(and|not|or|is|in)\\b"
21 | # parentheses
22 | - symbol.brackets: "([(){}]|\\[|\\])"
23 | # numbers
24 | - constant.number: "\\b([0-9]+(_[0-9]+)*|0x[0-9a-fA-F]+(_[0-9a-fA-F]+)*|0b[01]+(_[01]+)*|0o[0-7]+(_[0-7]+)*)\\b"
25 |
26 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^']){1}'"
27 |
28 | - constant.string:
29 | start: "\"\"\""
30 | end: "\"\"\""
31 | rules: []
32 |
33 | - constant.string:
34 | start: "'''"
35 | end: "'''"
36 | rules: []
37 |
38 | - comment:
39 | start: "#"
40 | end: "$"
41 | rules: []
42 |
--------------------------------------------------------------------------------
/runtime/files/syntax/cmake.yaml:
--------------------------------------------------------------------------------
1 | filetype: cmake
2 |
3 | detect:
4 | filename: "(CMakeLists\\.txt|\\.cmake)$"
5 |
6 | rules:
7 | - identifier.var: "^[[:space:]]*[A-Z0-9_]+"
8 | - preproc: "^[[:space:]]*(include|include_directories|include_external_msproject)\\b"
9 |
10 | - statement: "^[[:space:]]*\\b((else|end)?if|else|(end)?while|(end)?foreach|break)\\b"
11 | - statement: "\\b(COPY|NOT|COMMAND|PROPERTY|POLICY|TARGET|EXISTS|IS_(DIRECTORY|ABSOLUTE)|DEFINED)\\b[[:space:]]"
12 | - statement: "[[:space:]]\\b(OR|AND|IS_NEWER_THAN|MATCHES|(STR|VERSION_)?(LESS|GREATER|EQUAL))\\b[[:space:]]"
13 |
14 | - special: "^[[:space:]]*\\b((end)?(function|macro)|return)"
15 |
16 | - constant.string:
17 | start: "\""
18 | end: "\""
19 | skip: "\\\\."
20 | rules:
21 | - constant.specialChar: "\\\\."
22 |
23 | - constant.string:
24 | start: "'"
25 | end: "'"
26 | skip: "\\\\."
27 | rules:
28 | - constant.specialChar: "\\\\."
29 |
30 | - preproc:
31 | start: "\\$(\\{|ENV\\{)"
32 | end: "\\}"
33 | rules: []
34 |
35 | - identifier.macro: "\\b(APPLE|UNIX|WIN32|CYGWIN|BORLAND|MINGW|MSVC(_IDE|60|71|80|90)?)\\b"
36 |
37 | - comment:
38 | start: "#"
39 | end: "$"
40 | rules:
41 | - todo: "(TODO|XXX|FIXME):?"
42 |
43 |
--------------------------------------------------------------------------------
/runtime/files/syntax/graphql.yaml:
--------------------------------------------------------------------------------
1 | filetype: graphql
2 |
3 | detect:
4 | filename: "\\.(gql|graphql)$"
5 |
6 | rules:
7 | - type: "\\b(?:(query|mutation|subscription|type|fragment|schema|union|on|extends?))\\b"
8 |
9 | # scalar types
10 | - statement: "\\b(ID|Int|Float|Boolean|String|Datetime|Null)\\b"
11 |
12 | # introspection types
13 | - statement: "(__\\w+)"
14 |
15 | # parameters
16 | - statement: "((\\w+)(?:\\:([\\s]*)?)(?:\\$))"
17 |
18 | # directive locations
19 | - statement: "\\b(QUERY|MUTATION|SUBSCRIPTION|FIELD|FRAGMENT_DEFINITION|FRAGMENT_SPREAD|INLINE_FRAGMENT|SCHEMA|SCALAR|OBJECT|FIELD_DEFINITION|ARGUMENT_DEFINITION|INTERFACE|UNION|ENUM|ENUM_VALUE|INPUT_OBJECT|INPUT_FIELD_DEFINITION)\\b"
20 |
21 | # directives
22 | - constant: "(@\\w+)"
23 |
24 | # root types
25 | - constant: "\\b(Query|Mutation|Subscription|Schema|Root)\\b"
26 |
27 | # variables
28 | - special: "(\\$\\w+)"
29 |
30 | # required symbol
31 | - special: "(!)"
32 |
33 | - symbol: "(:|=|\\||\\(|\\)|\\{|\\}|\\[|\\])"
34 |
35 | - constant.bool: "\\b(true|false)\\b"
36 |
37 | - constant.string:
38 | start: "\""
39 | end: "\""
40 | skip: "\\\\."
41 | rules:
42 | - constant.specialChar: "\\\\."
43 |
44 | - comment:
45 | start: "#"
46 | end: "$"
47 | rules: []
--------------------------------------------------------------------------------
/runtime/files/syntax/ruby.yaml:
--------------------------------------------------------------------------------
1 | filetype: ruby
2 |
3 | detect:
4 | filename: "\\.rb$|\\.gemspec$|Gemfile|config.ru|Rakefile|Capfile|Vagrantfile"
5 | header: "^#!.*/(env +)?ruby( |$)"
6 |
7 | rules:
8 | - statement: "\\b(BEGIN|END|alias|and|begin|break|case|class|def|defined\\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\\b"
9 | - constant: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*"
10 | - constant.number: "\\b[0-9]+\\b"
11 | - constant: "(i?)([ ]|^):[0-9A-Z_]+\\b"
12 | - constant: "\\b(__FILE__|__LINE__)\\b"
13 | - constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*"
14 | - constant.string: "`[^`]*`|%x\\{[^}]*\\}"
15 | - constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!"
16 | - special: "#\\{[^}]*\\}"
17 | - constant.string: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!"
18 | - comment: "#[^{].*$|#$"
19 | - comment.bright: "##[^{].*$|##$"
20 | - constant.macro:
21 | start: "<<-?'?EOT'?"
22 | end: "^EOT"
23 | rules: []
24 |
25 | - todo: "(XXX|TODO|FIXME|\\?\\?\\?)"
26 | - preproc.shebang: "^#!.+?( |$)"
27 |
--------------------------------------------------------------------------------
/runtime/files/syntax/crontab.yaml:
--------------------------------------------------------------------------------
1 | filetype: crontab
2 |
3 | detect:
4 | filename: "crontab$"
5 | header: "^#.*?/etc/crontab"
6 |
7 | rules:
8 | # The time and date fields are:
9 | # field allowed values
10 | # ----- --------------
11 | # minute 0-59
12 | # hour 0-23
13 | # day of month 0-31
14 | # month 0-12 (or names, see below)
15 | # day of week 0-7 (0 or 7 is Sun, or use names)
16 |
17 | - statement: "^([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+(.*)$\\n?"
18 | - constant: "^([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)"
19 |
20 | # Shell Values
21 | - type: "^[A-Z]+\\="
22 |
23 | # Months and weekday keywords
24 | - type: "jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec"
25 | - constant: "sun|mon|tue|wed|thu|fri|sat"
26 | - type: "\\@(reboot|yearly|annually|monthly|weekly|daily|midnight|hourly)"
27 |
28 | # Conditionals
29 | - special: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|^|!|=|&|\\|)"
30 |
31 | - comment:
32 | start: "#"
33 | end: "$"
34 | rules:
35 | - todo: "(TODO|XXX|FIXME):?"
36 |
37 |
--------------------------------------------------------------------------------
/runtime/files/syntax/rust.yaml:
--------------------------------------------------------------------------------
1 | filetype: rust
2 |
3 | detect:
4 | filename: "\\.rs$"
5 |
6 | rules:
7 | # function definition
8 | - identifier: "fn [a-z0-9_]+"
9 | # Reserved words
10 | - statement: "\\b(abstract|alignof|as|become|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\\b"
11 | # macros
12 | - special: "[a-z_]+!"
13 | # Constants
14 | - constant: "[A-Z][A-Z_]+"
15 | # Numbers
16 | - constant.number: "\\b[0-9]+\\b"
17 | # Traits/Enums/Structs/Types/etc.
18 | - type: "[A-Z][a-z]+"
19 |
20 | - constant.string:
21 | start: "\""
22 | end: "\""
23 | skip: "\\\\."
24 | rules:
25 | - constant.specialChar: "\\\\."
26 |
27 | - constant.string:
28 | start: "r#+\""
29 | end: "\"#+"
30 | rules: []
31 |
32 | - comment:
33 | start: "//"
34 | end: "$"
35 | rules:
36 | - todo: "(TODO|XXX|FIXME):?"
37 |
38 | - comment:
39 | start: "/\\*"
40 | end: "\\*/"
41 | rules:
42 | - todo: "(TODO|XXX|FIXME):?"
43 |
44 | - special:
45 | start: "#!\\["
46 | end: "\\]"
47 | rules: []
48 |
49 |
--------------------------------------------------------------------------------
/runtime/files/syntax/html5.yaml:
--------------------------------------------------------------------------------
1 | filetype: html5
2 |
3 | detect:
4 | filename: "\\.htm[l]?5$"
5 | header: ""
6 |
7 | rules:
8 | - error: "<[^!].*?>"
9 | - symbol.tag: "(?i)<[/]?(a|a(bbr|ddress|rea|rticle|side|udio)|b|b(ase|d(i|o)|lockquote|r|utton)|ca(nvas|ption)|center|cite|co(de|l|lgroup)|d(ata|atalist|d|el|etails|fn|ialog|l|t)|em|embed|fieldset|fig(caption|ure)|form|iframe|h[1-6]|hr|i|img|in(put|s)|kbd|keygen|label|legend|li|link|ma(in|p|rk)|menu|menuitem|met(a|er)|nav|noscript|o(bject|l|pt(group|ion)|utput)|p|param|picture|pre|progress|q|r(p|t|uby)|s|samp|se(ction|lect)|small|source|span|strong|su(b|p|mmary)|textarea|time|track|u|ul|var|video|wbr)( .*)*?>"
10 | - symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*)*?>"
11 | - preproc: "(?i)<[/]?(script|style)( .*)*?>"
12 | - special: "&[^;[[:space:]]]*;"
13 | - symbol: "[:=]"
14 | - identifier: "(alt|bgcolor|height|href|id|label|longdesc|name|on(click|focus|load|mouseover)|size|span|src|style|target|type|value|width)="
15 | - constant.string: "\"[^\"]*\""
16 | - constant.number: "(?i)#[0-9A-F]{6,6}"
17 | - default:
18 | start: ">"
19 | end: "<"
20 | rules: []
21 |
22 | - symbol.tag: "<|>"
23 | - constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
24 | - comment: ""
25 | - preproc: ""
26 |
--------------------------------------------------------------------------------
/runtime/files/syntax/micro.yaml:
--------------------------------------------------------------------------------
1 | filetype: micro
2 |
3 | detect:
4 | filename: "\\.(micro)$"
5 |
6 | rules:
7 | - statement: "\\b(syntax|color(-link)?)\\b"
8 | - statement: "\\b(start=|end=)\\b"
9 | # Simple one-liners
10 | - identifier: "\\b(default|number|statement|underlined|error|todo|statusline|indent-char|cursor\\-line|color\\-column|ignore|divider|tabbar)\\b"
11 | # Separate identifiers to keep "complex" regex clean
12 | - identifier: "\\b(special(Char)?)\\b"
13 | - identifier: "\\b((current\\-)?line\\-number)\\b"
14 | - identifier: "\\b(gutter\\-(info|error|warning){1})\\b"
15 | - identifier: "\\b(comment(\\.bright)?)\\b"
16 | - identifier: "\\b(symbol(\\.(brackets|operator|tag))?)\\b"
17 | - identifier: "\\b(identifier(\\.(class|macro|var))?)\\b"
18 | - identifier: "\\b(constant(\\.(bool(\\.(true|false){1})?|number|specialChar|string(\\.url)?){1})?)\\b"
19 | - identifier: "\\b(preproc(\\.shebang)?)\\b"
20 | - identifier: "\\b(type(\\.keyword)?)\\b"
21 | - constant.number: "\\b(|h|A|0x)+[0-9]+(|h|A)+\\b"
22 | - constant.number: "\\b0x[0-9 a-f A-F]+\\b"
23 | - comment:
24 | start: "#"
25 | end: "$"
26 | rules:
27 | - todo: "(FIXME|TODO|NOTE):?"
28 | - constant.string:
29 | start: "\""
30 | end: "\""
31 | skip: "\\\\."
32 | rules:
33 | - constant.specialChar: "\\\\."
34 | - constant.number: "#[0-9 A-F a-f]+"
35 |
--------------------------------------------------------------------------------
/runtime/files/syntax/pony.yaml:
--------------------------------------------------------------------------------
1 | filetype: pony
2 |
3 | detect:
4 | filename: "\\.pony$"
5 |
6 | rules:
7 | - statement: "\\b(type|interface|trait|primitive|class|struct|actor)\\b"
8 | - statement: "\\b(compiler_intrinsic)\\b"
9 | - statement: "\\b(use)\\b"
10 | - statement: "\\b(var|let|embed)\\b"
11 | - statement: "\\b(new|be|fun)\\b"
12 | - statement: "\\b(iso|trn|ref|val|box|tag|consume)\\b"
13 | - statement: "\\b(break|continue|return|error)\\b"
14 | - statement: "\\b(if|then|elseif|else|end|match|where|try|with|as|recover|object|lambda|as|digestof|ifdef)\\b"
15 | - statement: "\\b(while|do|repeat|until|for|in)\\b"
16 | - statement: "(\\?|=>)"
17 | - statement: "(\\||\\&|\\,|\\^)"
18 | - symbol.operator: "(\\-|\\+|\\*|/|\\!|%|<<|>>)"
19 | - symbol.operator: "(==|!=|<=|>=|<|>)"
20 | - statement: "\\b(is|isnt|not|and|or|xor)\\b"
21 | - type: "\\b(_*[A-Z][_a-zA-Z0-9\\']*)\\b"
22 | - constant: "\\b(this)\\b"
23 | - constant.bool: "\\b(true|false)\\b"
24 | - constant.number: "\\b((0b[0-1_]*)|(0o[0-7_]*)|(0x[0-9a-fA-F_]*)|([0-9_]+(\\.[0-9_]+)?((e|E)(\\\\+|-)?[0-9_]+)?))\\b"
25 | - constant.string: "\"(\\\\.|[^\"])*\""
26 | - comment:
27 | start: "\"\"\"[^\"]*"
28 | end: "\"\"\""
29 | rules: []
30 |
31 | - comment: "(^|[[:space:]])//.*"
32 | - comment:
33 | start: "/\\*"
34 | end: "\\*/"
35 | rules: []
36 |
37 | - todo: "TODO:?"
38 |
--------------------------------------------------------------------------------
/runtime/files/syntax/makefile.yaml:
--------------------------------------------------------------------------------
1 | filetype: makefile
2 |
3 | detect:
4 | filename: "([Mm]akefile|\\.ma?k)$"
5 | header: "^#!.*/(env +)?[bg]?make( |$)"
6 |
7 | rules:
8 | - preproc: "\\<(ifeq|ifdef|ifneq|ifndef|else|endif)\\>"
9 | - statement: "^(export|include|override)\\>"
10 | - symbol.operator: "^[^:= ]+:"
11 | - symbol.operator: "([=,%]|\\+=|\\?=|:=|&&|\\|\\|)"
12 | - statement: "\\$\\((abspath|addprefix|addsuffix|and|basename|call|dir)[[:space:]]"
13 | - statement: "\\$\\((error|eval|filter|filter-out|findstring|firstword)[[:space:]]"
14 | - statement: "\\$\\((flavor|foreach|if|info|join|lastword|notdir|or)[[:space:]]"
15 | - statement: "\\$\\((origin|patsubst|realpath|shell|sort|strip|suffix)[[:space:]]"
16 | - statement: "\\$\\((value|warning|wildcard|word|wordlist|words)[[:space:]]"
17 | - identifier: "^.+:"
18 | - identifier: "[()$]"
19 | - constant.string:
20 | start: "\""
21 | end: "\""
22 | skip: "\\\\."
23 | rules:
24 | - constant.specialChar: "\\\\."
25 | - constant.string:
26 | start: "'"
27 | end: "'"
28 | skip: "\\\\."
29 | rules:
30 | - constant.specialChar: "\\\\."
31 | - identifier: "\\$+(\\{[^} ]+\\}|\\([^) ]+\\))"
32 | - identifier: "\\$[@^<*?%|+]|\\$\\([@^<*?%+-][DF]\\)"
33 | - identifier: "\\$\\$|\\\\.?"
34 | - comment:
35 | start: "#"
36 | end: "$"
37 | rules: []
38 |
39 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/cmc-paper.micro:
--------------------------------------------------------------------------------
1 | #CaptainMcClellan's personal color scheme.
2 | #Paper version
3 | color-link default "black,white"
4 | color-link comment "bold black"
5 | color-link constant "cyan"
6 | color-link constant.bool "bold cyan"
7 | color-link constant.bool.true "bold green"
8 | color-link constant.bool.false "bold red"
9 | color-link constant.string "bold yellow"
10 | color-link constant.string.url "underline blue, white"
11 | color-link constant.number "constant"
12 | color-link constant.specialChar "bold magenta"
13 | color-link identifier "bold red"
14 | color-link identifier.macro "bold red"
15 | color-link identifier.var "bold blue"
16 | color-link identifier.class "bold green"
17 | color-link preproc "bold cyan"
18 | color-link statement "bold yellow"
19 | color-link symbol "red"
20 | color-link symbol.brackets "blue"
21 | color-link type "green"
22 | color-link type.keyword "bold green"
23 | color-link special "magenta"
24 | color-link ignore "default"
25 | color-link error ",brightred"
26 | color-link todo "black,brightyellow"
27 | color-link indent-char ",brightgreen"
28 | color-link line-number "green"
29 | color-link line-number.scrollbar "green"
30 | color-link statusline "white,blue"
31 | color-link tabbar "white,blue"
32 | color-link current-line-number "red"
33 | color-link current-line-number.scroller "red"
34 | color-link gutter-error ",red"
35 | color-link gutter-warning "red"
36 | color-link color-column "cyan"
37 | color-link underlined.url "underline blue, white"
--------------------------------------------------------------------------------
/runtime/files/syntax/asciidoc.yaml:
--------------------------------------------------------------------------------
1 | filetype: asciidoc
2 |
3 | detect:
4 | filename: "\\.(asc|asciidoc|adoc)$"
5 |
6 | rules:
7 | # main header
8 | - preproc: "^====+$"
9 | # h1
10 | - statement: "^==[[:space:]].*$"
11 | - statement: "^----+$"
12 | # h2
13 | - symbol: "^===[[:space:]].*$"
14 | - symbol: "^~~~~+$"
15 | # h4
16 | - type: "^====[[:space:]].*$"
17 | - type: "^\\^\\^\\^\\^+$"
18 | # h5
19 | - constant: "^=====[[:space:]].*$"
20 | - constant: "^\\+\\+\\+\\++$"
21 |
22 | # attributes
23 | - type.keyword: ":.*:"
24 | - identifier.macro: "\\{[a-z0-9]*\\}"
25 | - identifier: "\\\\\\{[a-z0-9]*\\}"
26 | - identifier: "\\+\\+\\+\\{[a-z0-9]*\\}\\+\\+\\+"
27 |
28 | # Paragraph Title
29 | - statement: "^\\..*$"
30 |
31 | # source
32 | - identifier: "^\\[(source,.+|NOTE|TIP|IMPORTANT|WARNING|CAUTION)\\]"
33 |
34 | # Other markup
35 | - constant.string: ".*[[:space:]]\\+$"
36 | - constant.string: "_[^_]+_"
37 | - constant.string: "\\*[^\\*]+\\*"
38 | - constant.string: "\\+[^\\+]+\\+"
39 | - constant.string: "`[^`]+`"
40 | - constant.string: "\\^[^\\^]+\\^"
41 | - constant.string: "~[^~]+~"
42 | - constant.string: "'[^']+'"
43 |
44 | - constant: "`{1,2}[^']+'{1,2}"
45 |
46 | # bullets
47 | - symbol: "^[[:space:]]*[\\*\\.-]{1,5}[[:space:]]"
48 |
49 | # anchors
50 | - "bold default": "\\[\\[.*\\]\\]"
51 | - "bold default": "<<.*>>"
52 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/cmc-tc.micro:
--------------------------------------------------------------------------------
1 | #CaptainMcClellan's personal colour scheme.
2 | #Full colour edition.
3 | color-link default "#aaaaaa,#1e2124"
4 | color-link comment "bold #555555"
5 | color-link constant "#008888"
6 | #color-link constant.string "#888800"
7 | color-link constant.string "#a85700"
8 | color-link constant.specialChar "bold #ccccff"
9 | color-link identifier "bold #e34234"
10 | color-link identifier.macro "bold #e34234"
11 | color-link identifier.var "bold #5757ff"
12 | color-link identifier.class "bold #ffffff"
13 | color-link statement "bold #ffff55"
14 | color-link symbol "#722f37"
15 | color-link symbol.brackets "#4169e1"
16 | color-link symbol.tag "#5757ff"
17 | color-link preproc "bold #55ffff"
18 | color-link type "#3eb489"
19 | color-link type.keyword "bold #bdecb6"
20 | color-link special "#b57edc"
21 | color-link ignore "default"
22 | color-link error "bold ,#e34234"
23 | color-link todo "bold underline #888888,#f26522"
24 | color-link indent-char ",#bdecb6"
25 | color-link line-number "#bdecb6,#36393e"
26 | color-link line-number.scrollbar "#3eb489"
27 | color-link statusline "#aaaaaa,#8a496b"
28 | color-link tabbar "#aaaaaa,#8a496b"
29 | color-link current-line-number "bold #e34234,#424549"
30 | color-link current-line-number.scroller "red"
31 | color-link gutter-error ",#e34234"
32 | color-link gutter-warning "#e34234"
33 | color-link color-column "#f26522"
34 | color-link constant.bool "bold #55ffff"
35 | color-link constant.bool.true "bold #85ff85"
36 | color-link constant.bool.false "bold #ff8585"
--------------------------------------------------------------------------------
/runtime/files/syntax/html4.yaml:
--------------------------------------------------------------------------------
1 | filetype: html4
2 |
3 | detect:
4 | filename: "\\.htm[l]?4$"
5 | header: ""
6 |
7 | rules:
8 | - error: "<[^!].*?>"
9 | - symbol.tag: "(?i)<[/]?(a(bbr|cronym|ddress|pplet|rea|rticle|side|udio)?|b(ase(font)?|d(i|o)|ig|lockquote|r)?|ca(nvas|ption)|center|cite|co(de|l|lgroup)|d(ata(list)?|d|el|etails|fn|ialog|ir|l|t)|em(bed)?|fieldset|fig(caption|ure)|font|form|(i)?frame|frameset|h[1-6]|hr|i|img|in(put|s)|kbd|keygen|label|legend|li(nk)?|ma(in|p|rk)|menu(item)?|met(a|er)|nav|no(frames|script)|o(l|pt(group|ion)|utput)|p(aram|icture|re|rogress)?|q|r(p|t|uby)|s(trike)?|samp|se(ction|lect)|small|source|span|strong|su(b|p|mmary)|textarea|time|track|u(l)?|var|video|wbr)( .*|>)*?>"
10 | - symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*)*?>"
11 | - preproc: "(?i)<[/]?(script|style)( .*)*?>"
12 | - special: "&[^;[[:space:]]]*;"
13 | - symbol: "[:=]"
14 | - identifier: "(alt|bgcolor|height|href|id|label|longdesc|name|on(click|focus|load|mouseover)|size|span|src|style|target|type|value|width)="
15 | - constant.string: "\"[^\"]*\""
16 | - constant.number: "(?i)#[0-9A-F]{6,6}"
17 | - default:
18 | start: ">"
19 | end: "<"
20 | rules: []
21 |
22 | - symbol.tag: "<|>"
23 | - constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
24 | - comment: ""
25 | - preproc: ""
26 |
--------------------------------------------------------------------------------
/runtime/files/syntax/zig.yaml:
--------------------------------------------------------------------------------
1 | filetype: zig
2 |
3 | detect:
4 | filename: "\\.zig$"
5 |
6 | rules:
7 | # function definition
8 | - identifier: "fn [a-z0-9_]+"
9 | # Reserved words
10 | - statement: "\\b(align|and|allowzero|anyerror|asm|async|await|break|cancel|catch|comptime|const|continue|defer|else|enum|errdefer|error|export|extern|false|fn|for|if|inline|nakedcc|noalias|null|or|orelse|packed|promise|pub|resume|return|linksection|stdcallcc|struct|suspend|switch|test|threadlocal|true|try|undefined|union|unreachable|use|var|volatile|while)\\b"
11 | # builtin functions
12 | - special: "@+[a-z_]+"
13 | # Constants
14 | - constant: "[A-Z][A-Z_]+([0-9]+)?"
15 | # Numbers (hexadecimal + decimal)
16 | - constant.number: "\\b(0x[A-F0-9]+|[0-9]+)\\b"
17 | # Primitive Types / Derived Data Types
18 | - type: "([A-Z][a-z]+|(i8|u8|i16|u16|i32|u32|i64|u64|i128|u128|isize|usize|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|c_longlong|c_ulonglong|c_longdouble|c_void|f16|f32|f64|f128|bool|void|noreturn|type|anyerror|comptime_int|comptime_float))"
19 |
20 | - constant.string:
21 | start: "\""
22 | end: "\""
23 | skip: "\\\\."
24 | rules:
25 | - constant.specialChar: "\\\\."
26 |
27 | - comment:
28 | start: "//"
29 | end: "$"
30 | rules:
31 | - todo: "(TODO|XXX|FIXME):?"
32 |
33 | - comment:
34 | start: "/\\*"
35 | end: "\\*/"
36 | rules:
37 | - todo: "(TODO|XXX|FIXME):?"
38 |
--------------------------------------------------------------------------------
/cmd/femto/femto.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "io/ioutil"
6 | "log"
7 | "os"
8 |
9 | "github.com/gdamore/tcell/v2"
10 | "github.com/pgavlin/femto"
11 | "github.com/pgavlin/femto/runtime"
12 | "github.com/rivo/tview"
13 | )
14 |
15 | func saveBuffer(b *femto.Buffer, path string) error {
16 | return ioutil.WriteFile(path, []byte(b.String()), 0600)
17 | }
18 |
19 | func main() {
20 | if len(os.Args) != 2 {
21 | fmt.Fprintf(os.Stderr, "usage: femto [filename]\n")
22 | os.Exit(1)
23 | }
24 | path := os.Args[1]
25 |
26 | content, err := ioutil.ReadFile(path)
27 | if err != nil {
28 | log.Fatalf("could not read %v: %v", path, err)
29 | }
30 |
31 | var colorscheme femto.Colorscheme
32 | if monokai := runtime.Files.FindFile(femto.RTColorscheme, "monokai"); monokai != nil {
33 | if data, err := monokai.Data(); err == nil {
34 | colorscheme = femto.ParseColorscheme(string(data))
35 | }
36 | }
37 |
38 | app := tview.NewApplication()
39 | buffer := femto.NewBufferFromString(string(content), path)
40 | root := femto.NewView(buffer)
41 | root.SetRuntimeFiles(runtime.Files)
42 | root.SetColorscheme(colorscheme)
43 | root.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
44 | switch event.Key() {
45 | case tcell.KeyCtrlS:
46 | saveBuffer(buffer, path)
47 | return nil
48 | case tcell.KeyCtrlQ:
49 | app.Stop()
50 | return nil
51 | }
52 | return event
53 | })
54 | app.SetRoot(root, true)
55 |
56 | if err := app.Run(); err != nil {
57 | log.Fatalf("%v", err)
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/runtime/files/syntax/c++.yaml:
--------------------------------------------------------------------------------
1 | filetype: c++
2 |
3 | detect:
4 | filename: "\\.c(c|pp|xx)$|\\.h(h|pp|xx)$|\\.ii?$|\\.(def)$"
5 |
6 | rules:
7 | - identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
8 | - type: "\\b(auto|float|double|bool|char|int|short|long|sizeof|enum|void|static|const|constexpr|struct|union|typedef|extern|(un)?signed|inline)\\b"
9 | - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
10 | - statement: "\\b(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\\b"
11 | - statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
12 | - statement: "\\b(try|throw|catch|operator|new|delete)\\b"
13 | - special: "\\b(goto|continue|break|return)\\b"
14 | - preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
15 | - constant: "'([^'\\\\]|(\\\\[\"'abfnrtv\\\\]))'|'\\\\(([0-3]?[0-7]{1,2}))'|'\\\\x[0-9A-Fa-f]{1,2}'"
16 | - statement: "__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
17 | - symbol.operator: "[.:;,+*|=!\\%]|<|>|/|-|&"
18 | - symbol.brackets: "[(){}]|\\[|\\]"
19 | - constant.number: "\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b"
20 | - constant.bool: "\\b(true|false)\\b|NULL"
21 | - constant.string: "\"(\\\\.|[^\"])*\""
22 | - comment: "//.*"
23 | - comment:
24 | start: "/\\*"
25 | end: "\\*/"
26 | rules: []
27 |
28 | - indent-char.whitespace: "[[:space:]]+$"
29 |
--------------------------------------------------------------------------------
/runtime/files/syntax/cython.yaml:
--------------------------------------------------------------------------------
1 | filetype: cython
2 |
3 | detect:
4 | filename: "\\.pyx$|\\.pxd$|\\.pyi$"
5 |
6 | rules:
7 | # Python Keyword Color
8 | - statement: "\\b(and|as|assert|class|def|DEF|del|elif|ELIF|else|ELSE|except|exec|finally|for|from|global|if|IF|import|in|is|lambda|map|not|or|pass|print|raise|try|while|with|yield)\\b"
9 | - special: "\\b(continue|break|return)\\b"
10 |
11 | # Cython Keyword Color
12 | - identifier.macro: "\\b(cdef|cimport|cpdef|cppclass|ctypedef|extern|include|namespace|property|struct)\\b"
13 | - type: "\\b(bint|char|double|int|public|void|unsigned)\\b"
14 |
15 | # Operator Color
16 | - symbol: "[.:;,+*|=!\\%]|<|>|/|-|&"
17 |
18 | # Parenthetical Color
19 | - symbol.brackets: "[(){}]|\\[|\\]"
20 |
21 | - constant.string:
22 | start: "\"\"\""
23 | end: "\"\"\""
24 | rules:
25 | - constant.specialChar: "\\\\."
26 |
27 | - constant.string:
28 | start: "'''"
29 | end: "'''"
30 | rules:
31 | - constant.specialChar: "\\\\."
32 |
33 | - constant.string:
34 | start: "\""
35 | end: "\""
36 | skip: "\\\\."
37 | rules:
38 | - constant.specialChar: "\\\\."
39 |
40 | - constant.string:
41 | start: "'"
42 | end: "'"
43 | skip: "\\\\."
44 | rules:
45 | - constant.specialChar: "\\\\."
46 |
47 | - comment:
48 | start: "#"
49 | end: "$"
50 | rules:
51 | - todo: "(TODO|XXX|FIXME):?"
52 |
53 |
--------------------------------------------------------------------------------
/runtime/files/syntax/puppet.yaml:
--------------------------------------------------------------------------------
1 | filetype: puppet
2 |
3 | detect:
4 | filename: "\\.pp$"
5 |
6 | rules:
7 | - default: "^[[:space:]]([a-z][a-z0-9_]+)"
8 | - identifier.var: "\\$[a-z:][a-z0-9_:]+"
9 | - type: "\\b(augeas|computer|cron|exec|file|filebucket|group|host|interface|k5login|macauthorization|mailalias|maillist|mcx|mount|nagios_command|nagios_contact|nagios_contactgroup|nagios_host|nagios_hostdependency|nagios_hostescalation|nagios_hostextinfo|nagios_hostgroup|nagios_service|nagios_servicedependency|nagios_serviceescalation|nagios_serviceextinfo|nagios_servicegroup|nagios_timeperiod|notify|package|resources|router|schedule|scheduled_task|selboolean|selmodule|service|ssh_authorized_key|sshkey|stage|tidy|user|vlan|yumrepo|zfs|zone|zpool|anchor)\\b"
10 | - statement: "\\b(class|define|if|else|undef|inherits)\\b"
11 | - symbol: "(=|-|~|>)"
12 | - identifier.var: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*"
13 | - symbol: "([ ]|^):[0-9A-Z_]+\\b"
14 | - constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*"
15 | - constant.string: "`[^`]*`|%x\\{[^}]*\\}"
16 | - constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!"
17 | - special: "\\$\\{[^}]*\\}"
18 | - constant.string: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!"
19 | - comment: "#[^{].*$|#$"
20 | - comment.bright: "##[^{].*$|##$"
21 | - todo: "(XXX|TODO|FIXME|\\?\\?\\?)"
22 | - indent-char.whitespace: "[[:space:]]+$"
23 |
--------------------------------------------------------------------------------
/runtime/files/syntax/dart.yaml:
--------------------------------------------------------------------------------
1 | filetype: dart
2 |
3 | detect:
4 | filename: "\\.dart$"
5 |
6 | rules:
7 | - constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b"
8 | - constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
9 | - constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
10 | - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
11 | - statement: "\\b(break|case|catch|continue|default|else|finally)\\b"
12 | - statement: "\\b(for|function|get|if|in|as|is|new|return|set|switch|final|await|async|sync)\\b"
13 | - statement: "\\b(switch|this|throw|try|var|void|while|with|import|library|part|const|export)\\b"
14 | - constant: "\\b(true|false|null)\\b"
15 | - type: "\\b(List|String)\\b"
16 | - type: "\\b(int|num|double|bool)\\b"
17 | - statement: "[-+/*=<>!~%?:&|]"
18 | - constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*"
19 | - constant: "\\\\[0-7][0-7]?[0-7]?|\\\\x[0-9a-fA-F]+|\\\\[bfnrt'\"\\?\\\\]"
20 |
21 | - comment:
22 | start: "//"
23 | end: "$"
24 | rules:
25 | - todo: "TODO:?"
26 |
27 | - comment:
28 | start: "/\\*"
29 | end: "\\*/"
30 | rules:
31 | - todo: "TODO:?"
32 |
33 | - constant.string:
34 | start: "\""
35 | end: "\""
36 | skip: "\\\\."
37 | rules:
38 | - constant.specialChar: "\\\\."
39 |
40 | - constant.string:
41 | start: "'"
42 | end: "'"
43 | skip: "\\\\."
44 | rules:
45 | - constant.specialChar: "\\\\."
46 |
47 |
--------------------------------------------------------------------------------
/runtime/files/colorschemes/cmc-16.micro:
--------------------------------------------------------------------------------
1 | #CaptainMcClellan's personal color scheme.
2 | #16 colour version.
3 | color-link comment "bold black"
4 | color-link constant "cyan"
5 | color-link constant.bool "bold cyan"
6 | color-link constant.bool.true "bold green"
7 | color-link constant.bool.false "bold red"
8 | color-link constant.string "yellow"
9 | color-link constant.string.url "underline blue, white"
10 | #color-link constant.number "constant"
11 | color-link constant.specialChar "bold magenta"
12 | color-link identifier "bold red"
13 | color-link identifier.macro "bold red"
14 | color-link identifier.var "bold blue"
15 | #color-link identifier.class "bold green"
16 | color-link identifier.class "bold white"
17 | color-link statement "bold yellow"
18 | color-link symbol "red"
19 | color-link symbol.brackets "blue"
20 | color-link symbol.tag "bold blue"
21 | color-link symbol.tag.extended "bold green"
22 | color-link preproc "bold cyan"
23 | color-link type "green"
24 | color-link type.keyword "bold green"
25 | color-link special "magenta"
26 | color-link ignore "default"
27 | color-link error "bold ,brightred"
28 | color-link todo "underline black,brightyellow"
29 | color-link indent-char ",brightgreen"
30 | color-link line-number "green"
31 | color-link line-number.scrollbar "green"
32 | color-link statusline "white,blue"
33 | color-link tabbar "white,blue"
34 | color-link current-line-number "red"
35 | color-link current-line-number.scroller "red"
36 | color-link gutter-error ",red"
37 | color-link gutter-warning "red"
38 | color-link color-column "cyan"
39 | color-link underlined.url "underline blue, white"
40 | color-link divider "blue"
41 |
--------------------------------------------------------------------------------
/runtime/files/syntax/ocaml.yaml:
--------------------------------------------------------------------------------
1 | filetype: ocaml
2 |
3 | detect:
4 | filename: "\\.mli?$"
5 |
6 | rules:
7 | - identifier: "\\b[A-Z][0-9a-z_]{2,}\\b"
8 | #declarations
9 | - statement: "\\b(let|val|method|in|and|rec|private|virtual|constraint)\\b"
10 | #structure items
11 | - type: "\\b(type|open|class|module|exception|external)\\b"
12 | #patterns
13 | - statement: "\\b(fun|function|functor|match|try|with)\\b"
14 | #patterns-modifiers
15 | - statement: "\\b(as|when|of)\\b"
16 | #conditions
17 | - statement: "\\b(if|then|else)\\b"
18 | #blocs
19 | - type: "\\b(begin|end|object|struct|sig|for|while|do|done|to|downto)\\b"
20 | #constantes
21 | - constant.bool: "\\b(true|false)\\b"
22 | #modules/classes
23 | - special: "\\b(include|inherit|initializer)\\b"
24 | #expr modifiers
25 | - special: "\\b(new|ref|mutable|lazy|assert|raise)\\b"
26 | - constant.string:
27 | start: "'"
28 | end: "'"
29 | skip: "\\\\."
30 | rules:
31 | - constant.specialChar: "%."
32 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
33 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
34 | - constant.string:
35 | start: "\""
36 | end: "\""
37 | skip: "\\\\."
38 | rules:
39 | - constant.specialChar: "%."
40 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
41 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
42 | - comment:
43 | start: "\\(\\*"
44 | end: "\\*\\)"
45 | rules: []
46 |
--------------------------------------------------------------------------------
/runtime/files/syntax/awk.yaml:
--------------------------------------------------------------------------------
1 | filetype: awk
2 |
3 | detect:
4 | filename: "\\.awk$"
5 | header: "^#!.*bin/(env +)?awk( |$)"
6 |
7 | rules:
8 | - preproc: "\\$[A-Za-z0-9_!@#$*?\\-]+"
9 | - preproc: "\\b(ARGC|ARGIND|ARGV|BINMODE|CONVFMT|ENVIRON|ERRNO|FIELDWIDTHS)\\b"
10 | - preproc: "\\b(FILENAME|FNR|FS|IGNORECASE|LINT|NF|NR|OFMT|OFS|ORS)\\b"
11 | - preproc: "\\b(PROCINFO|RS|RT|RSTART|RLENGTH|SUBSEP|TEXTDOMAIN)\\b"
12 | - identifier.class: "\\b(function|extension|BEGIN|END)\\b"
13 | - symbol.operator: "[\\-+*/%^|!=&<>?;:]|\\\\|\\[|\\]"
14 | - statement: "\\b(for|if|while|do|else|in|delete|exit)\\b"
15 | - special: "\\b(break|continue|return)\\b"
16 | - statement: "\\b(close|getline|next|nextfile|print|printf|system|fflush)\\b"
17 | - statement: "\\b(atan2|cos|exp|int|log|rand|sin|sqrt|srand)\\b"
18 | - statement: "\\b(asort|asorti|gensub|gsub|index|length|match)\\b"
19 | - statement: "\\b(split|sprintf|strtonum|sub|substr|tolower|toupper)\\b"
20 | - statement: "\\b(mktime|strftime|systime)\\b"
21 | - statement: "\\b(and|compl|lshift|or|rshift|xor)\\b"
22 | - statement: "\\b(bindtextdomain|dcgettext|dcngettext)\\b"
23 | - special: "/.*[^\\\\]/"
24 |
25 | - constant.string:
26 | start: "\""
27 | end: "\""
28 | skip: "\\\\."
29 | rules:
30 | - constant.specialChar: "\\\\."
31 |
32 | - constant.string:
33 | start: "'"
34 | end: "'"
35 | skip: "\\\\."
36 | rules:
37 | - constant.specialChar: "\\\\."
38 |
39 | - comment:
40 | start: "#"
41 | end: "$"
42 | rules:
43 | - todo: "(TODO|XXX|FIXME):?"
44 |
45 |
--------------------------------------------------------------------------------
/runtime/files/syntax/privoxy-action.yaml:
--------------------------------------------------------------------------------
1 | filetype: privoxy-action
2 |
3 | detect:
4 | filename: "\\.action$"
5 |
6 | rules:
7 | - constant.bool.false: "[{[:space:]]\\-block([[:space:]{}]|$)"
8 | - constant.bool.true: "[{[:space:]]\\+block([[:space:]{}]|$)"
9 | - constant.bool.false: "-(add-header|change-x-forwarded-for|client-header-filter|client-header-tagger|content-type-overwrite|crunch-client-header|crunch-if-none-match|crunch-incoming-cookies|crunch-outgoing-cookies|crunch-server-header|deanimate-gifs|downgrade-http-version|fast-redirects|filter|force-text-mode|forward-override|handle-as-empty-document|handle-as-image|hide-accept-language|hide-content-disposition|hide-from-header|hide-if-modified-since|hide-referrer|hide-user-agent|limit-connect|overwrite-last-modified|prevent-compression|redirect|server-header-filter|server-header-tagger|session-cookies-only|set-image-blocker)"
10 | - constant.bool.true: "\\+(add-header|change-x-forwarded-for|client-header-filter|client-header-tagger|content-type-overwrite|crunch-client-header|crunch-if-none-match|crunch-incoming-cookies|crunch-outgoing-cookies|crunch-server-header|deanimate-gifs|downgrade-http-version|fast-redirects|filter|force-text-mode|forward-override|handle-as-empty-document|handle-as-image|hide-accept-language|hide-content-disposition|hide-from-header|hide-if-modified-since|hide-referrer|hide-user-agent|limit-connect|overwrite-last-modified|prevent-compression|redirect|server-header-filter|server-header-tagger|session-cookies-only|set-image-blocker)"
11 | - constant.specialChar: "\\\\.?"
12 | - comment: "(^|[[:space:]])#([^{].*)?$"
13 | - indent-char.whitespace: "[[:space:]]+$"
14 | - indent-char: " + +| + +"
15 |
--------------------------------------------------------------------------------
/runtime/files/syntax/ada.yaml:
--------------------------------------------------------------------------------
1 | filetype: ada
2 |
3 | detect:
4 | filename: "(\\.ads$|\\.adb$|\\.ada$)"
5 |
6 | rules:
7 | # Operators
8 | - symbol.operator: ([.:;,+*|=!?\\%]|<|>|/|-|&)
9 | - symbol.brackets: "[(){}]|\\[|\\]"
10 | # keyword.reserved
11 | - statement.reserved: \b(abort|abs|abstract|accept|access|aliased|all|and|array|at|begin|body|case)\b
12 | - statement.reserved: \b(constant|declare|delay|delta|digits|do|else|elsif|end|entry|exception|exit|for|function)\b
13 | - statement.reserved: \b(generic|goto|if|in|interface|is|limited|loop|mod|new|not|null|of|or|others|out|overriding)\b
14 | - statement.reserved: \b(package|pragma|private|procedure|protected|raise|range|record|rem|renames|return|requeue)\b
15 | - statement.reserved: \b(reverse|select|separate|some|subtype|synchronized|tagged|task|terminate|then|type|until)\b
16 | - statement.reserved: \b(use|when|while|with|xor)\b
17 |
18 | # Constant
19 | - constant.bool: \b(TRUE|FALSE)
20 | - constant.number: ([0-9]+)
21 |
22 | # Storage Types
23 | - type.storage: \b(INTEGER|NATURAL|POSITIVE|FLOAT|CHARACTER|STRING)\b
24 | - type.storage: \b(LONG_INTEGER|SHORT_INTEGER|LONG_FLOAT|SHORT_FLOAT)\b
25 |
26 | #Character
27 | - constant.string.char: \'.\'
28 |
29 | # String
30 | - constant.string:
31 | start: \"
32 | end: \"
33 | skip: \\.
34 | rules:
35 | - constant.specialChar: (\\0|\\\\|\\t|\\n|\\r|\\"|\\')
36 | - constant.interpolation: \\\([[:graph:]]*\)
37 | - constant.unicode: \\u\{[[:xdigit:]]+}
38 |
39 |
40 | # Line Comment
41 | - comment.line: "--.*"
42 |
43 | # Todo
44 | - todo: "(TODO|XXX|FIXME):?"
45 |
--------------------------------------------------------------------------------
/runtime/files/syntax/perl6.yaml:
--------------------------------------------------------------------------------
1 | filetype: perl6
2 |
3 | detect:
4 | filename: "(\\.p6$|\\.pl6$|\\.pm6$)"
5 |
6 | rules:
7 | - 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)|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|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|seekdir|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|un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\\b"
8 | - 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"
9 | - special: "\\b(has|is|class|role|given|when|BUILD|multi|returns|method|submethod|slurp|say|sub)\\b"
10 | - identifier:
11 | start: "[$@%]"
12 | end: "( |\\\\W|-)"
13 | rules: []
14 |
15 | - constant.string: "\".*\"|qq\\|.*\\|"
16 | - default: "[sm]/.*/"
17 | - preproc:
18 | start: "(^use| = new)"
19 | end: ";"
20 | rules: []
21 |
22 | - comment: "#.*"
23 | - identifier.macro:
24 | start: "<|<=|>=)"
17 |
18 | # Various symbols
19 | - special: "(->|<-)"
20 | - symbol: "\\.|\\$"
21 |
22 | # Data constructors
23 | - constant.bool: "\\b(True|False)\\b"
24 | - constant: "(Nothing|Just|Left|Right|LT|EQ|GT)"
25 |
26 | # Data classes
27 | - identifier.class: "[ ](Read|Show|Enum|Eq|Ord|Data|Bounded|Typeable|Num|Real|Fractional|Integral|RealFrac|Floating|RealFloat|Monad|MonadPlus|Functor)"
28 |
29 | # Strings
30 | - constant.string:
31 | start: "\""
32 | end: "\""
33 | skip: "\\\\."
34 | rules:
35 | - constant.specialChar: "\\\\."
36 |
37 | # Comments
38 | - comment:
39 | start: "--"
40 | end: "$"
41 | rules:
42 | - todo: "(TODO|XXX|FIXME):?"
43 |
44 | - comment:
45 | start: "\\{-"
46 | end: "-\\}"
47 | rules:
48 | - todo: "(TODO|XXX|FIXME):?"
49 |
50 | - identifier.micro: "undefined"
51 |
--------------------------------------------------------------------------------
/runtime/files/syntax/solidity.yaml:
--------------------------------------------------------------------------------
1 | filetype: solidity
2 |
3 | detect:
4 | filename: "\\.sol$"
5 |
6 | rules:
7 | - preproc: "\\b(contract|library|pragma)\\b"
8 | - constant.number: "\\b[-]?([0-9]+|0x[0-9a-fA-F]+)\\b"
9 | - identifier: "[a-zA-Z][_a-zA-Z0-9]*[[:space:]]*"
10 | - statement: "\\b(assembly|break|continue|do|for|function|if|else|new|return|returns|while)\\b"
11 | - special: "\\b(\\.send|throw)\\b" # make sure they are very visible
12 | - type.keyword: "\\b(anonymous|constant|indexed|payable|public|private|external|internal)\\b"
13 | - constant: "\\b(block(\\.(blockhash|coinbase|difficulty|gaslimit|number|timestamp))?|msg(\\.(data|gas|sender|value))?|now|tx(\\.(gasprice|origin))?)\\b"
14 | - constant: "\\b(keccak256|sha3|sha256|ripemd160|ecrecover|addmod|mulmod|this|super|selfdestruct|\\.balance)\\b"
15 | - constant: "\\b(true|false)\\b"
16 | - constant: "\\b(wei|szabo|finney|ether|seconds|minutes|hours|days|weeks|years)\\b"
17 | - type: "\\b(address|bool|mapping|string|var|int(\\d*)|uint(\\d*)|byte(\\d*)|fixed(\\d*)|ufixed(\\d*))\\b"
18 | - error: "\\b(abstract|after|case|catch|default|final|in|inline|interface|let|match|null|of|pure|relocatable|static|switch|try|type|typeof|view)\\b"
19 | - operator: "[-+/*=<>!~%?:&|]"
20 | - comment:
21 | start: "//"
22 | end: "$"
23 | rules: []
24 | - comment:
25 | start: "/\\*"
26 | end: "\\*/"
27 | rules: []
28 | - todo: "TODO:?"
29 | - constant.string:
30 | start: "\""
31 | end: "\""
32 | skip: "\\\\."
33 | rules:
34 | - constant.specialChar: "\\\\."
35 | - constant.string:
36 | start: "'"
37 | end: "'"
38 | skip: "\\\\."
39 | rules:
40 | - constant.specialChar: "\\\\."
41 |
42 |
--------------------------------------------------------------------------------
/runtime/files/syntax/html.yaml:
--------------------------------------------------------------------------------
1 | filetype: html
2 |
3 | detect:
4 | filename: "\\.htm[l]?$"
5 |
6 | rules:
7 | - error: "<[^!].*?>"
8 | - symbol.tag: "(?i)<[/]?(a(bbr|cronym|ddress|pplet|rea|rticle|side|udio)?|b(ase(font)?|d(i|o)|ig|lockquote|r)?|ca(nvas|ption)|center|cite|co(de|l|lgroup)|d(ata(list)?|d|el|etails|fn|ialog|ir|l|t)|em(bed)?|fieldset|fig(caption|ure)|font|form|(i)?frame|frameset|h[1-6]|hr|i|img|in(put|s)|kbd|keygen|label|legend|li(nk)?|ma(in|p|rk)|menu(item)?|met(a|er)|nav|no(frames|script)|o(l|pt(group|ion)|utput)|p(aram|icture|re|rogress)?|q|r(p|t|uby)|s(trike)?|samp|se(ction|lect)|small|source|span|strong|su(b|p|mmary)|textarea|time|track|u(l)?|var|video|wbr)( .*|>)*?>"
9 | - symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*)*?>"
10 | - special: "&[^;[[:space:]]]*;"
11 | - symbol: "[:=]"
12 | - identifier: "(alt|bgcolor|height|href|id|label|longdesc|name|on(click|focus|load|mouseover)|size|span|src|target|type|value|width)="
13 | - constant.number: "(?i)#[0-9A-F]{6,6}"
14 | # - default:
15 | # start: ">"
16 | # end: "<"
17 | # rules: []
18 |
19 | - symbol.tag: "<|>"
20 | - constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
21 | - comment: ""
22 | - preproc: ""
23 |
24 | - constant.string:
25 | start: "\""
26 | end: "\""
27 | skip: "\\\\."
28 | rules:
29 | - constant.specialChar: "\\\\."
30 |
31 | - default:
32 | start: ""
33 | end: ""
34 | limit-group: symbol.tag
35 | rules:
36 | - include: "javascript"
37 |
38 | - default:
39 | start: ""
40 | end: ""
41 | limit-group: symbol.tag
42 | rules:
43 | - include: "css"
44 |
45 |
--------------------------------------------------------------------------------
/runtime/files/syntax/c.yaml:
--------------------------------------------------------------------------------
1 | filetype: c
2 |
3 | detect:
4 | filename: "(\\.(c|C)$|\\.(h|H)$|\\.ii?$|\\.(def)$)"
5 |
6 | rules:
7 | - identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
8 | - type: "\\b(float|double|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\\b"
9 | - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
10 | - type.extended: "\\b(bool)\\b"
11 | - statement: "\\b(volatile|register)\\b"
12 | - statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
13 | - statement: "\\b(goto|continue|break|return)\\b"
14 | - preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
15 | - constant: "'([^'\\\\]|(\\\\[\"'abfnrtv\\\\]))'"
16 | - constant: "'\\\\(([0-3]?[0-7]{1,2}))'"
17 | - constant: "'\\\\x[0-9A-Fa-f]{1,2}'"
18 | # GCC builtins
19 | - statement: "__attribute__[[:space:]]*\\(\\([^)]*\\)\\)"
20 | - statement: "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
21 | # Operator Color
22 | - symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)"
23 | - symbol.brackets: "[(){}]|\\[|\\]"
24 | - constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)"
25 | - constant.number: "NULL"
26 |
27 | - constant.string:
28 | start: "\""
29 | end: "\""
30 | skip: "\\\\."
31 | rules:
32 | - constant.specialChar: "\\\\."
33 |
34 | - constant.string:
35 | start: "'"
36 | end: "'"
37 | skip: "\\\\."
38 | rules:
39 | - preproc: "..+"
40 | - constant.specialChar: "\\\\."
41 |
42 | - comment:
43 | start: "//"
44 | end: "$"
45 | rules:
46 | - todo: "(TODO|XXX|FIXME):?"
47 |
48 | - comment:
49 | start: "/\\*"
50 | end: "\\*/"
51 | rules:
52 | - todo: "(TODO|XXX|FIXME):?"
53 |
--------------------------------------------------------------------------------
/runtime/files/syntax/elixir.yaml:
--------------------------------------------------------------------------------
1 | filetype: elixir
2 |
3 | detect:
4 | filename: "\\.ex$|\\.exs$"
5 |
6 | rules:
7 | - statement: "\\b(abs|trunc|rem|div|round|max|min|and|or|not|throw|raise|reraise|hd|tl|in|length|elem|put_elem|destructure|to_(string|charlist)|is_(atom|binary|bitstring|boolean|float|function|integer|list|map|nil|number|pid|port|reference|tuple)|(bit|byte|map|tuple)_size|binary_part|def(delegate|exception|guard|guardp|impl|macro|macrop|module|overridable|p|protocol|struct)?|sigil_[crswCRSWDNT]|if|else|unless|cond|binding|node|self|spawn|spawn_link|spawn_monitor|send|exit|struct|get_and_update_in|get_in|put_in|pop_in|update_in|apply|inspect|make_ref|use|do|end)\\b"
8 | - statement: "\\b(alias|import|require|case|fn|receive|after|try|catch|rescue|super|quote|unquote|unquote_splicing|for|with)\\b"
9 |
10 | - constant: "\\b\\[A-Z]+\\b"
11 | - constant.number: "\\b[0-9]+\\b"
12 |
13 | - constant.string: "`[^`]*`|%x\\{[^}]*\\}"
14 | - constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!"
15 | - constant.string: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!"
16 |
17 | - symbol.brackets: "\\{|\\}|\\[|\\]|\\(|\\)"
18 |
19 | - comment: "#[^{].*$|#$"
20 | - comment.bright: "##[^{].*$|##$"
21 |
22 | - type.keyword: "\\:[a-zA-Z][a-zA-Z0-9_]*"
23 | - type.keyword: "\\b(describe|test)"
24 | - statement: "\\b(expected|assert|assert_raise|assert_in_delta|assert_received|catch_error|catch_throw|flunk|refute|refute_in_delta|refute_received)\\b"
25 | - symbol.tag: "^\\s*\\@[a-zA-Z][a-zA-Z0-9_]*\\b"
26 |
27 | - identifier.macro: "\\b(__CALLER__|__DIR__|__ENV__|__MODULE__|__aliases__|__block__|defmacro)\\b"
28 |
29 | - todo: "(XXX|TODO|FIXME|\\?\\?\\?)"
30 | - preproc.shebang: "\\W*#!.+?( |$)"
31 |
--------------------------------------------------------------------------------
/runtime/files/syntax/typescript.yaml:
--------------------------------------------------------------------------------
1 | filetype: typescript
2 |
3 | detect:
4 | filename: "\\.ts$"
5 |
6 | rules:
7 | - constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b"
8 | - constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
9 | - constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
10 | - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
11 | - statement: "\\b(abstract|as|async|await|break|case|catch|class|const|constructor|continue)\\b"
12 | - statement: "\\b(debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from)\\b"
13 | - statement: "\\b(function|get|if|implements|import|in|instanceof|interface|is|let|module|namespace)\\b"
14 | - statement: "\\b(new|of|package|private|protected|public|require|return|set|static|super|switch)\\b"
15 | - statement: "\\b(this|throw|try|type|typeof|var|void|while|with|yield)\\b"
16 | - constant: "\\b(false|true|null|undefined|NaN)\\b"
17 | - type: "\\b(Array|Boolean|Date|Enumerator|Error|Function|Math)\\b"
18 | - type: "\\b(Number|Object|RegExp|String|Symbol)\\b"
19 | - type: "\\b(any|boolean|never|number|string|symbol)\\b"
20 | - statement: "[-+/*=<>!~%?:&|]"
21 | - constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*"
22 | - constant: "\\\\[0-7][0-7]?[0-7]?|\\\\x[0-9a-fA-F]+|\\\\[bfnrt'\"\\?\\\\]"
23 | - comment:
24 | start: "//"
25 | end: "$"
26 | rules: []
27 | - comment:
28 | start: "/\\*"
29 | end: "\\*/"
30 | rules:
31 | - todo: "TODO:?"
32 | - constant.string:
33 | start: "\""
34 | end: "\""
35 | skip: "\\\\."
36 | rules:
37 | - constant.specialChar: "\\\\."
38 | - constant.string:
39 | start: "'"
40 | end: "'"
41 | skip: "\\\\."
42 | rules:
43 | - constant.specialChar: "\\\\."
44 |
45 |
--------------------------------------------------------------------------------
/runtime/files/syntax/perl.yaml:
--------------------------------------------------------------------------------
1 | filetype: perl
2 |
3 | detect:
4 | filename: "\\.p[lm]$"
5 | header: "^#!.*/(env +)?perl( |$)"
6 |
7 | rules:
8 | - 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"
9 | - 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"
10 |
11 | - special: "\\-\\>"
12 | - symbol: "(,|\\.)"
13 |
14 | - identifier:
15 | start: "[\\$@%]"
16 | end: "\\W"
17 | rules: []
18 |
19 | - constant.string: "\"\\(.*\\)\"|qq?\\|.*\\||qq?\\{.*\\}|qq?\\/.*\\/"
20 | - default: "[sm]/.*/"
21 | - preproc:
22 | start: "(^use| = new)"
23 | end: ";"
24 | rules: []
25 |
26 | - comment:
27 | start: "#"
28 | end: "$"
29 | rules: []
30 |
31 | - comment:
32 | start: "^="
33 | end: "^=cut"
34 | rules: []
35 |
36 | - identifier.macro:
37 | start: "<< 'STOP'"
38 | end: "STOP"
39 | rules: []
40 |
--------------------------------------------------------------------------------
/runtime/files/syntax/fsharp.yaml:
--------------------------------------------------------------------------------
1 | filetype: fsharp
2 |
3 | detect:
4 | filename: "\\.fs?$"
5 |
6 | rules:
7 | - identifier: "\\b[A-Z][0-9a-z_]{2,}\\b"
8 | #declarations
9 | - statement: "\\b(let|val|method|in|and|rec|private|virtual|constraint)\\b"
10 | #structure items
11 | - type: "\\b(type|open|class|module|exception|external)\\b"
12 | #patterns
13 | - statement: "\\b(fun|function|functor|match|try|with)\\b"
14 | #patterns-modifiers
15 | - statement: "\\b(as|when|of)\\b"
16 | #conditions
17 | - statement: "\\b(if|then|else)\\b"
18 | #blocs
19 | - type: "\\b(begin|end|object|struct|sig|for|while|do|done|to|downto)\\b"
20 | #constantes
21 | - constant.bool: "\\b(true|false)\\b"
22 | #modules/classes
23 | - special: "\\b(include|inherit|initializer)\\b"
24 | #expr modifiers
25 | - special: "\\b(new|ref|mutable|lazy|assert|raise)\\b"
26 | #keywords which don't exist in ocaml
27 | - type: "\\b(base|delegate|downcast|extern|finally|fixed|global|inline|interface|internal|let!|member|namespace|null|override|private|public)\\b"
28 | - type: "\\b(return|return!|select|static|upcast|use|use!|void|yield|yield!)\\b"
29 | - constant.string:
30 | start: "'"
31 | end: "'"
32 | skip: "\\\\."
33 | rules:
34 | - constant.specialChar: "%."
35 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
36 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
37 | - constant.string:
38 | start: "\""
39 | end: "\""
40 | skip: "\\\\."
41 | rules:
42 | - constant.specialChar: "%."
43 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
44 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
45 | - comment:
46 | start: "\\(\\*"
47 | end: "\\*\\)"
48 | rules: []
49 |
--------------------------------------------------------------------------------
/runtime/files/syntax/rpmspec.yaml:
--------------------------------------------------------------------------------
1 | filetype: rpmspec
2 |
3 | detect:
4 | filename: "\\.spec$|\\.rpmspec$"
5 |
6 | rules:
7 | - preproc: "\\b(Icon|ExclusiveOs|ExcludeOs):"
8 | - preproc: "\\b(BuildArch|BuildArchitectures|ExclusiveArch|ExcludeArch):"
9 | - preproc: "\\b(Conflicts|Obsoletes|Provides|Requires|Requires\\(.*\\)|Enhances|Suggests|BuildConflicts|BuildRequires|Recommends|PreReq|Supplements):"
10 | - preproc: "\\b(Epoch|Serial|Nosource|Nopatch):"
11 | - preproc: "\\b(AutoReq|AutoProv|AutoReqProv):"
12 | - preproc: "\\b(Copyright|License|Summary|Summary\\(.*\\)|Distribution|Vendor|Packager|Group|Source[0-9]*|Patch[0-9]*|BuildRoot|Prefix):"
13 | - preproc: "\\b(Name|Version|Release|Url|URL):"
14 | - preproc:
15 | start: "^(Source|Patch)"
16 | end: ":"
17 | rules: []
18 |
19 | - preproc: "(i386|i486|i586|i686|athlon|ia64|alpha|alphaev5|alphaev56|alphapca56|alphaev6|alphaev67|sparc|sparcv9|sparc64armv3l|armv4b|armv4lm|ips|mipsel|ppc|ppc|iseries|ppcpseries|ppc64|m68k|m68kmint|Sgi|rs6000|i370|s390x|s390|noarch)"
20 | - preproc: "(ifarch|ifnarch|ifos|ifnos)"
21 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
22 | - statement: "%(if|else|endif|define|global|undefine)"
23 | - statement: "%_?([A-Z_a-z_0-9_]*)"
24 | - statement:
25 | start: "%\\{"
26 | end: "\\}"
27 | rules: []
28 |
29 | - statement:
30 | start: "%\\{__"
31 | end: "\\}"
32 | rules: []
33 |
34 | - statement: "\\$(RPM_BUILD_ROOT)\\>"
35 | - special: "^%(build$|changelog|check$|clean$|description)"
36 | - special: "^%(files|install$|package|prep$)"
37 | - special: "^%(pre|preun|pretrans|post|postun|posttrans)"
38 | - special: "^%(trigger|triggerin|triggerpostun|triggerun|verifyscript)"
39 | - comment: "(^|[[:space:]])#([^{].*)?$"
40 | - constant: "^\\*.*$"
41 | - indent-char.whitespace: "[[:space:]]+$"
42 | - indent-char: " + +| + +"
43 | - todo: "TODO:?"
44 |
--------------------------------------------------------------------------------
/runtime/files/syntax/go.yaml:
--------------------------------------------------------------------------------
1 | filetype: go
2 |
3 | detect:
4 | filename: "\\.go$"
5 |
6 | rules:
7 | # Conditionals and control flow
8 | - special: "\\b(break|case|continue|default|go|goto|range|return)\\b"
9 | - statement: "\\b(else|for|if|switch)\\b"
10 | - preproc: "\\b(package|import|const|var|type|struct|func|go|defer|iota)\\b"
11 | - symbol.operator: "[-+/*=<>!~%&|^]|:="
12 |
13 | # Types
14 | - symbol: "(,|\\.)"
15 | - type: "\\b(u?int(8|16|32|64)?|float(32|64)|complex(64|128))\\b"
16 | - type: "\\b(uintptr|byte|rune|string|interface|bool|map|chan|error)\\b"
17 | - type.keyword: "\\b(struct)\\b"
18 | - constant.bool: "\\b(true|false|nil)\\b"
19 |
20 | # Brackets
21 | - symbol.brackets: "(\\{|\\})"
22 | - symbol.brackets: "(\\(|\\))"
23 | - symbol.brackets: "(\\[|\\])"
24 |
25 | # Numbers and strings
26 | - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
27 |
28 | - constant.string:
29 | start: "\""
30 | end: "\""
31 | skip: "\\\\."
32 | rules:
33 | - constant.specialChar: "%."
34 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
35 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
36 |
37 | - constant.string:
38 | start: "'"
39 | end: "'"
40 | skip: "\\\\."
41 | rules:
42 | - error: "..+"
43 | - constant.specialChar: "%."
44 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
45 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
46 |
47 | - constant.string:
48 | start: "`"
49 | end: "`"
50 | rules: []
51 |
52 | - comment:
53 | start: "//"
54 | end: "$"
55 | rules:
56 | - todo: "(TODO|XXX|FIXME):?"
57 |
58 | - comment:
59 | start: "/\\*"
60 | end: "\\*/"
61 | rules:
62 | - todo: "(TODO|XXX|FIXME):?"
63 |
--------------------------------------------------------------------------------
/runtime/files/syntax/pascal.yaml:
--------------------------------------------------------------------------------
1 | filetype: pascal
2 |
3 | detect:
4 | filename: "\\.pas$"
5 |
6 | rules:
7 | - type: "\\b(?i:(string|ansistring|widestring|shortstring|char|ansichar|widechar|boolean|byte|shortint|word|smallint|longword|cardinal|longint|integer|int64|single|currency|double|extended))\\b"
8 | - statement: "\\b(?i:(and|asm|array|begin|break|case|const|constructor|continue|destructor|div|do|downto|else|end|file|for|function|goto|if|implementation|in|inline|interface|label|mod|not|object|of|on|operator|or|packed|procedure|program|record|repeat|resourcestring|set|shl|shr|then|to|type|unit|until|uses|var|while|with|xor))\\b"
9 | - statement: "\\b(?i:(as|class|dispose|except|exit|exports|finalization|finally|inherited|initialization|is|library|new|on|out|property|raise|self|threadvar|try))\\b"
10 | - statement: "\\b(?i:(absolute|abstract|alias|assembler|cdecl|cppdecl|default|export|external|forward|generic|index|local|name|nostackframe|oldfpccall|override|pascal|private|protected|public|published|read|register|reintroduce|safecall|softfloat|specialize|stdcall|virtual|write))\\b"
11 | - constant: "\\b(?i:(false|true|nil))\\b"
12 | - special:
13 | start: "asm"
14 | end: "end"
15 | rules: []
16 | - constant.number: "\\$[0-9A-Fa-f]+"
17 | - constant.number: "\\b[+-]?[0-9]+([.]?[0-9]+)?(?i:e[+-]?[0-9]+)?"
18 | - constant.string:
19 | start: "#[0-9]{1,}"
20 | end: "$"
21 | rules:
22 | - constant.specialChar: "\\\\."
23 | - constant.string:
24 | start: "'"
25 | end: "'"
26 | skip: "\\\\."
27 | rules:
28 | - constant.specialChar: "\\\\."
29 | - preproc:
30 | start: "{\\$"
31 | end: "}"
32 | rules: []
33 | - comment:
34 | start: "//"
35 | end: "$"
36 | rules: []
37 | - comment:
38 | start: "\\(\\*"
39 | end: "\\*\\)"
40 | rules: []
41 | - comment:
42 | start: "({)(?:[^$])"
43 | end: "}"
44 | rules: []
45 |
46 |
--------------------------------------------------------------------------------
/runtime/files/syntax/crystal.yaml:
--------------------------------------------------------------------------------
1 | filetype: crystal
2 |
3 | detect:
4 | filename: "\\.cr$"
5 |
6 | rules:
7 | # Asciibetical list of reserved words
8 | - statement: "\\b(BEGIN|END|abstract|alias|and|begin|break|case|class|def|defined\\?|do|else|elsif|end|ensure|enum|false|for|fun|if|in|include|lib|loop|macro|module|next|nil|not|of|or|pointerof|private|protected|raise|redo|require|rescue|retry|return|self|sizeof|spawn|struct|super|then|true|type|undef|union|uninitialized|unless|until|when|while|yield)\\b"
9 | # Constants
10 | - constant: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*"
11 | - constant.number: "\\b[0-9]+\\b"
12 | # Crystal "symbols"
13 | - constant: "([ ]|^):[0-9A-Z_]+\\b"
14 | # Some unique things we want to stand out
15 | - constant: "\\b(__FILE__|__LINE__)\\b"
16 | # Regular expressions
17 | - constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*"
18 |
19 | # Shell command expansion is in `backticks` or like %x{this}. These are
20 | # "double-quotish" (to use a perlism).
21 | - constant.string: "`[^`]*`|%x\\{[^}]*\\}"
22 |
23 | - constant.string:
24 | start: "`"
25 | end: "`"
26 | rules: []
27 |
28 | - constant.string:
29 | start: "%x\\{"
30 | end: "\\}"
31 | rules: []
32 |
33 | - constant.string:
34 | start: "\""
35 | end: "\""
36 | skip: "\\\\."
37 | rules:
38 | - constant.specialChar: "\\\\."
39 | - special: "#\\{[^}]*\\}"
40 |
41 | - constant.string:
42 | start: "'"
43 | end: "'"
44 | skip: "\\\\."
45 | rules:
46 | - constant.specialChar: "\\\\."
47 |
48 | - comment:
49 | start: "#"
50 | end: "$"
51 | rules:
52 | - todo: "(TODO|XXX|FIXME):?"
53 |
54 | - comment.bright:
55 | start: "##"
56 | end: "$"
57 | rules:
58 | - todo: "(TODO|XXX|FIXME):?"
59 |
60 | - constant:
61 | start: "<<-?'?EOT'?"
62 | end: "^EOT"
63 | rules: []
64 |
65 |
--------------------------------------------------------------------------------
/runtime/files/syntax/cpp.yaml:
--------------------------------------------------------------------------------
1 | filetype: c++
2 |
3 | detect:
4 | filename: "(\\.c(c|pp|xx)$|\\.h(h|pp|xx)$|\\.ii?$|\\.(def)$)"
5 |
6 | rules:
7 |
8 | - identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
9 | - type: "\\b(auto|float|double|bool|char|int|short|long|sizeof|enum|void|static|const|constexpr|struct|union|typedef|extern|(un)?signed|inline)\\b"
10 | - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
11 | - statement: "\\b(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\\b"
12 | - statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
13 | - statement: "\\b(try|throw|catch|operator|new|delete)\\b"
14 | - statement: "\\b(goto|continue|break|return)\\b"
15 | - preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
16 | - constant: "('([^'\\\\]|(\\\\[\"'abfnrtv\\\\]))'|'\\\\(([0-3]?[0-7]{1,2}))'|'\\\\x[0-9A-Fa-f]{1,2}')"
17 |
18 | # GCC builtins
19 | - statement: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)"
20 |
21 | # Operator Color
22 | - symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)"
23 | # Parenthetical Color
24 | - symbol.brackets: "[(){}]|\\[|\\]"
25 |
26 | - constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)"
27 | - constant.bool: "(\\b(true|false)\\b|NULL)"
28 |
29 | - constant.string:
30 | start: "\""
31 | end: "\""
32 | skip: "\\\\."
33 | rules:
34 | - constant.specialChar: "\\\\."
35 |
36 | - constant.string:
37 | start: "'"
38 | end: "'"
39 | skip: "\\\\."
40 | rules:
41 | - preproc: "..+"
42 | - constant.specialChar: "\\\\."
43 |
44 | - comment:
45 | start: "//"
46 | end: "$"
47 | rules:
48 | - todo: "(TODO|XXX|FIXME):?"
49 |
50 | - comment:
51 | start: "/\\*"
52 | end: "\\*/"
53 | rules:
54 | - todo: "(TODO|XXX|FIXME):?"
55 |
56 |
--------------------------------------------------------------------------------
/runtime/files/syntax/kotlin.yaml:
--------------------------------------------------------------------------------
1 | filetype: kotlin
2 |
3 | detect:
4 | filename: "\\.kt$"
5 |
6 | rules:
7 |
8 | # Operators
9 | - symbol.operator: ([.:;,+*|=!?\\%]|<|>|/|-|&)
10 |
11 | # Statements Keywords
12 | - statement: \b(as|by|class|constructor|companion|fun|import|in|infix|interface|inline|is|out|operator|package|return|suspend|super|this|when|val|var)\b
13 | - statement.properties: \b(get|set)\b
14 | - statement.control: \b(break|continue|else|do|if|try|catch|finally|for|while)\b
15 | - statement.class: \b(abstract|annotation|data|enum|final|open|sealed)\b
16 | - statement.member: \b(override|lateinit|init)\b
17 | - statement.access: \b(internal|private|protected|public)\b
18 | - statement.parameter: \b(crossinline|noinline|reified|vararg)\b
19 |
20 | # Expression and types
21 | - type: \b(dynamic|object|throw|typealias|typeof)\b
22 |
23 | # Meta
24 | - statement.meta: \@(\bfile|delegate|field|get|property|receiver|set|setparam|param|)\b
25 |
26 | # Constant
27 | - constant: \b(true|false|null)
28 | - constant.number: ([0-9]+)
29 |
30 | # Storage Types
31 | - type.storage: \b(Byte|Char|Double|Float|Int|Long|Short|Boolean|Unit|Nothing)\b
32 |
33 | # Collections
34 | - type.collections: \b(Array)\b
35 |
36 | # String
37 | - constant.string:
38 | start: \"
39 | end: \"
40 | skip: \\.
41 | rules:
42 | - constant.specialChar: (\\0|\\\\|\\t|\\n|\\r|\\"|\\')
43 | - constant.unicode: \\u\{[[:xdigit:]]+}
44 |
45 | # Shebang Line
46 | - comment.shebang: ^(#!).*
47 |
48 | # Line Comment
49 | - comment.line: "//.*"
50 |
51 | # Block Comment
52 | - comment.block:
53 | start: "/\\*"
54 | end: "\\*/"
55 | rules:
56 | - todo: "(TODO|XXX|FIXME):?"
57 |
58 | # Doc Block Comment
59 | - comment.block:
60 | start: "/\\*\\*"
61 | end: "\\*/"
62 | rules:
63 | - todo: "(TODO|XXX|FIXME):?"
64 |
65 | # Todo
66 | - todo: "(TODO|XXX|FIXME):?"
--------------------------------------------------------------------------------
/runtime/files/syntax/sh.yaml:
--------------------------------------------------------------------------------
1 | filetype: shell
2 |
3 | detect:
4 | filename: "(\\.sh$|\\.bash|\\.ash|\\.bashrc|bashrc|\\.bash_aliases|bash_aliases|\\.bash_functions|bash_functions|\\.bash_profile|bash_profile|\\.profile|profile|Pkgfile|pkgmk.conf|profile|rc.conf|PKGBUILD|.ebuild\\$|APKBUILD)"
5 | header: "^#!.*/(env +)?(ba)?(a)?sh( |$)"
6 |
7 | rules:
8 | # Numbers
9 | - constant.number: "\\b[0-9]+\\b"
10 | # Conditionals and control flow
11 | - statement: "\\b(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\\b"
12 | - special: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)"
13 | # Shell commands
14 | - type: "\\b(cd|echo|export|let|set|umask|unset)\\b"
15 | # Common linux commands
16 | - type: "\\b((g|ig)?awk|bash|dash|find|\\w{0,4}grep|kill|killall|\\w{0,4}less|make|pkill|sed|sh|tar)\\b"
17 | # Coreutils commands
18 | - type: "\\b(base64|basename|cat|chcon|chgrp|chmod|chown|chroot|cksum|comm|cp|csplit|cut|date|dd|df|dir|dircolors|dirname|du|env|expand|expr|factor|false|fmt|fold|head|hostid|id|install|join|link|ln|logname|ls|md5sum|mkdir|mkfifo|mknod|mktemp|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|pr|printenv|printf|ptx|pwd|readlink|realpath|rm|rmdir|runcon|seq|(sha1|sha224|sha256|sha384|sha512)sum|shred|shuf|sleep|sort|split|stat|stdbuf|stty|sum|sync|tac|tail|tee|test|time|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|users|vdir|wc|who|whoami|yes)\\b"
19 | # Conditional flags
20 | - statement: "--[a-z-]+"
21 | - statement: "\\ -[a-z]+"
22 |
23 | - identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?"
24 | - identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?"
25 |
26 | - constant.string:
27 | start: "\""
28 | end: "\""
29 | skip: "\\\\."
30 | rules:
31 | - constant.specialChar: "\\\\."
32 |
33 | - constant.string:
34 | start: "'"
35 | end: "'"
36 | rules: []
37 |
38 | - comment:
39 | start: "(^|\\s)#"
40 | end: "$"
41 | rules:
42 | - todo: "(TODO|XXX|FIXME):?"
43 |
44 |
--------------------------------------------------------------------------------
/runtime/files/syntax/csharp.yaml:
--------------------------------------------------------------------------------
1 | filetype: csharp
2 |
3 | detect:
4 | filename: "\\.cs$"
5 |
6 | rules:
7 | # Class
8 | - identifier.class: "class +[A-Za-z0-9]+ *((:) +[A-Za-z0-9.]+)?"
9 |
10 | # Annotation
11 | - identifier.var: "@[A-Za-z]+"
12 |
13 | - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"
14 | - type: "\\b(bool|byte|sbyte|char|decimal|double|float|IntPtr|int|uint|long|ulong|object|short|ushort|string|base|this|var|void)\\b"
15 | - statement: "\\b(alias|as|case|catch|checked|default|do|dynamic|else|finally|fixed|for|foreach|goto|if|is|lock|new|null|return|switch|throw|try|unchecked|while)\\b"
16 | - statement: "\\b(abstract|async|class|const|delegate|enum|event|explicit|extern|get|implicit|in|internal|interface|namespace|operator|out|override|params|partial|private|protected|public|readonly|ref|sealed|set|sizeof|stackalloc|static|struct|typeof|unsafe|using|value|virtual|volatile|yield)\\b"
17 | # LINQ-only keywords (ones that cannot be used outside of a LINQ query - lots others can)
18 | - statement: "\\b(from|where|select|group|info|orderby|join|let|in|on|equals|by|ascending|descending)\\b"
19 | - special: "\\b(break|continue)\\b"
20 | - constant.bool: "\\b(true|false)\\b"
21 | - symbol.operator: "[\\-+/*=<>?:!~%&|]"
22 | - constant.number: "\\b([0-9._]+|0x[A-Fa-f0-9_]+|0b[0-1_]+)[FL]?\\b"
23 |
24 | - constant.string:
25 | start: "\""
26 | end: "\""
27 | skip: "\\\\."
28 | rules:
29 | - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
30 | - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
31 |
32 | - constant.string:
33 | start: "'"
34 | end: "'"
35 | skip: "\\\\."
36 | rules:
37 | - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
38 | - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
39 |
40 | - comment:
41 | start: "//"
42 | end: "$"
43 | rules:
44 | - todo: "(TODO|XXX|FIXME):?"
45 |
46 | - comment:
47 | start: "/\\*"
48 | end: "\\*/"
49 | rules:
50 | - todo: "(TODO|XXX|FIXME):?"
51 |
52 |
--------------------------------------------------------------------------------
/runtime/files/syntax/fish.yaml:
--------------------------------------------------------------------------------
1 | filetype: fish
2 |
3 | detect:
4 | filename: "\\.fish$"
5 | header: "^#!.*/(env +)?fish( |$)"
6 |
7 | rules:
8 | # Numbers
9 | - constant: "\\b[0-9]+\\b"
10 |
11 | # Conditionals and control flow
12 | - statement: "\\b(and|begin|break|case|continue|else|end|for|function|if|in|not|or|return|select|shift|switch|while)\\b"
13 | - special: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|^|!|=|&|\\|)"
14 |
15 | # Fish commands
16 | - type: "\\b(bg|bind|block|breakpoint|builtin|cd|count|command|commandline|complete|dirh|dirs|echo|emit|eval|exec|exit|fg|fish|fish_config|fish_ident|fish_pager|fish_prompt|fish_right_prompt|fish_update_completions|fishd|funced|funcsave|functions|help|history|jobs|math|mimedb|nextd|open|popd|prevd|psub|pushd|pwd|random|read|set|set_color|source|status|string|trap|type|ulimit|umask|vared)\\b"
17 |
18 | # Common linux commands
19 | - type: "\\b((g|ig)?awk|bash|dash|find|\\w{0,4}grep|kill|killall|\\w{0,4}less|make|pkill|sed|sh|tar)\\b"
20 |
21 | # Coreutils commands
22 | - type: "\\b(base64|basename|cat|chcon|chgrp|chmod|chown|chroot|cksum|comm|cp|csplit|cut|date|dd|df|dir|dircolors|dirname|du|env|expand|expr|factor|false|fmt|fold|head|hostid|id|install|join|link|ln|logname|ls|md5sum|mkdir|mkfifo|mknod|mktemp|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|pr|printenv|printf|ptx|pwd|readlink|realpath|rm|rmdir|runcon|seq|(sha1|sha224|sha256|sha384|sha512)sum|shred|shuf|sleep|sort|split|stat|stdbuf|stty|sum|sync|tac|tail|tee|test|time|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|users|vdir|wc|who|whoami|yes)\\b"
23 |
24 | # Conditional flags
25 | - statement: "--[a-z-]+"
26 | - statement: "\\ -[a-z]+"
27 |
28 | - identifier: "(?i)\\$\\{?[0-9A-Z_!@#$*?-]+\\}?"
29 |
30 | - constant.string:
31 | start: "\""
32 | end: "\""
33 | skip: "\\\\."
34 | rules:
35 | - constant.specialChar: "\\\\."
36 |
37 | - constant.string:
38 | start: "'"
39 | end: "'"
40 | skip: "\\\\."
41 | rules: []
42 |
43 | - comment:
44 | start: "#"
45 | end: "$"
46 | rules:
47 | - todo: "(TODO|XXX|FIXME):?"
48 |
49 |
--------------------------------------------------------------------------------
/runtime/files/syntax/tcl.yaml:
--------------------------------------------------------------------------------
1 | filetype: tcl
2 |
3 | detect:
4 | filename: "\\.tcl$"
5 | header: "^#!.*/(env +)?tclsh( |$)"
6 |
7 | rules:
8 | - statement: "\\b(after|append|array|auto_execok|auto_import|auto_load|auto_load_index|auto_qualify|binary|break|case|catch|cd|clock|close|concat|continue|else|elseif|encoding|eof|error|eval|exec|exit|expr|fblocked|fconfigure|fcopy|file|fileevent|flush|for|foreach|format|gets|glob|global|history|if|incr|info|interp|join|lappend|lindex|linsert|list|llength|load|lrange|lreplace|lsearch|lset|lsort|namespace|open|package|pid|puts|pwd|read|regexp|regsub|rename|return|scan|seek|set|socket|source|split|string|subst|switch|tclLog|tell|time|trace|unknown|unset|update|uplevel|upvar|variable|vwait|while)\\b"
9 | - statement: "\\b(array anymore|array donesearch|array exists|array get|array names|array nextelement|array set|array size|array startsearch|array statistics|array unset)\\b"
10 | - statement: "\\b(string bytelength|string compare|string equal|string first|string index|string is|string last|string length|string map|string match|string range|string repeat|string replace|string to|string tolower|string totitle|string toupper|string trim|string trimleft|string trimright|string will|string wordend|string wordstart)\\b"
11 | - statement: "\\b(alarm|auto_load_pkg|bsearch|catclose|catgets|catopen|ccollate|cconcat|cequal|chgrp|chmod|chown|chroot|cindex|clength|cmdtrace|commandloop|crange|csubstr|ctoken|ctype|dup|echo|execl|fcntl|flock|fork|fstat|ftruncate|funlock|host_info|id|infox|keyldel|keylget|keylkeys|keylset|kill|lassign|lcontain|lempty|lgets|link|lmatch|loadlibindex|loop|lvarcat|lvarpop|lvarpush|max|min|nice|pipe|profile|random|readdir|replicate|scancontext|scanfile|scanmatch|select|server_accept|server_create|signal|sleep|sync|system|tclx_findinit|tclx_fork|tclx_load_tndxs|tclx_sleep|tclx_system|tclx_wait|times|translit|try_eval|umask|wait)\\b"
12 | - identifier.class: "proc[[:space:]]|(\\{|\\})"
13 | - symbol.operator: "(\\(|\\)|\\;|`|\\\\|\\$|<|>|!|=|&|\\|)"
14 | - constant.number: "\\b[0-9]+(\\.[0-9]+)?\\b"
15 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
16 | - identifier.var: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?"
17 | - comment: "(^|;)[[:space:]]*#.*"
18 | - indent-char.whitespace: "[[:space:]]+$"
19 |
--------------------------------------------------------------------------------
/runtime/files/syntax/javascript.yaml:
--------------------------------------------------------------------------------
1 | filetype: javascript
2 |
3 | detect:
4 | filename: "(\\.js$|\\.es[5678]?$|\\.mjs$)"
5 | header: "^#!.*/(env +)?node( |$)"
6 |
7 | rules:
8 | - constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b"
9 | - constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
10 | - constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
11 | - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
12 | - symbol.brackets: "(\\{|\\})"
13 | - symbol.brackets: "(\\(|\\))"
14 | - symbol.brackets: "(\\[|\\])"
15 | - symbol.brackets: "(\\{|\\})"
16 | - symbol.brackets: "(\\(|\\))"
17 | - symbol.brackets: "(\\[|\\])"
18 | - symbol.operator: "[-+/*=<>!~%?:&|]"
19 | - statement: "\\b(async|await|break|case|catch|const|continue|debugger|default|delete|do|else|export|finally)\\b"
20 | - statement: "\\b(for|function|class|extends|get|if|import|from|in|of|instanceof|let|new|return|set)\\b"
21 | - statement: "\\b(super|switch|this|throw|try|typeof|var|void|while|with|yield)\\b"
22 | # reserved but unassigned
23 | - error: "\\b(enum|implements|interface|package|private|protected|public|TODO)"
24 | - constant: "\\b(null|undefined|NaN)\\b"
25 | - constant: "\\b(true|false)\\b"
26 | - type: "\\b(Array|Boolean|Date|Enumerator|Error|Function|Math)\\b"
27 | - type: "\\b(Number|Object|RegExp|String)\\b"
28 | # - constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*"
29 | - constant: "\\\\[0-7][0-7]?[0-7]?|\\\\x[0-9a-fA-F]+|\\\\[bfnrt'\"\\?\\\\]"
30 | - comment: "^#!.*/(env +)?node( |$)"
31 |
32 |
33 | - constant.string:
34 | start: "\""
35 | end: "\""
36 | skip: "\\\\."
37 | rules:
38 | - constant.specialChar: "\\\\."
39 |
40 | - constant.string:
41 | start: "'"
42 | end: "'"
43 | skip: "\\\\."
44 | rules:
45 | - constant.specialChar: "\\\\."
46 |
47 | - constant.string:
48 | start: "`"
49 | end: "`"
50 | rules:
51 | - constant.specialChar: "\\\\."
52 |
53 | - comment:
54 | start: "//"
55 | end: "$"
56 | rules: []
57 |
58 | - comment:
59 | start: "/\\*"
60 | end: "\\*/"
61 | rules: []
62 |
63 |
--------------------------------------------------------------------------------
/runtime/files/syntax/zsh.yaml:
--------------------------------------------------------------------------------
1 | filetype: zsh
2 |
3 | detect:
4 | filename: "(\\.zsh$|\\.?(zshenv|zprofile|zshrc|zlogin|zlogout)$)"
5 | header: "^#!.*/(env +)?zsh( |$)"
6 |
7 | rules:
8 | ## Numbers
9 | - constant.number: "\\b[0-9]+\\b"
10 |
11 | ## Conditionals and control flow
12 | - statement: "\\b(always|break|bye|case|continue|disown|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\\b"
13 |
14 | - statement: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)"
15 | ## Conditional flags
16 | - special: "-[Ldefgruwx]\\b"
17 | - special: "-(eq|ne|gt|lt|ge|le|s|n|z)\\b"
18 |
19 | ## Bash-inherited
20 | - statement: "\\b((un)?alias|bindkey|builtin|cd|declare|eval|exec|export|jobs|let|popd|pushd|set|source|typeset|umask|unset)\\b"
21 | ## ZSH-specific
22 | - type: "\\b(add-zsh-hook|autoload|chdir|compinit|dirs|(dis|en)able|echotc|emulate|print|prompt(init)?|(un)?setopt|zle|zmodload|zstyle|whence)\\b"
23 |
24 | ## Common linux commands
25 | - statement: "\\b((g|ig)?awk|find|\\w{0,4}grep|kill|killall|\\w{0,4}less|make|pkill|sed|tar)\\b"
26 |
27 | ## Coreutils commands
28 | - statement: "\\b(base64|basename|cat|chcon|chgrp|chmod|chown|chroot|cksum|comm|cp|csplit|cut|date|dd|df|dir|dircolors|dirname|du|echo|env|expand|expr|factor|false|fmt|fold|head|hostid|id|install|join|link|ln|logname|ls|md5sum|mkdir|mkfifo|mknod|mktemp|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|pr|printenv|printf|ptx|pwd|readlink|realpath|rm|rmdir|runcon|seq|(sha1|sha224|sha256|sha384|sha512)sum|shred|shuf|sleep|sort|split|stat|stdbuf|stty|sum|sync|tac|tail|tee|test|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|users|vdir|wc|who|whoami|yes)\\b"
29 |
30 | ## Function definition
31 | - identifier: "^\\s+(function\\s+)[0-9A-Z_]+\\s+\\(\\)" # (i)
32 |
33 | ## Variables
34 | - identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?" #(i)
35 |
36 | - constant.string:
37 | start: "\""
38 | end: "\""
39 | skip: "\\\\."
40 | rules:
41 | - constant.specialChar: "\\\\."
42 |
43 | - constant.string:
44 | start: "'"
45 | end: "'"
46 | rules: []
47 |
48 | - comment:
49 | start: "#"
50 | end: "$"
51 | rules: []
52 |
53 |
--------------------------------------------------------------------------------
/runtime/files/syntax/sql.yaml:
--------------------------------------------------------------------------------
1 | filetype: sql
2 |
3 | detect:
4 | filename: "\\.sql$|sqliterc$"
5 |
6 | rules:
7 | - statement: "(?i)\\b(ALL|ASC|AS|ALTER|AND|ADD|AUTO_INCREMENT)\\b"
8 | - statement: "(?i)\\b(BETWEEN|BINARY|BOTH|BY|BOOLEAN)\\b"
9 | - statement: "(?i)\\b(CHANGE|CHECK|COLUMNS|COLUMN|CROSS|CREATE)\\b"
10 | - statement: "(?i)\\b(DATABASES|DATABASE|DATA|DELAYED|DESCRIBE|DESC|DISTINCT|DELETE|DROP|DEFAULT)\\b"
11 | - statement: "(?i)\\b(ENCLOSED|ESCAPED|EXISTS|EXPLAIN)\\b"
12 | - statement: "(?i)\\b(FIELDS|FIELD|FLUSH|FOR|FOREIGN|FUNCTION|FROM)\\b"
13 | - statement: "(?i)\\b(GROUP|GRANT|HAVING)\\b"
14 | - statement: "(?i)\\b(IGNORE|INDEX|INFILE|INSERT|INNER|INTO|IDENTIFIED|IN|IS|IF)\\b"
15 | - statement: "(?i)\\b(JOIN|KEYS|KILL|KEY)\\b"
16 | - statement: "(?i)\\b(LEADING|LIKE|LIMIT|LINES|LOAD|LOCAL|LOCK|LOW_PRIORITY|LEFT|LANGUAGE)\\b"
17 | - statement: "(?i)\\b(MODIFY|NATURAL|NOT|NULL|NEXTVAL)\\b"
18 | - statement: "(?i)\\b(OPTIMIZE|OPTION|OPTIONALLY|ORDER|OUTFILE|OR|OUTER|ON)\\b"
19 | - statement: "(?i)\\b(PROCEDURE|PROCEDURAL|PRIMARY)\\b"
20 | - statement: "(?i)\\b(READ|REFERENCES|REGEXP|RENAME|REPLACE|RETURN|REVOKE|RLIKE|RIGHT)\\b"
21 | - statement: "(?i)\\b(SHOW|SONAME|STATUS|STRAIGHT_JOIN|SELECT|SETVAL|SET)\\b"
22 | - statement: "(?i)\\b(TABLES|TERMINATED|TO|TRAILING|TRUNCATE|TABLE|TEMPORARY|TRIGGER|TRUSTED)\\b"
23 | - statement: "(?i)\\b(UNIQUE|UNLOCK|USE|USING|UPDATE|VALUES|VARIABLES|VIEW)\\b"
24 | - statement: "(?i)\\b(WITH|WRITE|WHERE|ZEROFILL|TYPE|XOR)\\b"
25 | - type: "(?i)\\b(VARCHAR|TINYINT|TEXT|DATE|SMALLINT|MEDIUMINT|INT|INTEGER|BIGINT|FLOAT|DOUBLE|DECIMAL|DATETIME|TIMESTAMP|TIME|YEAR|UNSIGNED|CHAR|TINYBLOB|TINYTEXT|BLOB|MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|ENUM|BOOL|BINARY|VARBINARY)\\b"
26 | - preproc: "(?i)\\.\\b(databases|dump|echo|exit|explain|header(s)?|help)\\b"
27 | - preproc: "(?i)\\.\\b(import|indices|mode|nullvalue|output|prompt|quit|read)\\b"
28 | - preproc: "(?i)\\.\\b(schema|separator|show|tables|timeout|width)\\b"
29 | - constant.bool: "\\b(ON|OFF)\\b"
30 | - constant.number: "\\b([0-9]+)\\b"
31 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
32 | - constant.string: "`(\\\\.|[^\\\\`])*`"
33 | - comment: "\\-\\-.*$"
34 | - indent-char.whitespace: "[[:space:]]+$"
35 | - indent-char: " + +| + +"
36 |
--------------------------------------------------------------------------------
/runtime/files/syntax/gentoo-ebuild.yaml:
--------------------------------------------------------------------------------
1 | filetype: ebuild
2 |
3 | detect:
4 | filename: "\\.e(build|class)$"
5 |
6 | rules:
7 | # All the standard portage functions
8 | - identifier: "^src_(unpack|compile|install|test)|^pkg_(config|nofetch|setup|(pre|post)(inst|rm))"
9 | # Highlight bash related syntax
10 | - statement: "\\b(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while|continue|break)\\b"
11 | - statement: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)"
12 | - statement: "-(e|d|f|r|g|u|w|x|L)\\b"
13 | - statement: "-(eq|ne|gt|lt|ge|le|s|n|z)\\b"
14 | # Highlight variables ... official portage ones in red, all others in bright red
15 | - preproc: "\\$\\{?[a-zA-Z_0-9]+\\}?"
16 | - special: "\\b(ARCH|HOMEPAGE|DESCRIPTION|IUSE|SRC_URI|LICENSE|SLOT|KEYWORDS|FILESDIR|WORKDIR|(P|R)?DEPEND|PROVIDE|DISTDIR|RESTRICT|USERLAND)\\b"
17 | - special: "\\b(S|D|T|PV|PF|P|PN|A)\\b|\\bC(XX)?FLAGS\\b|\\bLDFLAGS\\b|\\bC(HOST|TARGET|BUILD)\\b"
18 | # Highlight portage commands
19 | - identifier: "\\buse(_(with|enable))?\\b [!a-zA-Z0-9_+ -]*|inherit.*"
20 | - statement: "\\be(begin|end|conf|install|make|warn|infon?|error|log|patch|new(group|user))\\b"
21 | - statement: "\\bdie\\b|\\buse(_(with|enable))?\\b|\\binherit\\b|\\bhas\\b|\\b(has|best)_version\\b|\\bunpack\\b"
22 | - statement: "\\b(do|new)(ins|s?bin|doc|lib(\\.so|\\.a)|man|info|exe|initd|confd|envd|pam|menu|icon)\\b"
23 | - statement: "\\bdo(python|sed|dir|hard|sym|html|jar|mo)\\b|\\bkeepdir\\b"
24 | - statement: "prepall(docs|info|man|strip)|prep(info|lib|lib\\.(so|a)|man|strip)"
25 | - statement: "\\b(doc|ins|exe)into\\b|\\bf(owners|perms)\\b|\\b(exe|ins|dir)opts\\b"
26 | # Highlight common commands used in ebuilds
27 | - type: "\\bmake\\b|\\b(cat|cd|chmod|chown|cp|echo|env|export|grep|let|ln|mkdir|mv|rm|sed|set|tar|touch|unset)\\b"
28 |
29 | - constant.string:
30 | start: "\""
31 | end: "\""
32 | skip: "\\\\."
33 | rules:
34 | - constant.specialChar: "\\\\."
35 |
36 | - constant.string:
37 | start: "'"
38 | end: "'"
39 | skip: "\\\\."
40 | rules:
41 | - constant.specialChar: "\\\\."
42 |
43 | - comment:
44 | start: "#"
45 | end: "$"
46 | rules:
47 | - todo: "(TODO|XXX|FIXME):?"
48 |
49 |
--------------------------------------------------------------------------------
/runtime/files/syntax/nim.yaml:
--------------------------------------------------------------------------------
1 | filetype: nim
2 |
3 | detect:
4 | filename: "\\.nim$|\\.nims$|nim.cfg"
5 |
6 | rules:
7 | - preproc: "[\\{\\|]\\b(atom|lit|sym|ident|call|lvalue|sideeffect|nosideeffect|param|genericparam|module|type|let|var|const|result|proc|method|iterator|converter|macro|template|field|enumfield|forvar|label|nk[a-zA-Z]+|alias|noalias)\\b[\\}\\|]"
8 | - statement: "\\b(addr|and|as|asm|atomic|bind|block|break|case|cast|concept|const|continue|converter|defer|discard|distinct|div|do|elif|else|end|enum|except|export|finally|for|from|func|generic|if|import|in|include|interface|is|isnot|iterator|let|macro|method|mixin|mod|nil|not|notin|object|of|or|out|proc|ptr|raise|ref|return|shl|shr|static|template|try|tuple|type|using|var|when|while|with|without|xor|yield)\\b"
9 | - statement: "\\b(deprecated|noSideEffect|constructor|destructor|override|procvar|compileTime|noReturn|acyclic|final|shallow|pure|asmNoStackFrame|error|fatal|warning|hint|line|linearScanEnd|computedGoto|unroll|immediate|checks|boundsChecks|overflowChecks|nilChecks|assertations|warnings|hints|optimization|patterns|callconv|push|pop|global|pragma|experimental|bitsize|volatile|noDecl|header|incompleteStruct|compile|link|passC|passL|emit|importc|importcpp|importobjc|codegenDecl|injectStmt|intdefine|strdefine|varargs|exportc|extern|bycopy|byref|union|packed|unchecked|dynlib|cdecl|thread|gcsafe|threadvar|guard|locks|compileTime)\\b"
10 | - symbol.operator: "[=\\+\\-\\*/<>@\\$~&%\\|!\\?\\^\\.:\\\\]+"
11 | - special: "\\{\\.|\\.\\}|\\[\\.|\\.\\]|\\(\\.|\\.\\)|;|,|`"
12 | - statement: "\\.\\."
13 | - type: "\\b(int|cint|int8|int16|int32|int64|uint|uint8|uint16|uint32|uint64|float|float32|float64|bool|char|enum|string|cstring|array|openarray|seq|varargs|tuple|object|set|void|auto|cshort|range|nil|T|untyped|typedesc)\\b"
14 | - type: "'[iI](8|16|32|64)?\\b|'[uU](8|16|32|64)?\\b|'[fF](32|64|128)?\\b|'[dD]\\b"
15 | - constant.number: "\\b[0-9]+\\b"
16 | - constant.number: "\\b0[xX][0-9A-Fa-f][0-9_A-Fa-f]+\\b"
17 | - constant.number: "\\b0[ocC][0-7][0-7_]+\\b"
18 | - constant.number: "\\b0[bB][01][01_]+\\b"
19 | - constant.number: "\\b[0-9_]((\\.?)[0-9_]+)?[eE][+\\-][0-9][0-9_]+\\b"
20 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
21 | - comment: "[[:space:]]*#.*$"
22 | - comment:
23 | start: "\\#\\["
24 | end: "\\]\\#"
25 | rules: []
26 |
27 | - todo: "(TODO|FIXME|XXX):?"
28 |
--------------------------------------------------------------------------------
/runtime/files/syntax/vhdl.yaml:
--------------------------------------------------------------------------------
1 | filetype: vhdl
2 |
3 | detect:
4 | filename: "\\.vhdl?$"
5 |
6 | rules:
7 | - type: "(i)\\b(string|integer|natural|positive|(un)?signed|std_u?logic(_vector)?|bit(_vector)?|boolean|u?x01z?|array|range)\\b"
8 | - identifier: "(?i)library[[:space:]]+[a-zA-Z_0-9]+"
9 | - identifier: "(?i)use[[:space:]]+[a-zA-Z_0-9\\.]+"
10 | - identifier: "(?i)component[[:space:]]+[a-zA-Z_0-9]+"
11 | - identifier: "(?i)(architecture|configuration)[[:space:]]+[a-zA-Z_0-9]+[[:space:]]+of[[:space:]]+[a-zA-Z_0-9]+"
12 | - identifier: "(?i)(entity|package)[[:space:]]+[a-zA-Z_0-9]+[[:space:]]+is"
13 | - identifier: "(?i)end[[:space:]]+((architecture|entity|component|process|package|generate)[[:space:]]+)?[a-zA-Z_0-9]+"
14 | - statement: "(?i)\\b(abs|access|after|alias|all|and|architecture|assert|attribute)\\b"
15 | - statement: "(?i)\\b(begin|block|body|buffer|bus|case|component|configuration|constant)\\b"
16 | - statement: "(?i)\\b(disconnect|downto|else|elsif|end|entity|exit)\\b"
17 | - statement: "(?i)\\b(file|for|function|generate|generic|guarded)\\b"
18 | - statement: "(?i)\\b(if|impure|in|inertial|inout|is)\\b"
19 | - statement: "(?i)\\b(label|library|linkage|literal|loop|map|mod)\\b"
20 | - statement: "(?i)\\b(nand|new|next|nor|not|null|of|on|open|or|others|out)\\b"
21 | - statement: "(?i)\\b(package|port|postponed|procedure|process|pure)\\b"
22 | - statement: "(?i)\\b(range|record|register|reject|rem|report|return|rol|ror)\\b"
23 | - statement: "(?i)\\b(select|severity|shared|signal|sla|sll|sra|srl|subtype)\\b"
24 | - statement: "(?i)\\b(then|to|transport|type|unaffected|units|until|use)\\b"
25 | - statement: "(?i)\\b(variable|wait|when|while|with|xnor|xor)\\b"
26 | - statement: "(?i)'(base|left|right|high|low|pos|val|succ|pred|leftof|rightof|image|(last_)?value)"
27 | - statement: "(?i)'((reverse_)?range|length|ascending|event|stable)"
28 | - statement: "(?i)'(simple|path|instance)_name"
29 | - statement: "(?i)\\b(std_match|(rising|falling)_edge|is_x)\\b"
30 | - statement: "(?i)\\bto_(unsigned|signed|integer|u?x01z?|stdu?logic(vector)?)\\b"
31 | - symbol.operator: "(\\+|-|\\*|/|&|<|>|=|\\.|:)"
32 | - constant.number: "(?i)'([0-1]|u|x|z|w|l|h|-)'|[box]?\"([0-1a-fA-F]|u|x|z|w|l|h|-)+\""
33 | - constant.number: "(?i)\\b[0-9\\._]+(e[\\-]?[0-9]+)?( ?[fpnum]?s)?\\b"
34 | - constant.bool: "(?i)\\b(true|false)\\b"
35 | - constant: "(?i)\\b(note|warning|error|failure)\\b"
36 | - constant.string: "\"[^\"]*\""
37 | - comment: "--.*"
38 |
--------------------------------------------------------------------------------
/runtime/files/syntax/erb.yaml:
--------------------------------------------------------------------------------
1 | filetype: erb
2 |
3 | detect:
4 | filename: "\\.erb$|\\.rhtml$"
5 |
6 | rules:
7 | - error: "<[^!].*?>"
8 | - symbol.tag: "(?i)<[/]?(a(bbr|cronym|ddress|pplet|rea|rticle|side|udio)?|b(ase(font)?|d(i|o)|ig|lockquote|r)?|ca(nvas|ption)|center|cite|co(de|l|lgroup)|d(ata(list)?|d|el|etails|fn|ialog|ir|l|t)|em(bed)?|fieldset|fig(caption|ure)|font|form|(i)?frame|frameset|h[1-6]|hr|i|img|in(put|s)|kbd|keygen|label|legend|li(nk)?|ma(in|p|rk)|menu(item)?|met(a|er)|nav|no(frames|script)|o(l|pt(group|ion)|utput)|p(aram|icture|re|rogress)?|q|r(p|t|uby)|s(trike)?|samp|se(ction|lect)|small|source|span|strong|su(b|p|mmary)|textarea|time|track|u(l)?|var|video|wbr)( .*|>)*?>"
9 | - symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*|>)*?>"
10 | - preproc: "(?i)<[/]?(script|style)( .*|>)*?>"
11 | - special: "&[^;[[:space:]]]*;"
12 | - symbol: "[:=]"
13 | - identifier: "(alt|bgcolor|height|href|id|label|longdesc|name|onclick|onfocus|onload|onmouseover|size|span|src|style|target|type|value|width)="
14 | - constant.string: "\"[^\"]*\""
15 | - constant.number: "(?i)#[0-9A-F]{6,6}"
16 | - constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
17 | - comment: ""
18 | - preproc: ""
19 | - default:
20 | start: "<%"
21 | end: "%>"
22 | rules: []
23 |
24 | - preproc: "<%|%>"
25 | - red: "&[^;[[:space:]]]*;"
26 | - statement: "\\b(BEGIN|END|alias|and|begin|break|case|class|def|defined\\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\\b"
27 | - identifier.var: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*"
28 | - magenta: "(?i)([ ]|^):[0-9A-Z_]+\\b"
29 | - identifier.macro: "\\b(__FILE__|__LINE__)\\b"
30 | - brightmagenta: "!/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*"
31 | - brightblue: "`[^`]*`|%x\\{[^}]*\\}"
32 | - constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!"
33 | - brightgreen: "#\\{[^}]*\\}"
34 | - green: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!"
35 | - comment: "#[^{].*$|#$"
36 | - comment.bright: "##[^{].*$|##$"
37 | - identifier.macro:
38 | start: "<<-?'?EOT'?"
39 | end: "^EOT"
40 | rules: []
41 |
42 | - todo: "(XXX|TODO|FIXME|\\?\\?\\?)"
43 |
--------------------------------------------------------------------------------
/runtime/files/syntax/gdscript.yaml:
--------------------------------------------------------------------------------
1 | filetype: gdscript
2 |
3 | detect:
4 | filename: "\\.gd$"
5 |
6 | rules:
7 | # Built-in constants
8 | - constant: "\\b(INF|NAN|PI|TAU)\\b"
9 | - constant.bool: "\\b(null|true|false)\\b"
10 | # Built-in functions
11 | - identifier: "\\b(abs|acos|asin|atan|atan2|ceil|clamp|convert|cos|cosh|db2linear|decimals|deg2rad|ease|exp|float|floor|fmod|fposmod|hash|int|isinf|isnan|lerp|linear2db|load|log|max|min|nearest_po2|pow|preload|print|printerr|printraw|prints|printt|rad2deg|rand_range|rand_seed|randomize|randi|randf|range|round|seed|sin|slerp|sqrt|str|str2var|tan|typeof|var2str|weakref)\\b"
12 | # Built-in node names
13 | - identifier: "\\b(AnimationPlayer|AnimationTreePlayer|Button|Control|Engine|HTTPClient|HTTPRequest|Input|InputEvent|MainLoop|Node|Node2D|OS|SceneTree|Spatial|StreamPeer|PacketPeer|PacketPeerUDP|Timer|Tween)\\b"
14 | # Types
15 | - type: "\\b(AABB|Array|Basis|Color|Dictionary|NodePath|Object|Plane|PoolByteArray|PoolColorArray|PoolIntArray|PoolRealArray|PoolVector2Array|PoolVector3Array|Quat|Rect2|RID|String|Transform|Transform2D|Vector2|Vector3)\\b"
16 | # Definitions
17 | - identifier: "func [a-zA-Z_0-9]+"
18 | # Keywords
19 | - statement: "\\b(and|as|assert|break|breakpoint|class|const|continue|elif|else|enum|export|extends|for|func|if|in|is|map|master|mastersync|match|not|onready|or|pass|remote|remotesync|return|self|setget|slave|slavesync|signal|sync|tool|var|while|yield)\\b"
20 |
21 | # Operators
22 | - statement: "[.:;,+*|=!\\%@]|<|>|/|-|&"
23 |
24 | # Parentheses
25 | - statement: "[(){}]|\\[|\\]"
26 |
27 | # Numbers
28 | - constant: "\\b[0-9]+\\b"
29 | - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
30 |
31 | - comment:
32 | start: "\"\"\""
33 | end: "\"\"\""
34 | rules:
35 | - todo: "(TODO|XXX|FIXME):?"
36 |
37 | - comment:
38 | start: "'''"
39 | end: "'''"
40 | rules:
41 | - todo: "(TODO|XXX|FIXME):?"
42 |
43 | - constant.string:
44 | start: "\""
45 | end: "\""
46 | skip: "\\\\."
47 | rules:
48 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
49 |
50 | - constant.string:
51 | start: "'"
52 | end: "'"
53 | skip: "\\\\."
54 | rules:
55 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
56 |
57 | - comment:
58 | start: "#"
59 | end: "$"
60 | rules:
61 | - todo: "(TODO|XXX|FIXME):?"
62 |
--------------------------------------------------------------------------------
/runtime/files/syntax/objc.yaml:
--------------------------------------------------------------------------------
1 | filetype: objective-c
2 |
3 | detect:
4 | filename: "\\.(m|mm|h)$"
5 |
6 | rules:
7 | - type: "\\b(float|double|CGFloat|id|bool|BOOL|Boolean|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline|Class|SEL|IMP|NS(U)?Integer)\\b"
8 | - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
9 | - type: "\\b[A-Z][A-Z][[:alnum:]]*\\b"
10 | - type: "\\b[A-Za-z0-9_]*_t\\b"
11 | - type: "\\bdispatch_[a-zA-Z0-9_]*_t\\b"
12 |
13 | - statement: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__|__unused|_Nonnull|_Nullable|__block|__builtin.*)"
14 | - statement: "\\b(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\\b"
15 | - statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
16 | - statement: "\\b(try|throw|catch|operator|new|delete)\\b"
17 | - statement: "\\b(goto|continue|break|return)\\b"
18 | - statement: "\\b(nonatomic|atomic|readonly|readwrite|strong|weak|assign)\\b"
19 | - statement: "@(encode|end|interface|implementation|class|selector|protocol|synchronized|try|catch|finally|property|optional|required|import|autoreleasepool)"
20 |
21 | - preproc: "^[[:space:]]*#[[:space:]]*(define|include|import|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma).*$"
22 | - preproc: "__[A-Z0-9_]*__"
23 |
24 | - special: "^[[:space:]]*[#|@][[:space:]]*(import|include)[[:space:]]*[\"|<].*\\/?[>|\"][[:space:]]*$"
25 |
26 | - statement: "([.:;,+*|=!\\%\\[\\]]|<|>|/|-|&)"
27 |
28 | - constant.number: "(\\b(-?)?[0-9]+\\b|\\b\\[0-9]+\\.[0-9]+\\b|\\b0x[0-9A-F]+\\b)"
29 | - constant: "(@\\[(\\\\.|[^\\]])*\\]|@\\{(\\\\.|[^\\}])*\\}|@\\((\\\\.|[^\\)])*\\))"
30 | - constant: "\\b<(\\\\.[^\\>])*\\>\\b"
31 | - constant: "\\b(nil|NULL|YES|NO|TRUE|true|FALSE|false|self)\\b"
32 | - constant: "\\bk[[:alnum]]*\\b"
33 | - constant.string: "'.'"
34 |
35 | - constant.string:
36 | start: "@\""
37 | end: "\""
38 | skip: "\\\\."
39 | rules:
40 | - constant.specialChar: "\\\\."
41 |
42 | - constant.string:
43 | start: "\""
44 | end: "\""
45 | skip: "\\\\."
46 | rules:
47 | - constant.specialChar: "\\\\."
48 |
49 | - comment:
50 | start: "//"
51 | end: "$"
52 | rules:
53 | - todo: "(TODO|XXX|FIXME):?"
54 |
55 | - comment:
56 | start: "/\\*"
57 | end: "\\*/"
58 | rules:
59 | - todo: "(TODO|XXX|FIXME):?"
60 |
61 |
--------------------------------------------------------------------------------
/runtime/files/syntax/twig.yaml:
--------------------------------------------------------------------------------
1 | filetype: twig
2 |
3 | detect:
4 | filename: "\\.twig$"
5 |
6 | rules:
7 | - include: "html"
8 | - symbol.tag:
9 | start: "\\{\\{[[:space:]]"
10 | end: "[[:space:]]\\}\\}"
11 | rules:
12 | - identifier: "\\b(abs|batch|capitalize|convert|encoding|date(_modify)?|default|escape|first|format|join|json_encode|keys|last|length|lower|merge|nl2br|number_format|raw|replace|reverse|round|slice|sort|split|striptags|title|trim|upper|url_encode)\\b"
13 | - identifier.class: "\\b(attribute|block|constant|cycle|date|dump|include|max|min|parent|random|range|source|template_from_string)\\b"
14 | - type.keyword: "\\b(and|as|constant|defined|divisibleby|empty|even|false|in|is|iterable|not|null|odd|or|same(as)?|true|with)\\b"
15 | - symbol.operator: "[.:;,+*?|=!\\%]|<|>|/|-|&"
16 | - symbol.brackets: "[(){}]|\\[|\\]"
17 | - constant.number: "\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b"
18 | - constant.string:
19 | start: "\""
20 | end: "\""
21 | skip: "\\\\"
22 | rules:
23 | - constant.specialChar: "\\\\."
24 | - constant.string:
25 | start: "'"
26 | end: "'"
27 | skip: "\\\\"
28 | rules:
29 | - constant.specialChar: "\\\\."
30 | - symbol.tag:
31 | start: "\\{%[[:space:]]"
32 | end: "[[:space:]]%\\}"
33 | rules:
34 | - identifier: "\\b(abs|batch|capitalize|convert|encoding|date(_modify)?|default|escape|first|format|join|json_encode|keys|last|length|lower|merge|nl2br|number_format|raw|replace|reverse|round|slice|sort|split|striptags|title|trim|upper|url_encode)\\b"
35 | - identifier.class: "\\b(attribute|block|constant|cycle|date|dump|include|max|min|parent|random|range|source|template_from_string)\\b"
36 | - type.keyword: "\\b(and|as|constant|defined|divisibleby|empty|even|false|in|is|iterable|not|null|odd|or|same(as)?|true|with)\\b"
37 | - symbol.operator: "[.:;,+*?|=!\\%]|<|>|/|-|&"
38 | - symbol.brackets: "[(){}]|\\[|\\]"
39 | - constant.number: "\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b"
40 | - constant.string:
41 | start: "\""
42 | end: "\""
43 | skip: "\\\\"
44 | rules:
45 | - constant.specialChar: "\\\\."
46 | - constant.string:
47 | start: "'"
48 | end: "'"
49 | skip: "\\\\"
50 | rules:
51 | - constant.specialChar: "\\\\."
52 | - comment:
53 | start: "\\{#"
54 | end: "#\\}"
55 | rules: []
56 |
--------------------------------------------------------------------------------
/runtime/files/syntax/python2.yaml:
--------------------------------------------------------------------------------
1 | filetype: python
2 |
3 | detect:
4 | filename: "\\.py$"
5 | header: "^#!.*/(env +)?python( |$)"
6 |
7 | rules:
8 |
9 | # built-in objects
10 | - constant: "\\b(None|self|True|False)\\b"
11 | # built-in attributes
12 | - constant: "\\b(__bases__|__builtin__|__class__|__debug__|__dict__|__doc__|__file__|__members__|__methods__|__name__|__self__)\\b"
13 | # built-in functions
14 | - identifier: "\\b(abs|apply|callable|chr|cmp|compile|delattr|dir|divmod|eval|exec|execfile|filter|format|getattr|globals|hasattr|hash|help|hex|id|input|intern|isinstance|issubclass|len|locals|max|min|next|oct|open|ord|pow|range|raw_input|reduce|reload|repr|round|setattr|unichr|vars|zip|__import__)\\b"
15 | # special method names
16 | - identifier: "\\b(__abs__|__add__|__and__|__call__|__cmp__|__coerce__|__complex__|__concat__|__contains__|__del__|__delattr__|__delitem__|__dict__|__delslice__|__div__|__divmod__|__float__|__getattr__|__getitem__|__getslice__|__hash__|__hex__|__init__|__int__|__inv__|__invert__|__len__|__long__|__lshift__|__mod__|__mul__|__neg__|__nonzero__|__oct__|__or__|__pos__|__pow__|__radd__|__rand__|__rcmp__|__rdiv__|__rdivmod__|__repeat__|__repr__|__rlshift__|__rmod__|__rmul__|__ror__|__rpow__|__rrshift__|__rshift__|__rsub__|__rxor__|__setattr__|__setitem__|__setslice__|__str__|__sub__|__xor__)\\b"
17 | # types
18 | - type: "\\b(basestring|bool|buffer|bytearray|bytes|classmethod|complex|dict|enumerate|file|float|frozenset|int|list|long|map|memoryview|object|property|reversed|set|slice|staticmethod|str|super|tuple|type|unicode|xrange)\\b"
19 | # definitions
20 | - identifier: "def [a-zA-Z_0-9]+"
21 | # keywords
22 | - statement: "\\b(and|as|assert|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\\b"
23 | # decorators
24 | - brightgreen: "@.*[(]"
25 | # operators
26 | - symbol.operator: "([.:;,+*|=!\\%@]|<|>|/|-|&)"
27 | # parentheses
28 | - symbol.brackets: "([(){}]|\\[|\\])"
29 | # numbers
30 | - constant.number: "\\b[0-9]+\\b"
31 |
32 | - constant.string:
33 | start: "\"\"\""
34 | end: "\"\"\""
35 | rules: []
36 |
37 | - comment:
38 | start: "'''"
39 | end: "'''"
40 | rules: []
41 |
42 | - constant.string:
43 | start: "\""
44 | end: "\""
45 | skip: "\\\\."
46 | rules:
47 | - constant.specialChar: "\\\\."
48 |
49 | - constant.string:
50 | start: "'"
51 | end: "'"
52 | skip: "\\\\."
53 | rules:
54 | - constant.specialChar: "\\\\."
55 |
56 | - comment:
57 | start: "#"
58 | end: "$"
59 | rules: []
60 |
61 |
--------------------------------------------------------------------------------
/runtime/files/syntax/python3.yaml:
--------------------------------------------------------------------------------
1 | filename: python3
2 |
3 | detect:
4 | filename: "\\.py3$"
5 | header: "^#!.*/(env +)?python3$"
6 |
7 | rules:
8 | # built-in objects
9 | - constant: "\\b(Ellipsis|None|self|True|False)\\b"
10 | # built-in attributes
11 | - constant: "\\b(__bases__|__builtin__|__class__|__debug__|__dict__|__doc__|__file__|__members__|__methods__|__name__|__self__)\\b"
12 | # built-in functions
13 | - identifier: "\\b(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dir|divmod|eval|exec|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|max|min|next|nonlocal|oct|open|ord|pow|print|repr|round|setattr|sorted|sum|vars|__import__)\\b"
14 | # special method names
15 | - identifier: "\\b(__abs__|__add__|__and__|__call__|__cmp__|__coerce__|__complex__|__concat__|__contains__|__del__|__delattr__|__delitem__|__delslice__|__div__|__divmod__|__float__|__getattr__|__getitem__|__getslice__|__hash__|__hex__|__init__|__int__|__inv__|__invert__|__len__|__dict__|__long__|__lshift__|__mod__|__mul__|__neg__|__next__|__nonzero__|__oct__|__or__|__pos__|__pow__|__radd__|__rand__|__rcmp__|__rdiv__|__rdivmod__|__repeat__|__repr__|__rlshift__|__rmod__|__rmul__|__ror__|__rpow__|__rrshift__|__rshift__|__rsub__|__rxor__|__setattr__|__setitem__|__setslice__|__str__|__sub__|__xor__)\\b"
16 | # types
17 | - type: "\\b(bool|bytearray|bytes|classmethod|complex|dict|enumerate|filter|float|frozenset|int|list|map|memoryview|object|property|range|reversed|set|slice|staticmethod|str|super|tuple|type|zip)\\b"
18 | # definitions
19 | - identifier: "def [a-zA-Z_0-9]+"
20 | # keywords
21 | - statement: "\\b(and|as|assert|await|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|raise|return|try|while|with|yield)\\b"
22 | # decorators
23 | - brightgreen: "@.*[(]"
24 | # operators
25 | - symbol.operator: "([.:;,+*|=!\\%@]|<|>|/|-|&)"
26 | # parentheses
27 | - symbol.brackets: "([(){}]|\\[|\\])"
28 | # numbers
29 | - constant.number: "\\b[0-9]+\\b"
30 |
31 | - constant.string:
32 | start: "\"\"\""
33 | end: "\"\"\""
34 | rules: []
35 |
36 | - comment:
37 | start: "'''"
38 | end: "'''"
39 | rules: []
40 |
41 | - constant.string:
42 | start: "\""
43 | end: "\""
44 | skip: "\\\\."
45 | rules:
46 | - constant.specialChar: "\\\\."
47 |
48 | - constant.string:
49 | start: "'"
50 | end: "'"
51 | skip: "\\\\."
52 | rules:
53 | - constant.specialChar: "\\\\."
54 |
55 | - comment:
56 | start: "#"
57 | end: "$"
58 | rules: []
59 |
60 |
--------------------------------------------------------------------------------
/runtime/files/syntax/README.md:
--------------------------------------------------------------------------------
1 | # Syntax Files
2 |
3 | Here are micro's syntax files.
4 |
5 | Each yaml file specifies how to detect the filetype based on file extension or headers (first line of the file).
6 | Then there are patterns and regions linked to highlight groups which tell micro how to highlight that filetype.
7 |
8 | Making your own syntax files is very simple. I recommend you check the file after you are finished with the
9 | [`syntax_checker.go`](./syntax_checker.go) program (located in this directory). Just place your yaml syntax
10 | file in the current directory and run `go run syntax_checker.go` and it will check every file. If there are no
11 | errors it will print `No issues!`.
12 |
13 | You can read more about how to write syntax files (and colorschemes) in the [colors](../help/colors.md) documentation.
14 |
15 | # Legacy '.micro' filetype
16 |
17 | Micro used to use the `.micro` filetype for syntax files which is no longer supported. If you have `.micro`
18 | syntax files that you would like to convert to the new filetype, you can use the [`syntax_converter.go`](./syntax_converter.go) program (also located in this directory):
19 |
20 | ```
21 | $ go run syntax_converter.go c.micro > c.yaml
22 | ```
23 |
24 | Most the the syntax files here have been converted using that tool.
25 |
26 | Note that the tool isn't perfect and though it is unlikely, you may run into some small issues that you will have to fix manually
27 | (about 4 files from this directory had issues after being converted).
28 |
29 | # Micro syntax highlighting files
30 |
31 | These are the syntax highlighting files for micro. To install them, just
32 | put all the syntax files in `~/.config/micro/syntax`.
33 |
34 | They are taken from Nano, specifically from [this repository](https://github.com/scopatz/nanorc).
35 | Micro syntax files are almost identical to Nano's, except for some key differences:
36 |
37 | * Micro does not use `icolor`. Instead, for a case insensitive match, use the case insensitive flag (`i`) in the regular expression
38 | * For example, `icolor green ".*"` would become `color green "(?i).*"`
39 |
40 | # Using with colorschemes
41 |
42 | 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.
43 |
44 | Here is a list of the files that have been converted to properly use colorschemes:
45 |
46 | * vi
47 | * go
48 | * c
49 | * d
50 | * markdown
51 | * html
52 | * lua
53 | * swift
54 | * rust
55 | * java
56 | * javascript
57 | * pascal
58 | * python
59 | * ruby
60 | * sh
61 | * git
62 | * tex
63 | * solidity
64 |
65 | # License
66 |
67 | Because the nano syntax files I have modified are distributed under the GNU GPLv3 license, these files are also distributed
68 | under that license. See [LICENSE](LICENSE).
69 |
--------------------------------------------------------------------------------
/runtime/files/syntax/erlang.yaml:
--------------------------------------------------------------------------------
1 | filetype: erlang
2 |
3 | detect:
4 | filename: "\\.erl$"
5 |
6 | rules:
7 | - identifier: "\\b[A-Z][0-9a-z_]*\\b"
8 | # See: http://erlang.org/doc/reference_manual/data_types.html
9 | - constant.number: "\\b[0-9]+(\\.[0-9]+)?(e-?[0-9]+)?\\b"
10 | - constant.number: "\\b[0-9]{1,2}\\#[a-zA-Z0-9]+\\b"
11 | - constant.bool: "\\b(true|false)\\b"
12 | - constant.number: "\\$\\\\?\\S{1}"
13 | # See: http://erlang.org/doc/reference_manual/introduction.html
14 | - statement: "\\b(after|and|andalso|band|begin|bnot|bor|bsl|bsr|bxor|case|catch|cond|div|end|fun|if|let|not|of|or|orelse|receive|rem|try|when|xor)\\b"
15 | # See: http://erlang.org/doc/reference_manual/macros.html
16 | - preproc: "\\-(module|export|record|include|include_lib|define|undef|ifdef|ifndef|else|endif|if|elif|error|warning)\\b"
17 | - identifier.macro: "\\?[A-Z0-9_]+\\b"
18 | # See: http://erlang.org/doc/man/erlang.html
19 | - special: "\\b(ext_binary|binary|iovec|message_queue_data|time(_unit|stamp)|abs|apply|atom(_to_binary|_to_list)|binary_(part|to_atom|to_existing_atom|to_float|to_integer|to_list|to_term)|bit(_size|string_to_list)|byte_size|ceil|check_(old_code|process_code)|date|delete_module|demonitor|disconnect_node|element|erase|error|exit|float(_to_binary|_to_list)?|floor|garbage_collect|get|group_leader|halt|integer(_to_binary|to_list)|iolist_(size|to_binary)|is_(alive|atom|binary|bitstring|boolean|float|function|integer|list|map|map_key|number|pid|port|process_alive|record|reference|tuple|length)|link|list_to_(atom|binary|bitstring|existing_atom|float|integer|pid|port|ref|tuple)|load_module|make_ref|map_(get|size)|max|min|module_loaded|monitor(_node)?|nodes?|now|open_port|pid_to_list|port(_close|command|connect|control|to_list)|pre_loaded|process(_flag|_info|es)|purge_module|put|register(ed)?|round|self|setelement|size|spawn(_link|_monitor|_opt|_binary)?|statistics|trunc|tuple_(size|to_list)|unlink|unregister|whereis)\\b"
20 | # See: http://erlang.org/doc/reference_manual/data_types.html#atom
21 | - symbol:
22 | start: "'"
23 | end: "'"
24 | skip: "\\\\."
25 | rules: []
26 | # - constant.specialChar: "%."
27 | # - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
28 | # - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
29 | - constant.string:
30 | start: "\""
31 | end: "\""
32 | skip: "\\\\."
33 | rules:
34 | - constant.specialChar: "%."
35 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
36 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
37 | - comment:
38 | start: "\\(\\*"
39 | end: "\\*\\)"
40 | rules:
41 | - todo: "(TODO|FIXME|WONTFIX|NOTE|HACK):?"
--------------------------------------------------------------------------------
/runtime/files/syntax/php.yaml:
--------------------------------------------------------------------------------
1 | filetype: php
2 |
3 | detect:
4 | filename: "\\.php[2345s~]?$"
5 |
6 | rules:
7 | - symbol.operator: "<|>"
8 | - error: "<[^!].*?>"
9 | - symbol.tag: "(?i)<[/]?(a(bbr|cronym|ddress|pplet|rea|rticle|side|udio)?|b(ase(font)?|d(i|o)|ig|lockquote|r)?|ca(nvas|ption)|center|cite|co(de|l|lgroup)|d(ata(list)?|d|el|etails|fn|ialog|ir|l|t)|em(bed)?|fieldset|fig(caption|ure)|font|form|(i)?frame|frameset|h[1-6]|hr|i|img|in(put|s)|kbd|keygen|label|legend|li(nk)?|ma(in|p|rk)|menu(item)?|met(a|er)|nav|no(frames|script)|o(l|pt(group|ion)|utput)|p(aram|icture|re|rogress)?|q|r(p|t|uby)|s(trike)?|samp|se(ction|lect)|small|source|span|strong|su(b|p|mmary)|textarea|time|track|u(l)?|var|video|wbr)( .*|>)*?>"
10 | - symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*|>)*?>"
11 | - preproc: "(?i)<[/]?(script|style)( .*|>)*?>"
12 | - special: "&[^;[[:space:]]]*;"
13 | - symbol: "[:=]"
14 | - identifier: "(alt|bgcolor|height|href|label|longdesc|name|onclick|onfocus|onload|onmouseover|size|span|src|style|target|type|value|width)="
15 | - constant.string: "\"[^\"]*\""
16 | - constant.number: "(?i)#[0-9A-F]{6,6}"
17 | - constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
18 | - comment: ""
19 | - default: "<\\?(php|=)\" end=\"\\?>"
20 | - identifier.class: "([a-zA-Z0-9_-]+)\\("
21 | - preproc: "\\b(require|include)(_once)?\\b"
22 | - type: "\\b(var|class|extends|function|echo|case|default|exit|switch|extends|as|define|do|declare|in|trait|interface|[E|e]xception|array|int|string|bool|iterable|void)\\b"
23 | - identifier.class: "[a-zA-Z\\\\]+::"
24 | - identifier: "\\b([A-Z][a-zA-Z0-9_]+)\\b"
25 | - identifier: "([A-Z0-9_]+)[;|\\s|\\)|,]"
26 | - type.keyword: "(global|public|private|protected|static|const)"
27 | - statement: "(implements|abstract|instanceof|if|else(if)?|endif|namespace|use|as|new|throw|catch|try|while|print|(end)?(foreach)?)\\b"
28 | - identifier: "new\\s([a-zA-Z0-9\\\\]+)"
29 | - special: "(break|continue|goto|return)"
30 | - constant.bool: "(true|false|null|TRUE|FALSE|NULL)"
31 | - constant: "[\\s|=|\\s|\\(|/|+|-|\\*|\\[]"
32 | - constant.number: "[0-9]"
33 | - identifier: "(\\$this|parent|self|\\$this->)"
34 | - symbol.operator: "(=>|===|!==|==|!=|&&|\\|\\||::|=|->|\\!)"
35 | - identifier.var: "(\\$[a-zA-Z0-9\\-_]+)"
36 | - symbol.operator: "[\\(|\\)|/|+|\\-|\\*|\\[|.|,|;]"
37 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
38 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
39 | - symbol.brackets: "(\\[|\\]|\\{|\\}|[()])"
40 | - comment: "(^|[[:space:]])//.*"
41 | - comment: "(^|[[:space:]])#.*"
42 | - comment:
43 | start: "/\\*"
44 | end: "\\*/"
45 | rules: []
46 |
47 | - preproc: "<\\?(php|=)?"
48 | - preproc: "\\?>"
49 | - preproc: ""
50 |
--------------------------------------------------------------------------------
/runtime/files/syntax/octave.yaml:
--------------------------------------------------------------------------------
1 | # References
2 | # https://github.com/zyedidia/micro/blob/master/runtime/syntax/go.yaml
3 | # https://github.com/vim-scripts/octave.vim--/blob/master/syntax/octave.vim
4 | #
5 | # TODO
6 | # include only needed operators
7 | # ... highlighting
8 | # built-in function highlighting?
9 | # highlight eps/pi/e etc. as functions when followed by ()
10 | # what are skip and error fields in strings?
11 | # multiline comments not working
12 |
13 | filetype: octave
14 |
15 | detect:
16 | filename: "\\.m$"
17 |
18 | rules:
19 | # Statements https://www.gnu.org/software/octave/doc/v4.0.0/Statements.html
20 | - statement: "\\b(function|endfunction|return|end|global|persistent)\\b"
21 | - statement: "\\b(if|elseif|else|endif|switch|case|otherwise|endswitch)\\b"
22 | - statement: "\\b(while|endwhile|do|until|for|endfor|parfor|endparfor|break|continue)\\b"
23 | - statement: "\\b(unwind_protect|unwind_protect_cleanup|end_unwind_protect|try|catch|end_try_catch)\\b"
24 |
25 | # Operators
26 | - symbol.operator: "[-+/*=<>!~%&|^]|:="
27 |
28 | # Brackets
29 | - symbol.brackets: "(\\{|\\})"
30 | - symbol.brackets: "(\\(|\\))"
31 | - symbol.brackets: "(\\[|\\])"
32 |
33 | # Commas
34 | - symbol: ","
35 |
36 | # Numbers https://www.gnu.org/software/octave/doc/v4.0.1/Mathematical-Constants.html
37 | - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
38 | - constant.number: "\\b(pi|e|I|Inf|NaN|eps|realmax|realmin)\\b|"
39 |
40 | # Boolean
41 | - constant.bool: "\\b(true|false)\\b"
42 |
43 | # Strings https://www.gnu.org/software/octave/doc/v4.0.1/Strings.html
44 | - constant.string:
45 | start: "\""
46 | end: "\""
47 | skip: "\\\\."
48 | rules:
49 | - constant.specialChar: "%"
50 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
51 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
52 |
53 | - constant.string:
54 | start: "'"
55 | end: "'"
56 | skip: "\\\\."
57 | rules:
58 | - error: "..+"
59 | - constant.specialChar: "%"
60 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
61 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
62 |
63 | # Comments https://www.gnu.org/software/octave/doc/v4.2.1/Comments.html
64 | - comment:
65 | start: "%"
66 | end: "$"
67 | rules:
68 | - todo: "(TODO|XXX|FIXME):?"
69 | - comment:
70 | start: "#"
71 | end: "$"
72 | rules:
73 | - todo: "(TODO|XXX|FIXME):?"
74 | - comment:
75 | start: "%{"
76 | end: "%}"
77 | rules:
78 | - todo: "(TODO|XXX|FIXME):?"
79 | - comment:
80 | start: "#{"
81 | end: "#}"
82 | rules:
83 | - todo: "(TODO|XXX|FIXME):?"
84 |
--------------------------------------------------------------------------------
/runtime/files/syntax/fortran.yaml:
--------------------------------------------------------------------------------
1 | filetype: fortran
2 |
3 | detect:
4 | filename: "\\.([Ff]|[Ff]90|[Ff]95|[Ff][Oo][Rr])$"
5 |
6 | rules:
7 | - type: "(?i)\\b(action|advance|all|allocatable|allocated|any|apostrophe)\\b"
8 | - type: "(?i)\\b(append|asis|assign|assignment|associated|character|common)\\b"
9 | - type: "(?i)\\b(complex|data|default|delim|dimension|double precision)\\b"
10 | - type: "(?i)\\b(elemental|epsilon|external|file|fmt|form|format|huge)\\b"
11 | - type: "(?i)\\b(implicit|include|index|inquire|integer|intent|interface)\\b"
12 | - type: "(?i)\\b(intrinsic|iostat|kind|logical|module|none|null|only)\\\\b"
13 | - type: "(?i)\\b(operator|optional|pack|parameter|pointer|position|private)\\b"
14 | - type: "(?i)\\b(program|public|real|recl|recursive|selected_int_kind)\\b"
15 | - type: "(?i)\\b(selected_real_kind|subroutine|status)\\b"
16 |
17 | - constant: "(?i)\\b(abs|achar|adjustl|adjustr|allocate|bit_size|call|char)\\b"
18 | - constant: "(?i)\\b(close|contains|count|cpu_time|cshift|date_and_time)\\b"
19 | - constant: "(?i)\\b(deallocate|digits|dot_product|eor|eoshift|function|iachar)\\b"
20 | - constant: "(?i)\\b(iand|ibclr|ibits|ibset|ichar|ieor|iolength|ior|ishft|ishftc)\\b"
21 | - constant: "(?i)\\b(lbound|len|len_trim|matmul|maxexponent|maxloc|maxval|merge)\\b"
22 | - constant: "(?i)\\b(minexponent|minloc|minval|mvbits|namelist|nearest|nullify)\\b"
23 | - constant: "(?i)\\b(open|pad|present|print|product|pure|quote|radix)\\b"
24 | - constant: "(?i)\\b(random_number|random_seed|range|read|readwrite|replace)\\b"
25 | - constant: "(?i)\\b(reshape|rewind|save|scan|sequence|shape|sign|size|spacing)\\b"
26 | - constant: "(?i)\\b(spread|sum|system_clock|target|transfer|transpose|trim)\\b"
27 | - constant: "(?i)\\b(ubound|unpack|verify|write|tiny|type|use|yes)\\b"
28 |
29 | - statement: "(?i)\\b(.and.|case|do|else|else?if|else?where|end|end?do|end?if)\\b"
30 | - statement: "(?i)\\b(end?select|.eqv.|forall|if|lge|lgt|lle|llt|.neqv.|.not.)\\b"
31 | - statement: "(?i)\\b(.or.|repeat|select case|then|where|while)\\b"
32 |
33 | - special: "(?i)\\b(continue|cycle|exit|go?to|result|return)\\b"
34 |
35 | #Operator Color
36 | - symbol.operator: "[.:;,+*|=!\\%]|/|-|&"
37 |
38 | #Parenthetical Color
39 | - symbol.bracket: "[(){}]|\\[|\\]"
40 |
41 | # Add preprocessor commands.
42 | - preproc: "^[[:space:]]*#[[:space:]]*(define|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
43 |
44 | - constant.string:
45 | start: "\""
46 | end: "\""
47 | skip: "\\\\."
48 | rules:
49 | - constant.specialChar: "\\\\."
50 |
51 | - constant.string:
52 | start: "'"
53 | end: "'"
54 | skip: "\\\\."
55 | rules:
56 | - constant.specialChar: "\\\\."
57 |
58 | - comment:
59 | start: "!"
60 | end: "$"
61 | rules:
62 | - todo: "(TODO|XXX|FIXME):?"
63 |
64 |
--------------------------------------------------------------------------------
/runtime/files/syntax/arduino.yaml:
--------------------------------------------------------------------------------
1 | filetype: ino
2 |
3 | detect:
4 | filename: "\\.?ino$"
5 |
6 | rules:
7 | - identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
8 |
9 | ##
10 | - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
11 |
12 | ## Constants
13 | - constant: "(?i)\\b(HIGH|LOW|INPUT|OUTPUT)\\b"
14 |
15 | ## Serial Print
16 | - constant: "(?i)\\b(DEC|BIN|HEX|OCT|BYTE)\\b"
17 |
18 | ## PI Constants
19 | - constant: "(?i)\\b(PI|HALF_PI|TWO_PI)\\b"
20 |
21 | ## ShiftOut
22 | - constant: "(?i)\\b(LSBFIRST|MSBFIRST)\\b"
23 |
24 | ## Attach Interrupt
25 | - constant: "(?i)\\b(CHANGE|FALLING|RISING)\\b"
26 |
27 | ## Analog Reference
28 | - constant: "(?i)\\b(DEFAULT|EXTERNAL|INTERNAL|INTERNAL1V1|INTERNAL2V56)\\b"
29 |
30 | ## === FUNCTIONS === ##
31 |
32 | ## Data Types
33 | - type: "\\b(boolean|byte|char|float|int|long|word)\\b"
34 |
35 | ## Control Structions
36 | - statement: "\\b(case|class|default|do|double|else|false|for|if|new|null|private|protected|public|short|signed|static|String|switch|this|throw|try|true|unsigned|void|while)\\b"
37 | - statement: "\\b(goto|continue|break|return)\\b"
38 |
39 | ## Math
40 | - identifier: "\\b(abs|acos|asin|atan|atan2|ceil|constrain|cos|degrees|exp|floor|log|map|max|min|radians|random|randomSeed|round|sin|sq|sqrt|tan)\\b"
41 |
42 | ## Bits & Bytes
43 | - identifier: "\\b(bitRead|bitWrite|bitSet|bitClear|bit|highByte|lowByte)\\b"
44 |
45 | ## Analog I/O
46 | - identifier: "\\b(analogReference|analogRead|analogWrite)\\b"
47 |
48 | ## External Interrupts
49 | - identifier: "\\b(attachInterrupt|detachInterrupt)\\b"
50 |
51 | ## Time
52 | - identifier: "\\b(delay|delayMicroseconds|millis|micros)\\b"
53 |
54 | ## Digital I/O
55 | - identifier: "\\b(pinMode|digitalWrite|digitalRead)\\b"
56 |
57 | ## Interrupts
58 | - identifier: "\\b(interrupts|noInterrupts)\\b"
59 |
60 | ## Advanced I/O
61 | - identifier: "\\b(noTone|pulseIn|shiftIn|shiftOut|tone)\\b"
62 |
63 | ## Serial
64 | - identifier: "\\b(Serial|Serial1|Serial2|Serial3|begin|end|peek|read|print|println|available|flush)\\b"
65 |
66 | ## Structure
67 | - identifier: "\\b(setup|loop)\\b"
68 |
69 | ##
70 | - statement: "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)"
71 |
72 | ## GCC builtins
73 | - constant: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)"
74 |
75 | - constant.string:
76 | start: "\""
77 | end: "\""
78 | skip: "\\\\."
79 | rules:
80 | - constant.specialChar: "\\\\."
81 |
82 | - constant.string:
83 | start: "'"
84 | end: "'"
85 | skip: "\\\\."
86 | rules:
87 | - preproc: "..+"
88 | - constant.specialChar: "\\\\."
89 |
90 | - comment:
91 | start: "//"
92 | end: "$"
93 | rules:
94 | - todo: "(TODO|XXX|FIXME):?"
95 |
96 | - comment:
97 | start: "/\\*"
98 | end: "\\*/"
99 | rules:
100 | - todo: "(TODO|XXX|FIXME):?"
101 |
102 |
--------------------------------------------------------------------------------
/runtime/files/syntax/lilypond.yaml:
--------------------------------------------------------------------------------
1 | filetype: lilypond
2 |
3 | detect:
4 | filename: "\\.ly$|\\.ily$|\\.lly$"
5 |
6 | rules:
7 | - constant.number: "\\d+"
8 | - identifier: "\\b(staff|spacing|signature|routine|notes|handler|corrected|beams|arpeggios|Volta_engraver|Voice|Vertical_align_engraver|Vaticana_ligature_engraver|VaticanaVoice|VaticanaStaff|Tweak_engraver|Tuplet_engraver|Trill_spanner_engraver|Timing_translator|Time_signature_performer|Time_signature_engraver|Tie_performer|Tie_engraver|Text_spanner_engraver|Text_engraver|Tempo_performer|Tab_tie_follow_engraver|Tab_staff_symbol_engraver|Tab_note_heads_engraver|TabVoice|TabStaff|System_start_delimiter_engraver|Stem_engraver|Stanza_number_engraver|Stanza_number_align_engraver|Staff_symbol_engraver|Staff_performer|Staff_collecting_engraver|StaffGroup|Staff|Spanner_break_forbid_engraver|Span_bar_stub_engraver|Span_bar_engraver|Span_arpeggio_engraver|Spacing_engraver|Slur_performer|Slur_engraver|Slash_repeat_engraver|Separating_line_group_engraver|Script_row_engraver|Script_engraver|Script_column_engraver|Score|Rhythmic_column_engraver|RhythmicStaff|Rest_engraver|Rest_collision_engraver|Repeat_tie_engraver|Repeat_acknowledge_engraver|Pure_from_neighbor_engraver|Pitched_trill_engraver|Pitch_squash_engraver|Piano_pedal_performer|Piano_pedal_engraver|Piano_pedal_align_engraver|PianoStaff|Phrasing_slur_engraver|PetrucciVoice|PetrucciStaff|Percent_repeat_engraver|Part_combine_engraver|Parenthesis_engraver|Paper_column_engraver|Output_property_engraver|Ottava_spanner_engraver|OneStaff|NullVoice|Note_spacing_engraver|Note_performer|Note_name_engraver|Note_heads_engraver|Note_head_line_engraver|NoteName\\|NoteHead|New_fingering_engraver|Multi_measure_rest_engraver|Midi_control_function_performer|Metronome_mark_engraver|Mensural_ligature_engraver|MensuralVoice|MensuralStaff|Mark_engraver|Lyrics|Lyric_performer|Lyric_engraver|Ligature_bracket_engraver|Ledger_line_engraver|Laissez_vibrer_engraver|Kievan_ligature_engraver|KievanVoice|KievanStaff|Key_performer|Key_engraver|Keep_alive_together_engraver|Instrument_switch_engraver|Instrument_name_engraver|Hyphen_engraver|Grob_pq_engraver|GregorianTranscriptionVoice|GregorianTranscriptionStaff|GrandStaff|Grace_spacing_engraver|Grace_engraver|Grace_beam_engraver|Grace_auto_beam_engraver|Global|Glissando_engraver|Fretboard_engraver|FretBoards|Forbid_line_break_engraver|Footnote_engraver|Font_size_engraver|Fingering_engraver|Fingering_column_engraver|Figured_bass_position_engraver|Figured_bass_engraver|FiguredBass|Extender_engraver|Episema_engraver|Dynamics|Dynamic_performer|Dynamic_engraver|Dynamic_align_engraver|Drum_notes_engraver|Drum_note_performer|DrumVoice|DrumStaff|Double_percent_repeat_engraver|Dots_engraver|Dot_column_engraver|Devnull|Default_bar_line_engraver|Custos_engraver|Cue_clef_engraver|CueVoice|Control_track_performer|Concurrent_hairpin_engraver|Collision_engraver|Cluster_spanner_engraver|Clef_engraver|Chord_tremolo_engraver|Chord_name_engraver|ChordNames|ChoirStaff|Breathing_sign_engraver|Break_align_engraver|Bend_engraver|Beam_performer|Beam_engraver|Beam_collision_engraver|Bar_number_engraver|Bar_engraver|Axis_group_engraver|Auto_beam_engraver|Arpeggio_engraver|Accidental_engraver|Score)\\b"
9 | - statement: "[-_^]?\\\\[-A-Za-z_]+"
10 | - preproc: "\\b(((gisis|gis|geses|ges|g|fisis|fis|feses|fes|f|eisis|eis|eeses|ees|e|disis|dis|deses|des|d|cisis|cis|ceses|ces|c|bisis|bis|beses|bes|b|aisis|ais|aeses|aes|a)[,']*[?!]?)|s|r|R|q)(128|64|32|16|8|4|2|1|\\\\breve|\\\\longa|\\\\maxima)?([^\\\\\\w]|_|\\b)"
11 | - special: "[(){}<>]|\\[|\\]"
12 | - constant.string:
13 | start: "\""
14 | end: "\""
15 | skip: "\\\\."
16 | rules:
17 | - constant.specialChar: "\\\\."
18 | - comment:
19 | start: "%\\{"
20 | end: "%\\}"
21 | rules: []
22 | - comment:
23 | start: "%"
24 | end: "$"
25 | rules: []
26 |
27 |
--------------------------------------------------------------------------------
/loc.go:
--------------------------------------------------------------------------------
1 | package femto
2 |
3 | // FromCharPos converts from a character position to an x, y position
4 | func FromCharPos(loc int, buf *Buffer) Loc {
5 | charNum := 0
6 | x, y := 0, 0
7 |
8 | lineLen := Count(buf.Line(y)) + 1
9 | for charNum+lineLen <= loc {
10 | charNum += lineLen
11 | y++
12 | lineLen = Count(buf.Line(y)) + 1
13 | }
14 | x = loc - charNum
15 |
16 | return Loc{x, y}
17 | }
18 |
19 | // ToCharPos converts from an x, y position to a character position
20 | func ToCharPos(start Loc, buf *Buffer) int {
21 | x, y := start.X, start.Y
22 | loc := 0
23 | for i := 0; i < y; i++ {
24 | // + 1 for the newline
25 | loc += Count(buf.Line(i)) + 1
26 | }
27 | loc += x
28 | return loc
29 | }
30 |
31 | // InBounds returns whether the given location is a valid character position in the given buffer
32 | func InBounds(pos Loc, buf *Buffer) bool {
33 | if pos.Y < 0 || pos.Y >= buf.NumLines || pos.X < 0 || pos.X > Count(buf.Line(pos.Y)) {
34 | return false
35 | }
36 |
37 | return true
38 | }
39 |
40 | // ByteOffset is just like ToCharPos except it counts bytes instead of runes
41 | func ByteOffset(pos Loc, buf *Buffer) int {
42 | x, y := pos.X, pos.Y
43 | loc := 0
44 | for i := 0; i < y; i++ {
45 | // + 1 for the newline
46 | loc += len(buf.Line(i)) + 1
47 | }
48 | loc += len(buf.Line(y)[:x])
49 | return loc
50 | }
51 |
52 | // Loc stores a location
53 | type Loc struct {
54 | X, Y int
55 | }
56 |
57 | // Diff returns the distance between two locations
58 | func Diff(a, b Loc, buf *Buffer) int {
59 | if a.Y == b.Y {
60 | if a.X > b.X {
61 | return a.X - b.X
62 | }
63 | return b.X - a.X
64 | }
65 |
66 | // Make sure a is guaranteed to be less than b
67 | if b.LessThan(a) {
68 | a, b = b, a
69 | }
70 |
71 | loc := 0
72 | for i := a.Y + 1; i < b.Y; i++ {
73 | // + 1 for the newline
74 | loc += Count(buf.Line(i)) + 1
75 | }
76 | loc += Count(buf.Line(a.Y)) - a.X + b.X + 1
77 | return loc
78 | }
79 |
80 | // LessThan returns true if b is smaller
81 | func (l Loc) LessThan(b Loc) bool {
82 | if l.Y < b.Y {
83 | return true
84 | }
85 | if l.Y == b.Y && l.X < b.X {
86 | return true
87 | }
88 | return false
89 | }
90 |
91 | // GreaterThan returns true if b is bigger
92 | func (l Loc) GreaterThan(b Loc) bool {
93 | if l.Y > b.Y {
94 | return true
95 | }
96 | if l.Y == b.Y && l.X > b.X {
97 | return true
98 | }
99 | return false
100 | }
101 |
102 | // GreaterEqual returns true if b is greater than or equal to b
103 | func (l Loc) GreaterEqual(b Loc) bool {
104 | if l.Y > b.Y {
105 | return true
106 | }
107 | if l.Y == b.Y && l.X > b.X {
108 | return true
109 | }
110 | if l == b {
111 | return true
112 | }
113 | return false
114 | }
115 |
116 | // LessEqual returns true if b is less than or equal to b
117 | func (l Loc) LessEqual(b Loc) bool {
118 | if l.Y < b.Y {
119 | return true
120 | }
121 | if l.Y == b.Y && l.X < b.X {
122 | return true
123 | }
124 | if l == b {
125 | return true
126 | }
127 | return false
128 | }
129 |
130 | // This moves the location one character to the right
131 | func (l Loc) right(buf *Buffer) Loc {
132 | if l == buf.End() {
133 | return Loc{l.X + 1, l.Y}
134 | }
135 | var res Loc
136 | if l.X < Count(buf.Line(l.Y)) {
137 | res = Loc{l.X + 1, l.Y}
138 | } else {
139 | res = Loc{0, l.Y + 1}
140 | }
141 | return res
142 | }
143 |
144 | // This moves the given location one character to the left
145 | func (l Loc) left(buf *Buffer) Loc {
146 | if l == buf.Start() {
147 | return Loc{l.X - 1, l.Y}
148 | }
149 | var res Loc
150 | if l.X > 0 {
151 | res = Loc{l.X - 1, l.Y}
152 | } else {
153 | res = Loc{Count(buf.Line(l.Y - 1)), l.Y - 1}
154 | }
155 | return res
156 | }
157 |
158 | // Move moves the cursor n characters to the left or right
159 | // It moves the cursor left if n is negative
160 | func (l Loc) Move(n int, buf *Buffer) Loc {
161 | if n > 0 {
162 | for i := 0; i < n; i++ {
163 | l = l.right(buf)
164 | }
165 | return l
166 | }
167 | for i := 0; i < Abs(n); i++ {
168 | l = l.left(buf)
169 | }
170 | return l
171 | }
172 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## femto, an editor component for tview
2 |
3 | `femto` is a text editor component for tview. The vast majority of the code is derived from
4 | [the micro editor](github.com/zyedidia/micro).
5 |
6 | **Note** The shape of the `femto` API is a work-in-progress, and should not be considered stable.
7 |
8 | ### Default keybindings
9 | ```
10 | Up: CursorUp
11 | Down: CursorDown
12 | Right: CursorRight
13 | Left: CursorLeft
14 | ShiftUp: SelectUp
15 | ShiftDown: SelectDown
16 | ShiftLeft: SelectLeft
17 | ShiftRight: SelectRight
18 | AltLeft: WordLeft
19 | AltRight: WordRight
20 | AltUp: MoveLinesUp
21 | AltDown: MoveLinesDown
22 | AltShiftRight: SelectWordRight
23 | AltShiftLeft: SelectWordLeft
24 | CtrlLeft: StartOfLine
25 | CtrlRight: EndOfLine
26 | CtrlShiftLeft: SelectToStartOfLine
27 | ShiftHome: SelectToStartOfLine
28 | CtrlShiftRight: SelectToEndOfLine
29 | ShiftEnd: SelectToEndOfLine
30 | CtrlUp: CursorStart
31 | CtrlDown: CursorEnd
32 | CtrlShiftUp: SelectToStart
33 | CtrlShiftDown: SelectToEnd
34 | Alt-{: ParagraphPrevious
35 | Alt-}: ParagraphNext
36 | Enter: InsertNewline
37 | CtrlH: Backspace
38 | Backspace: Backspace
39 | Alt-CtrlH: DeleteWordLeft
40 | Alt-Backspace: DeleteWordLeft
41 | Tab: IndentSelection,InsertTab
42 | Backtab: OutdentSelection,OutdentLine
43 | CtrlZ: Undo
44 | CtrlY: Redo
45 | CtrlC: Copy
46 | CtrlX: Cut
47 | CtrlK: CutLine
48 | CtrlD: DuplicateLine
49 | CtrlV: Paste
50 | CtrlA: SelectAll
51 | Home: StartOfLine
52 | End: EndOfLine
53 | CtrlHome: CursorStart
54 | CtrlEnd: CursorEnd
55 | PageUp: CursorPageUp
56 | PageDown: CursorPageDown
57 | CtrlR: ToggleRuler
58 | Delete: Delete
59 | Insert: ToggleOverwriteMode
60 | Alt-f: WordRight
61 | Alt-b: WordLeft
62 | Alt-a: StartOfLine
63 | Alt-e: EndOfLine
64 | Esc: Escape
65 | Alt-n: SpawnMultiCursor
66 | Alt-m: SpawnMultiCursorSelect
67 | Alt-p: RemoveMultiCursor
68 | Alt-c: RemoveAllMultiCursors
69 | Alt-x: SkipMultiCursor
70 | ```
71 |
72 | ### Example Usage
73 |
74 | The code below (also found in `cmd/femto/femto.go`) creates a `tview` application with a single full-screen editor
75 | that operates on one file at a time. Ctrl-s saves any edits; Ctrl-q quits.
76 |
77 | ```go
78 | package main
79 |
80 | import (
81 | "fmt"
82 | "io/ioutil"
83 | "log"
84 | "os"
85 |
86 | "github.com/gdamore/tcell/v2"
87 | "github.com/pgavlin/femto"
88 | "github.com/pgavlin/femto/runtime"
89 | "github.com/rivo/tview"
90 | )
91 |
92 | func saveBuffer(b *femto.Buffer, path string) error {
93 | return ioutil.WriteFile(path, []byte(b.String()), 0600)
94 | }
95 |
96 | func main() {
97 | if len(os.Args) != 2 {
98 | fmt.Fprintf(os.Stderr, "usage: femto [filename]\n")
99 | os.Exit(1)
100 | }
101 | path := os.Args[1]
102 |
103 | content, err := ioutil.ReadFile(path)
104 | if err != nil {
105 | log.Fatalf("could not read %v: %v", path, err)
106 | }
107 |
108 | var colorscheme femto.Colorscheme
109 | if monokai := runtime.Files.FindFile(femto.RTColorscheme, "monokai"); monokai != nil {
110 | if data, err := monokai.Data(); err == nil {
111 | colorscheme = femto.ParseColorscheme(string(data))
112 | }
113 | }
114 |
115 | app := tview.NewApplication()
116 | buffer := femto.NewBufferFromString(string(content), path)
117 | root := femto.NewView(buffer)
118 | root.SetRuntimeFiles(runtime.Files)
119 | root.SetColorscheme(colorscheme)
120 | root.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
121 | switch event.Key() {
122 | case tcell.KeyCtrlS:
123 | saveBuffer(buffer, path)
124 | return nil
125 | case tcell.KeyCtrlQ:
126 | app.Stop()
127 | return nil
128 | }
129 | return event
130 | })
131 | app.SetRoot(root, true)
132 |
133 | if err := app.Run(); err != nil {
134 | log.Fatalf("%v", err)
135 | }
136 | }
137 | ```
138 |
--------------------------------------------------------------------------------
/rtfiles.go:
--------------------------------------------------------------------------------
1 | package femto
2 |
3 | import (
4 | "io/ioutil"
5 | "net/http"
6 | "os"
7 | "path/filepath"
8 | )
9 |
10 | const (
11 | RTColorscheme = "colorscheme"
12 | RTSyntax = "syntax"
13 | )
14 |
15 | func readDir(fs http.FileSystem, path string) ([]os.FileInfo, error) {
16 | if fs == nil {
17 | return nil, os.ErrNotExist
18 | }
19 |
20 | dir, err := fs.Open(path)
21 | if err != nil {
22 | return nil, err
23 | }
24 | defer dir.Close()
25 |
26 | return dir.Readdir(0)
27 | }
28 |
29 | func readFile(fs http.FileSystem, path string) ([]byte, error) {
30 | if fs == nil {
31 | return nil, os.ErrNotExist
32 | }
33 |
34 | f, err := fs.Open(path)
35 | if err != nil {
36 | return nil, err
37 | }
38 | return ioutil.ReadAll(f)
39 | }
40 |
41 | // RuntimeFile allows the program to read runtime data like colorschemes or syntax files
42 | type RuntimeFile interface {
43 | // Name returns a name of the file without paths or extensions
44 | Name() string
45 | // Data returns the content of the file.
46 | Data() ([]byte, error)
47 | }
48 |
49 | // allFiles contains all available files, mapped by filetype
50 | var allFiles map[string][]RuntimeFile
51 |
52 | // some file on filesystem
53 | type realFile struct {
54 | fs http.FileSystem
55 | path string
56 | }
57 |
58 | // some file on filesystem but with a different name
59 | type namedFile struct {
60 | realFile
61 | name string
62 | }
63 |
64 | // a file with the data stored in memory
65 | type memoryFile struct {
66 | name string
67 | data []byte
68 | }
69 |
70 | func (mf memoryFile) Name() string {
71 | return mf.name
72 | }
73 | func (mf memoryFile) Data() ([]byte, error) {
74 | return mf.data, nil
75 | }
76 |
77 | func (rf realFile) Name() string {
78 | fn := filepath.Base(rf.path)
79 | return fn[:len(fn)-len(filepath.Ext(fn))]
80 | }
81 |
82 | func (rf realFile) Data() ([]byte, error) {
83 | return readFile(rf.fs, rf.path)
84 | }
85 |
86 | func (nf namedFile) Name() string {
87 | return nf.name
88 | }
89 |
90 | // RuntimeFiles tracks a set of runtime files.
91 | type RuntimeFiles struct {
92 | allFiles map[string][]RuntimeFile
93 | }
94 |
95 | // NewRuntimeFiles creates a new set of runtime files from the colorscheme and syntax files present in the given
96 | // http.Filesystme. Colorschemes should be located under "/colorschemes" and must end with a "micro" extension.
97 | // Syntax files should be located under "/syntax" and must end with a "yaml" extension.
98 | func NewRuntimeFiles(fs http.FileSystem) *RuntimeFiles {
99 | rfs := &RuntimeFiles{}
100 | rfs.AddFilesFromDirectory(fs, RTColorscheme, "/colorschemes", "*.micro")
101 | rfs.AddFilesFromDirectory(fs, RTSyntax, "/syntax", "*.yaml")
102 | return rfs
103 | }
104 |
105 | // AddRuntimeFile registers a file for the given filetype
106 | func (rfs *RuntimeFiles) AddFile(fileType string, file RuntimeFile) {
107 | if rfs.allFiles == nil {
108 | rfs.allFiles = make(map[string][]RuntimeFile)
109 | }
110 | rfs.allFiles[fileType] = append(rfs.allFiles[fileType], file)
111 | }
112 |
113 | // AddFilesFromDirectory registers each file from the given directory for
114 | // the filetype which matches the file-pattern
115 | func (rfs *RuntimeFiles) AddFilesFromDirectory(fs http.FileSystem, fileType, directory, pattern string) {
116 | files, _ := readDir(fs, directory)
117 | for _, f := range files {
118 | if ok, _ := filepath.Match(pattern, f.Name()); !f.IsDir() && ok {
119 | fullPath := filepath.Join(directory, f.Name())
120 | rfs.AddFile(fileType, realFile{fs, fullPath})
121 | }
122 | }
123 | }
124 |
125 | // FindFile finds a runtime file of the given filetype and name
126 | // will return nil if no file was found
127 | func (rfs RuntimeFiles) FindFile(fileType, name string) RuntimeFile {
128 | for _, f := range rfs.ListRuntimeFiles(fileType) {
129 | if f.Name() == name {
130 | return f
131 | }
132 | }
133 | return nil
134 | }
135 |
136 | // ListRuntimeFiles lists all known runtime files for the given filetype
137 | func (rfs RuntimeFiles) ListRuntimeFiles(fileType string) []RuntimeFile {
138 | if files, ok := rfs.allFiles[fileType]; ok {
139 | return files
140 | }
141 | return []RuntimeFile{}
142 | }
143 |
--------------------------------------------------------------------------------