Merge pull request #213 from zyedidia/local-settings

Support for local settings
This commit is contained in:
Zachary Yedidia
2016-08-26 09:00:35 -04:00
committed by GitHub
100 changed files with 814 additions and 545 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -91,7 +91,13 @@ func HelpComplete(input string) (string, []string) {
// OptionComplete autocompletes options
func OptionComplete(input string) (string, []string) {
var suggestions []string
for option := range settings {
localSettings := DefaultLocalSettings()
for option := range globalSettings {
if strings.HasPrefix(option, input) {
suggestions = append(suggestions, option)
}
}
for option := range localSettings {
if strings.HasPrefix(option, input) {
suggestions = append(suggestions, option)
}

View File

@@ -8,7 +8,6 @@ import (
"os/exec"
"os/signal"
"path/filepath"
"strings"
"time"
"unicode/utf8"
)
@@ -39,8 +38,9 @@ type Buffer struct {
// Syntax highlighting rules
rules []SyntaxRule
// The buffer's filetype
FileType string
// Buffer local settings
Settings map[string]interface{}
}
// The SerializedBuffer holds the types that get serialized when a buffer is saved
@@ -56,6 +56,13 @@ func NewBuffer(txt []byte, path string) *Buffer {
b := new(Buffer)
b.LineArray = NewLineArray(txt)
b.Settings = DefaultLocalSettings()
for k, v := range globalSettings {
if _, ok := b.Settings[k]; ok {
b.Settings[k] = v
}
}
b.Path = path
b.Name = path
@@ -70,6 +77,7 @@ func NewBuffer(txt []byte, path string) *Buffer {
b.EventHandler = NewEventHandler(b)
b.Update()
b.FindFileType()
b.UpdateRules()
if _, err := os.Stat(configDir + "/buffers/"); os.IsNotExist(err) {
@@ -85,7 +93,9 @@ func NewBuffer(txt []byte, path string) *Buffer {
buf: b,
}
if settings["savecursor"].(bool) || settings["saveundo"].(bool) {
InitLocalSettings(b)
if b.Settings["savecursor"].(bool) || b.Settings["saveundo"].(bool) {
// If either savecursor or saveundo is turned on, we need to load the serialized information
// from ~/.config/micro/buffers
absPath, _ := filepath.Abs(b.Path)
@@ -98,13 +108,13 @@ func NewBuffer(txt []byte, path string) *Buffer {
if err != nil {
TermMessage(err.Error(), "\n", "You may want to remove the files in ~/.config/micro/buffers (these files store the information for the 'saveundo' and 'savecursor' options) if this problem persists.")
}
if settings["savecursor"].(bool) {
if b.Settings["savecursor"].(bool) {
b.Cursor = buffer.Cursor
b.Cursor.buf = b
b.Cursor.Relocate()
}
if settings["saveundo"].(bool) {
if b.Settings["saveundo"].(bool) {
// We should only use last time's eventhandler if the file wasn't by someone else in the meantime
if b.ModTime == buffer.ModTime {
b.EventHandler = buffer.EventHandler
@@ -115,18 +125,23 @@ func NewBuffer(txt []byte, path string) *Buffer {
file.Close()
}
_, err := Call("onBufferOpen", b)
if err != nil && !strings.HasPrefix(err.Error(), "function does not exist") {
TermMessage(err)
}
return b
}
// UpdateRules updates the syntax rules and filetype for this buffer
// This is called when the colorscheme changes
func (b *Buffer) UpdateRules() {
b.rules, b.FileType = GetRules(b)
b.rules = GetRules(b)
}
// FindFileType identifies this buffer's filetype based on the extension or header
func (b *Buffer) FindFileType() {
b.Settings["filetype"] = FindFileType(b)
}
// FileType returns the buffer's filetype
func (b *Buffer) FileType() string {
return b.Settings["filetype"].(string)
}
// CheckModTime makes sure that the file this buffer points to hasn't been updated
@@ -184,7 +199,7 @@ func (b *Buffer) SaveWithSudo() error {
// Serialize serializes the buffer to configDir/buffers
func (b *Buffer) Serialize() error {
if settings["savecursor"].(bool) || settings["saveundo"].(bool) {
if b.Settings["savecursor"].(bool) || b.Settings["saveundo"].(bool) {
absPath, _ := filepath.Abs(b.Path)
file, err := os.Create(configDir + "/buffers/" + EscapePath(absPath))
if err == nil {

View File

@@ -24,7 +24,7 @@ func InitColorscheme() {
// LoadDefaultColorscheme loads the default colorscheme from $(configDir)/colorschemes
func LoadDefaultColorscheme() {
LoadColorscheme(settings["colorscheme"].(string), configDir+"/colorschemes")
LoadColorscheme(globalSettings["colorscheme"].(string), configDir+"/colorschemes")
}
// LoadColorscheme loads the given colorscheme from a directory

View File

@@ -25,16 +25,17 @@ type StrCommand struct {
var commands map[string]Command
var commandActions = map[string]func([]string){
"Set": Set,
"Run": Run,
"Bind": Bind,
"Quit": Quit,
"Save": Save,
"Replace": Replace,
"VSplit": VSplit,
"HSplit": HSplit,
"Tab": NewTab,
"Help": Help,
"Set": Set,
"SetLocal": SetLocal,
"Run": Run,
"Bind": Bind,
"Quit": Quit,
"Save": Save,
"Replace": Replace,
"VSplit": VSplit,
"HSplit": HSplit,
"Tab": NewTab,
"Help": Help,
}
// InitCommands initializes the default commands
@@ -67,16 +68,17 @@ func MakeCommand(name, function string, completions ...Completion) {
// DefaultCommands returns a map containing micro's default commands
func DefaultCommands() map[string]StrCommand {
return map[string]StrCommand{
"set": StrCommand{"Set", []Completion{OptionCompletion, NoCompletion}},
"bind": StrCommand{"Bind", []Completion{NoCompletion}},
"run": StrCommand{"Run", []Completion{NoCompletion}},
"quit": StrCommand{"Quit", []Completion{NoCompletion}},
"save": StrCommand{"Save", []Completion{NoCompletion}},
"replace": StrCommand{"Replace", []Completion{NoCompletion}},
"vsplit": StrCommand{"VSplit", []Completion{FileCompletion, NoCompletion}},
"hsplit": StrCommand{"HSplit", []Completion{FileCompletion, NoCompletion}},
"tab": StrCommand{"Tab", []Completion{FileCompletion, NoCompletion}},
"help": StrCommand{"Help", []Completion{HelpCompletion, NoCompletion}},
"set": StrCommand{"Set", []Completion{OptionCompletion, NoCompletion}},
"setlocal": StrCommand{"SetLocal", []Completion{OptionCompletion, NoCompletion}},
"bind": StrCommand{"Bind", []Completion{NoCompletion}},
"run": StrCommand{"Run", []Completion{NoCompletion}},
"quit": StrCommand{"Quit", []Completion{NoCompletion}},
"save": StrCommand{"Save", []Completion{NoCompletion}},
"replace": StrCommand{"Replace", []Completion{NoCompletion}},
"vsplit": StrCommand{"VSplit", []Completion{FileCompletion, NoCompletion}},
"hsplit": StrCommand{"HSplit", []Completion{FileCompletion, NoCompletion}},
"tab": StrCommand{"Tab", []Completion{FileCompletion, NoCompletion}},
"help": StrCommand{"Help", []Completion{HelpCompletion, NoCompletion}},
}
}
@@ -175,6 +177,20 @@ func Set(args []string) {
SetOptionAndSettings(option, value)
}
func SetLocal(args []string) {
if len(args) < 2 {
return
}
option := strings.TrimSpace(args[0])
value := strings.TrimSpace(args[1])
err := SetLocalOption(option, value, CurView())
if err != nil {
messenger.Error(err.Error())
}
}
// Bind creates a new keybinding
func Bind(args []string) {
if len(args) != 2 {
@@ -259,7 +275,7 @@ func Replace(args []string) {
// The 'check' flag was used
Search(search, view, true)
view.Relocate()
if settings["syntax"].(bool) {
if view.Buf.Settings["syntax"].(bool) {
view.matches = Match(view)
}
RedrawAll()

View File

@@ -294,12 +294,12 @@ func (c *Cursor) Start() {
// GetCharPosInLine gets the char position of a visual x y coordinate (this is necessary because tabs are 1 char but 4 visual spaces)
func (c *Cursor) GetCharPosInLine(lineNum, visualPos int) int {
// Get the tab size
tabSize := int(settings["tabsize"].(float64))
visualLineLen := StringWidth(c.buf.Line(lineNum))
tabSize := int(c.buf.Settings["tabsize"].(float64))
visualLineLen := StringWidth(c.buf.Line(lineNum), tabSize)
if visualPos > visualLineLen {
visualPos = visualLineLen
}
width := WidthOfLargeRunes(c.buf.Line(lineNum))
width := WidthOfLargeRunes(c.buf.Line(lineNum), tabSize)
if visualPos >= width {
return visualPos - width
}
@@ -309,7 +309,8 @@ func (c *Cursor) GetCharPosInLine(lineNum, visualPos int) int {
// GetVisualX returns the x value of the cursor in visual spaces
func (c *Cursor) GetVisualX() int {
runes := []rune(c.buf.Line(c.Y))
return StringWidth(string(runes[:c.X]))
tabSize := int(c.buf.Settings["tabsize"].(float64))
return StringWidth(string(runes[:c.X]), tabSize)
}
// Relocate makes sure that the cursor is inside the bounds of the buffer

View File

@@ -389,19 +389,29 @@ func LoadRulesFromFile(text, filename string) []SyntaxRule {
return rules
}
// GetRules finds the syntax rules that should be used for the buffer
// and returns them. It also returns the filetype of the file
func GetRules(buf *Buffer) ([]SyntaxRule, string) {
// FindFileType finds the filetype for the given buffer
func FindFileType(buf *Buffer) string {
for r := range syntaxFiles {
if r[0] != nil && r[0].MatchString(buf.Path) {
// Check if the syntax statement matches the extension
return LoadRulesFromFile(syntaxFiles[r].text, syntaxFiles[r].filename), syntaxFiles[r].filetype
// The syntax statement matches the extension
return syntaxFiles[r].filetype
} else if r[1] != nil && r[1].MatchString(buf.Line(0)) {
// Check if the header statement matches the first line
return LoadRulesFromFile(syntaxFiles[r].text, syntaxFiles[r].filename), syntaxFiles[r].filetype
// The header statement matches the first line
return syntaxFiles[r].filetype
}
}
return nil, "Unknown"
return "Unknown"
}
// GetRules finds the syntax rules that should be used for the buffer
// and returns them. It also returns the filetype of the file
func GetRules(buf *Buffer) []SyntaxRule {
for r := range syntaxFiles {
if syntaxFiles[r].filetype == buf.FileType() {
return LoadRulesFromFile(syntaxFiles[r].text, syntaxFiles[r].filename)
}
}
return nil
}
// SyntaxMatches is an alias to a map from character numbers to styles,
@@ -425,7 +435,7 @@ func Match(v *View) SyntaxMatches {
for i, line := range lines {
matches[i] = make([]tcell.Style, len(line)+1)
for j, _ := range matches[i] {
for j := range matches[i] {
matches[i][j] = defStyle
}
}

View File

@@ -210,7 +210,7 @@ func main() {
InitConfigDir()
// Load the user's settings
InitSettings()
InitGlobalSettings()
InitCommands()
InitBindings()
@@ -248,6 +248,14 @@ func main() {
tab := NewTabFromView(NewView(buf))
tab.SetNum(len(tabs))
tabs = append(tabs, tab)
for _, t := range tabs {
for _, v := range t.views {
v.Center(false)
if globalSettings["syntax"].(bool) {
v.matches = Match(v)
}
}
}
}
// Load all the plugin stuff
@@ -259,6 +267,7 @@ func main() {
L.SetGlobal("GetOption", luar.New(L, GetOption))
L.SetGlobal("AddOption", luar.New(L, AddOption))
L.SetGlobal("SetOption", luar.New(L, SetOption))
L.SetGlobal("SetLocalOption", luar.New(L, SetLocalOption))
L.SetGlobal("BindKey", luar.New(L, BindKey))
L.SetGlobal("MakeCommand", luar.New(L, MakeCommand))
L.SetGlobal("CurView", luar.New(L, CurView))
@@ -279,11 +288,14 @@ func main() {
for _, t := range tabs {
for _, v := range t.views {
_, err := Call("onBufferOpen", v.Buf)
if err != nil && !strings.HasPrefix(err.Error(), "function does not exist") {
TermMessage(err)
for _, pl := range loadedPlugins {
_, err := Call(pl+".onViewOpen", v)
if err != nil && !strings.HasPrefix(err.Error(), "function does not exist") {
TermMessage(err)
continue
}
}
if settings["syntax"].(bool) {
if v.Buf.Settings["syntax"].(bool) {
v.matches = Match(v)
}
}

View File

@@ -142,8 +142,11 @@ func LoadPlugins() {
}
if _, err := os.Stat(configDir + "/init.lua"); err == nil {
if err := L.DoFile(configDir + "/init.lua"); err != nil {
pluginDef := "\nlocal P = {}\n" + "init" + " = P\nsetmetatable(" + "init" + ", {__index = _G})\nsetfenv(1, P)\n"
data, _ := ioutil.ReadFile(configDir + "/init.lua")
if err := L.DoString(pluginDef + string(data)); err != nil {
TermMessage(err)
}
loadedPlugins = append(loadedPlugins, "init")
}
}

File diff suppressed because one or more lines are too long

View File

@@ -90,7 +90,7 @@ func Search(searchStr string, v *View, down bool) {
str = string([]rune(text)[:searchStart])
}
r, err := regexp.Compile(searchStr)
if settings["ignorecase"].(bool) {
if v.Buf.Settings["ignorecase"].(bool) {
r, err = regexp.Compile("(?i)" + searchStr)
}
if err != nil {

View File

@@ -7,14 +7,17 @@ import (
"os"
"reflect"
"strconv"
"strings"
"github.com/zyedidia/glob"
)
// The options that the user can set
var settings map[string]interface{}
var globalSettings map[string]interface{}
// InitSettings initializes the options map and sets all options to their default values
func InitSettings() {
defaults := DefaultSettings()
// InitGlobalSettings initializes the options map and sets all options to their default values
func InitGlobalSettings() {
defaults := DefaultGlobalSettings()
var parsed map[string]interface{}
filename := configDir + "/settings.json"
@@ -31,17 +34,57 @@ func InitSettings() {
}
}
settings = make(map[string]interface{})
globalSettings = make(map[string]interface{})
for k, v := range defaults {
settings[k] = v
globalSettings[k] = v
}
for k, v := range parsed {
settings[k] = v
if !strings.HasPrefix(reflect.TypeOf(v).String(), "map") {
globalSettings[k] = v
}
}
err := WriteSettings(filename)
if err != nil {
TermMessage("Error writing settings.json file: " + err.Error())
if _, err := os.Stat(filename); os.IsNotExist(err) {
err := WriteSettings(filename)
if err != nil {
TermMessage("Error writing settings.json file: " + err.Error())
}
}
}
// InitLocalSettings scans the json in settings.json and sets the options locally based
// on whether the buffer matches the glob
func InitLocalSettings(buf *Buffer) {
var parsed map[string]interface{}
filename := configDir + "/settings.json"
if _, e := os.Stat(filename); e == nil {
input, err := ioutil.ReadFile(filename)
if err != nil {
TermMessage("Error reading settings.json file: " + err.Error())
return
}
err = json.Unmarshal(input, &parsed)
if err != nil {
TermMessage("Error reading settings.json:", err.Error())
}
}
for k, v := range parsed {
if strings.HasPrefix(reflect.TypeOf(v).String(), "map") {
g, err := glob.Compile(k)
if err != nil {
TermMessage("Error with glob setting ", k, ": ", err)
continue
}
if g.MatchString(buf.Path) {
for k1, v1 := range v.(map[string]interface{}) {
buf.Settings[k1] = v1
}
}
}
}
}
@@ -49,7 +92,30 @@ func InitSettings() {
func WriteSettings(filename string) error {
var err error
if _, e := os.Stat(configDir); e == nil {
txt, _ := json.MarshalIndent(settings, "", " ")
var parsed map[string]interface{}
filename := configDir + "/settings.json"
if _, e := os.Stat(filename); e == nil {
input, err := ioutil.ReadFile(filename)
if err != nil {
return err
}
err = json.Unmarshal(input, &parsed)
if err != nil {
TermMessage("Error reading settings.json:", err.Error())
}
}
for k, v := range parsed {
if !strings.HasPrefix(reflect.TypeOf(v).String(), "map") {
if _, ok := globalSettings[k]; ok {
parsed[k] = globalSettings[k]
}
}
}
txt, _ := json.MarshalIndent(parsed, "", " ")
err = ioutil.WriteFile(filename, txt, 0644)
}
return err
@@ -57,20 +123,36 @@ func WriteSettings(filename string) error {
// AddOption creates a new option. This is meant to be called by plugins to add options.
func AddOption(name string, value interface{}) {
settings[name] = value
globalSettings[name] = value
err := WriteSettings(configDir + "/settings.json")
if err != nil {
TermMessage("Error writing settings.json file: " + err.Error())
}
}
// GetOption returns the specified option. This is meant to be called by plugins to add options.
// GetGlobalOption returns the global value of the given option
func GetGlobalOption(name string) interface{} {
return globalSettings[name]
}
// GetLocalOption returns the local value of the given option
func GetLocalOption(name string, buf *Buffer) interface{} {
return buf.Settings[name]
}
// GetOption returns the value of the given option
// If there is a local version of the option, it returns that
// otherwise it will return the global version
func GetOption(name string) interface{} {
return settings[name]
if GetLocalOption(name, CurView().Buf) != nil {
return GetLocalOption(name, CurView().Buf)
}
return GetGlobalOption(name)
}
// DefaultSettings returns the default settings for micro
func DefaultSettings() map[string]interface{} {
// Note that colorscheme is a global only option
func DefaultGlobalSettings() map[string]interface{} {
return map[string]interface{}{
"autoindent": true,
"colorscheme": "monokai",
@@ -89,27 +171,55 @@ func DefaultSettings() map[string]interface{} {
}
}
// DefaultLocalSettings returns the default local settings
// Note that filetype is a local only option
func DefaultLocalSettings() map[string]interface{} {
return map[string]interface{}{
"autoindent": true,
"cursorline": false,
"filetype": "Unknown",
"ignorecase": false,
"indentchar": " ",
"ruler": true,
"savecursor": false,
"saveundo": false,
"scrollspeed": float64(2),
"scrollmargin": float64(3),
"statusline": true,
"syntax": true,
"tabsize": float64(4),
"tabstospaces": false,
}
}
// SetOption attempts to set the given option to the value
// By default it will set the option as global, but if the option
// is local only it will set the local version
// Use setlocal to force an option to be set locally
func SetOption(option, value string) error {
if _, ok := settings[option]; !ok {
return errors.New("Invalid option")
if _, ok := globalSettings[option]; !ok {
if _, ok := CurView().Buf.Settings[option]; !ok {
return errors.New("Invalid option")
}
SetLocalOption(option, value, CurView())
return nil
}
kind := reflect.TypeOf(settings[option]).Kind()
kind := reflect.TypeOf(globalSettings[option]).Kind()
if kind == reflect.Bool {
b, err := ParseBool(value)
if err != nil {
return errors.New("Invalid value")
}
settings[option] = b
globalSettings[option] = b
} else if kind == reflect.String {
settings[option] = value
globalSettings[option] = value
} else if kind == reflect.Float64 {
i, err := strconv.Atoi(value)
if err != nil {
return errors.New("Invalid value")
}
settings[option] = float64(i)
globalSettings[option] = float64(i)
}
if option == "colorscheme" {
@@ -117,20 +227,17 @@ func SetOption(option, value string) error {
for _, tab := range tabs {
for _, view := range tab.views {
view.Buf.UpdateRules()
if settings["syntax"].(bool) {
if view.Buf.Settings["syntax"].(bool) {
view.matches = Match(view)
}
}
}
}
if option == "statusline" {
if _, ok := CurView().Buf.Settings[option]; ok {
for _, tab := range tabs {
for _, view := range tab.views {
view.ToggleStatusLine()
if settings["syntax"].(bool) {
view.matches = Match(view)
}
SetLocalOption(option, value, view)
}
}
}
@@ -138,6 +245,48 @@ func SetOption(option, value string) error {
return nil
}
// SetLocalOption sets the local version of this option
func SetLocalOption(option, value string, view *View) error {
buf := view.Buf
if _, ok := buf.Settings[option]; !ok {
return errors.New("Invalid option")
}
kind := reflect.TypeOf(buf.Settings[option]).Kind()
if kind == reflect.Bool {
b, err := ParseBool(value)
if err != nil {
return errors.New("Invalid value")
}
buf.Settings[option] = b
} else if kind == reflect.String {
buf.Settings[option] = value
} else if kind == reflect.Float64 {
i, err := strconv.Atoi(value)
if err != nil {
return errors.New("Invalid value")
}
buf.Settings[option] = float64(i)
}
if option == "statusline" {
view.ToggleStatusLine()
if buf.Settings["syntax"].(bool) {
view.matches = Match(view)
}
}
if option == "filetype" {
LoadSyntaxFiles()
buf.UpdateRules()
if buf.Settings["syntax"].(bool) {
view.matches = Match(view)
}
}
return nil
}
// SetOptionAndSettings sets the given option and saves the option setting to the settings config file
func SetOptionAndSettings(option, value string) {
filename := configDir + "/settings.json"
@@ -145,7 +294,7 @@ func SetOptionAndSettings(option, value string) {
err := SetOption(option, value)
if err != nil {
messenger.Message(err.Error())
messenger.Error(err.Error())
return
}

View File

@@ -148,7 +148,7 @@ func (s *SplitTree) ResizeSplits() {
}
// n.view.ToggleStatusLine()
_, screenH := screen.Size()
if settings["statusline"].(bool) || (n.view.y+n.view.height) != screenH-1 {
if n.view.Buf.Settings["statusline"].(bool) || (n.view.y+n.view.height) != screenH-1 {
n.view.height--
}

View File

@@ -34,7 +34,7 @@ func (sline *Statusline) Display() {
file += " (" + lineNum + "," + columnNum + ")"
// Add the filetype
file += " " + sline.view.Buf.FileType
file += " " + sline.view.Buf.FileType()
rightText := helpBinding + " for help "
if sline.view.Help {

View File

@@ -152,20 +152,20 @@ func GetModTime(path string) (time.Time, bool) {
}
// StringWidth returns the width of a string where tabs count as `tabsize` width
func StringWidth(str string) int {
func StringWidth(str string, tabsize int) int {
sw := runewidth.StringWidth(str)
sw += NumOccurences(str, '\t') * (int(settings["tabsize"].(float64)) - 1)
sw += NumOccurences(str, '\t') * (tabsize - 1)
return sw
}
// WidthOfLargeRunes searches all the runes in a string and counts up all the widths of runes
// that have a width larger than 1 (this also counts tabs as `tabsize` width)
func WidthOfLargeRunes(str string) int {
func WidthOfLargeRunes(str string, tabsize int) int {
count := 0
for _, ch := range str {
var w int
if ch == '\t' {
w = int(settings["tabsize"].(float64))
w = tabsize
} else {
w = runewidth.RuneWidth(ch)
}

View File

@@ -107,15 +107,23 @@ func NewViewWidthHeight(buf *Buffer, w, h int) *View {
view: v,
}
if settings["statusline"].(bool) {
if v.Buf.Settings["statusline"].(bool) {
v.height--
}
for _, pl := range loadedPlugins {
_, err := Call(pl+".onViewOpen", v)
if err != nil && !strings.HasPrefix(err.Error(), "function does not exist") {
TermMessage(err)
continue
}
}
return v
}
func (v *View) ToggleStatusLine() {
if settings["statusline"].(bool) {
if v.Buf.Settings["statusline"].(bool) {
v.height--
} else {
v.height++
@@ -236,7 +244,7 @@ func (v *View) VSplit(buf *Buffer) bool {
func (v *View) Relocate() bool {
ret := false
cy := v.Cursor.Y
scrollmargin := int(settings["scrollmargin"].(float64))
scrollmargin := int(v.Buf.Settings["scrollmargin"].(float64))
if cy < v.Topline+scrollmargin && cy > scrollmargin-1 {
v.Topline = cy - scrollmargin
ret = true
@@ -313,7 +321,7 @@ func (v *View) HandleEvent(event tcell.Event) {
v.Cursor.Right()
for _, pl := range loadedPlugins {
_, err := Call(pl+".onRune", string(e.Rune()))
_, err := Call(pl+".onRune", string(e.Rune()), v)
if err != nil && !strings.HasPrefix(err.Error(), "function does not exist") {
TermMessage(err)
}
@@ -408,11 +416,11 @@ func (v *View) HandleEvent(event tcell.Event) {
}
case tcell.WheelUp:
// Scroll up
scrollspeed := int(settings["scrollspeed"].(float64))
scrollspeed := int(v.Buf.Settings["scrollspeed"].(float64))
v.ScrollUp(scrollspeed)
case tcell.WheelDown:
// Scroll down
scrollspeed := int(settings["scrollspeed"].(float64))
scrollspeed := int(v.Buf.Settings["scrollspeed"].(float64))
v.ScrollDown(scrollspeed)
}
}
@@ -420,7 +428,7 @@ func (v *View) HandleEvent(event tcell.Event) {
if relocate {
v.Relocate()
}
if settings["syntax"].(bool) {
if v.Buf.Settings["syntax"].(bool) {
v.matches = Match(v)
}
}
@@ -486,7 +494,7 @@ func (v *View) DisplayView() {
// We are going to have to offset by that amount
maxLineLength := len(strconv.Itoa(v.Buf.NumLines))
if settings["ruler"] == true {
if v.Buf.Settings["ruler"] == true {
// + 1 for the little space after the line number
v.lineNumOffset = maxLineLength + 1
} else {
@@ -585,7 +593,7 @@ func (v *View) DisplayView() {
}
}
if settings["ruler"] == true {
if v.Buf.Settings["ruler"] == true {
// Write the line number
lineNumStyle := defStyle
if style, ok := colorscheme["line-number"]; ok {
@@ -620,7 +628,7 @@ func (v *View) DisplayView() {
for _, ch := range line {
lineStyle := defStyle
if settings["syntax"].(bool) {
if v.Buf.Settings["syntax"].(bool) {
// Syntax highlighting is enabled
highlightStyle = v.matches[viewLine][colN]
}
@@ -640,7 +648,7 @@ func (v *View) DisplayView() {
// We need to display the background of the linestyle with the correct color if cursorline is enabled
// and this is the current view and there is no selection on this line and the cursor is on this line
if settings["cursorline"].(bool) && tabs[curTab].curView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN {
if v.Buf.Settings["cursorline"].(bool) && tabs[curTab].curView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN {
if style, ok := colorscheme["cursor-line"]; ok {
fg, _, _ := style.Decompose()
lineStyle = lineStyle.Background(fg)
@@ -666,19 +674,19 @@ func (v *View) DisplayView() {
lineIndentStyle = style
}
}
if settings["cursorline"].(bool) && tabs[curTab].curView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN {
if v.Buf.Settings["cursorline"].(bool) && tabs[curTab].curView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN {
if style, ok := colorscheme["cursor-line"]; ok {
fg, _, _ := style.Decompose()
lineIndentStyle = lineIndentStyle.Background(fg)
}
}
// Here we get the indent char
indentChar := []rune(settings["indentchar"].(string))
indentChar := []rune(v.Buf.Settings["indentchar"].(string))
if screenX-v.x-v.leftCol >= v.lineNumOffset {
v.drawCell(screenX-v.leftCol, screenY, indentChar[0], nil, lineIndentStyle)
}
// Now the tab has to be displayed as a bunch of spaces
tabSize := int(settings["tabsize"].(float64))
tabSize := int(v.Buf.Settings["tabsize"].(float64))
for i := 0; i < tabSize-1; i++ {
screenX++
if screenX-v.x-v.leftCol >= v.lineNumOffset {
@@ -725,7 +733,7 @@ func (v *View) DisplayView() {
for i := 0; i < v.width; i++ {
lineStyle := defStyle
if settings["cursorline"].(bool) && tabs[curTab].curView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN {
if v.Buf.Settings["cursorline"].(bool) && tabs[curTab].curView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN {
if style, ok := colorscheme["cursor-line"]; ok {
fg, _, _ := style.Decompose()
lineStyle = lineStyle.Background(fg)
@@ -755,7 +763,7 @@ func (v *View) Display() {
v.DisplayCursor()
}
_, screenH := screen.Size()
if settings["statusline"].(bool) {
if v.Buf.Settings["statusline"].(bool) {
v.sline.Display()
} else if (v.y + v.height) != screenH-1 {
for x := 0; x < v.width; x++ {

View File

@@ -15,8 +15,11 @@ Here are the possible commands that you can use.
Note that `search` must be a valid regex. If one of the arguments
does not have any spaces in it, you may omit the quotes.
* `set option value`: sets the option to value. Please see the next section for
a list of options you can set.
* `set option value`: sets the option to value. See the `options` help topic
for a list of options you can set.
* `setlocal option value`: sets the option to value locally (only in the current
buffer).
* `run sh-command`: runs the given shell command in the background. The
command's output will be displayed in one line when it finishes running.

View File

@@ -10,6 +10,7 @@ Here are the options that you can set:
* `colorscheme`: loads the colorscheme stored in
$(configDir)/colorschemes/`option`.micro
This setting is `global only`.
default value: `default`
Note that the default colorschemes (default, solarized, and solarized-tc)
@@ -43,6 +44,10 @@ Here are the options that you can set:
default value: ` `
* `filetype`: sets the filetype for the current buffer. This setting is `local only`
default value: this will be automatically set depending on the file you have open
* `ignorecase`: perform case-insensitive searches
default value: `off`
@@ -116,3 +121,32 @@ Any option you set in the editor will be saved to the file
~/.config/micro/settings.json so, in effect, your configuration file will be
created for you. If you'd like to take your configuration with you to another
machine, simply copy the settings.json to the other machine.
# Global and local settings
You can set these settings either globally or locally. Locally means that the setting
won't be saved to `~/.config/micro/settings.json` and that it will only be set in
the current buffer. Setting an option globally is the default, and will set the option
in all buffers.
The `colorscheme` option is global only, and the `filetype` option is local only. To
set an option locally, use `setlocal` instead of `set`.
In the `settings.json` file you can also put set options locally by specifying a glob.
Here is an example which has `tabstospaces` on for all files except Go files, and
`tabsize` 4 for all files except Ruby files:
```
{
"*.go": {
"tabstospaces": false
},
"*.rb": {
"tabsize": 2
}
"tabstospaces": true,
"tabsize": 4,
}
```
As you can see it is quite easy to set options locally using the `settings.json` file.

View File

@@ -6,16 +6,19 @@ main script which is run at startup which should be placed in
There are a number of callback functions which you can create in your
plugin to run code at times other than startup. The naming scheme is
`onAction()`. For example a function which is run every time the user saves
`onAction(view)`. For example a function which is run every time the user saves
the buffer would be:
```lua
function onSave()
function onSave(view)
...
return false
end
```
The `view` variable is a reference to the view the action is being executed on.
This is almost always the current view, which you can get with `CurView()` as well.
All available actions are listed in the keybindings section of the help.
These functions should also return a boolean specifying whether the view
@@ -26,48 +29,59 @@ want a callback before the action is executed, use `preAction()`. In this case
the boolean returned specifies whether or not the action should be executed
after the lua code completes.
Another useful callback to know about which is not a action is
`onViewOpen(view)` which is called whenever a new view is opened and the new
view is passed in. This is useful for setting local options based on the filetype,
for example turning off `tabstospaces` only for Go files when they are opened.
---
There are a number of functions and variables that are available to you in
oder to access the inner workings of micro. Here is a list (the type signatures
for functions are given using Go's type system):
* OS: variable which gives the OS micro is currently running on (this is the same
* `OS`: variable which gives the OS micro is currently running on (this is the same
as Go's GOOS variable, so `darwin`, `windows`, `linux`, `freebsd`...)
* tabs: a list of all the tabs currently in use
* `tabs`: a list of all the tabs currently in use
* curTab: the index of the current tabs in the tabs list
* `curTab`: the index of the current tabs in the tabs list
* messenger: lets you send messages to the user or create prompts
* `messenger`: lets you send messages to the user or create prompts
* GetOption(name string): returns the value of the requested option
* `GetOption(name string)`: returns the value of the requested option
* AddOption(name string, value interface{}): sets the given option with the given
value (`interface{}` means any type in Go).
* `AddOption(name string, value interface{})`: sets the given option with the given
value (`interface{}` means any type in Go).
* BindKey(key, action string): binds `key` to `action`.
* `SetOption(option, value string)`: sets the given option to the value. This will
set the option globally, unless it is a local only option.
* MakeCommand(name, function string, completions ...Completion):
creates a command with `name` which will call `function` when executed.
Use 0 for completions to get NoCompletion.
* `SetLocalOption(option, value string, buffer *Buffer)`: sets the given option to
the value locally in the given buffer.
* CurView(): returns the current view
* `BindKey(key, action string)`: binds `key` to `action`.
* HandleCommand(cmd string): runs the given command
* `MakeCommand(name, function string, completions ...Completion)`:
creates a command with `name` which will call `function` when executed.
Use 0 for completions to get NoCompletion.
* HandleShellCommand(shellCmd string, interactive bool): runs the given shell
command
* `CurView()`: returns the current view
* JobStart(cmd string, onStdout, onStderr, onExit string, userargs ...string):
Starts running the given shell command in the background. `onStdout` `onStderr` and `onExit`
are callbacks to lua functions which will be called when the given actions happen
to the background process.
`userargs` are the arguments which will get passed to the callback functions
* `HandleCommand(cmd string)`: runs the given command
* JobSend(cmd *exec.Cmd, data string): send a string into the stdin of the job process
* `HandleShellCommand(shellCmd string, interactive bool)`: runs the given shell
command
* JobStop(cmd *exec.Cmd): kill a job
* `JobStart(cmd string, onStdout, onStderr, onExit string, userargs ...string)`:
Starts running the given shell command in the background. `onStdout` `onStderr` and `onExit`
are callbacks to lua functions which will be called when the given actions happen
to the background process.
`userargs` are the arguments which will get passed to the callback functions
* `JobSend(cmd *exec.Cmd, data string)`: send a string into the stdin of the job process
* `JobStop(cmd *exec.Cmd)`: kill a job
This may seem like a small list of available functions but some of the objects
returned by the functions have many methods. `CurView()` returns a view object

View File

@@ -9,12 +9,11 @@ end
local autoclosePairs = {"\"\"", "''", "()", "{}", "[]"}
local autoNewlinePairs = {"()", "{}", "[]"}
function onRune(r)
function onRune(r, v)
if not GetOption("autoclose") then
return
end
local v = CurView()
for i = 1, #autoclosePairs do
if r == charAt(autoclosePairs[i], 2) then
local curLine = v.Buf:Line(v.Cursor.Y)
@@ -43,12 +42,11 @@ function onRune(r)
end
end
function preInsertNewline()
function preInsertNewline(v)
if not GetOption("autoclose") then
return
end
local v = CurView()
local curLine = v.Buf:Line(v.Cursor.Y)
local curRune = charAt(curLine, v.Cursor.X)
local nextRune = charAt(curLine, v.Cursor.X+1)
@@ -68,13 +66,11 @@ function preInsertNewline()
return true
end
function preBackspace()
function preBackspace(v)
if not GetOption("autoclose") then
return
end
local v = CurView()
for i = 1, #autoclosePairs do
local curLine = v.Buf:Line(v.Cursor.Y)
if charAt(curLine, v.Cursor.X+1) == charAt(autoclosePairs[i], 2) and charAt(curLine, v.Cursor.X) == charAt(autoclosePairs[i], 1) then

View File

@@ -5,15 +5,17 @@ if GetOption("gofmt") == nil then
AddOption("gofmt", true)
end
if CurView().Buf.FileType == "Go" then
SetOption("tabstospaces", "off")
end
MakeCommand("goimports", "go.goimports", 0)
MakeCommand("gofmt", "go.gofmt", 0)
function onSave()
if CurView().Buf.FileType == "Go" then
function onViewOpen(view)
if view.Buf:FileType() == "go" then
SetLocalOption("tabstospaces", "off", view)
end
end
function onSave(view)
if CurView().Buf:FileType() == "go" then
if GetOption("goimports") then
goimports()
elseif GetOption("gofmt") then

View File

@@ -6,31 +6,31 @@ MakeCommand("lint", "linter.runLinter", 0)
function runLinter()
CurView():Save(false)
local ft = CurView().Buf.FileType
local ft = CurView().Buf:FileType()
local file = CurView().Buf.Path
local devnull = "/dev/null"
if OS == "windows" then
devnull = "NUL"
end
if ft == "Go" then
if ft == "go" then
lint("gobuild", "go build -o " .. devnull, "%f:%l: %m")
lint("golint", "golint " .. CurView().Buf.Path, "%f:%l:%d+: %m")
elseif ft == "Lua" then
elseif ft == "lua" then
lint("luacheck", "luacheck --no-color " .. file, "%f:%l:%d+: %m")
elseif ft == "Python" then
elseif ft == "python" then
lint("pyflakes", "pyflakes " .. file, "%f:%l: %m")
elseif ft == "C" then
elseif ft == "c" then
lint("gcc", "gcc -fsyntax-only -Wall -Wextra " .. file, "%f:%l:%d+:.+: %m")
elseif ft == "D" then
elseif ft == "d" then
lint("dmd", "dmd -color=off -o- -w -wi -c " .. file, "%f%(%l%):.+: %m")
elseif ft == "Java" then
elseif ft == "java" then
lint("javac", "javac " .. file, "%f:%l: error: %m")
elseif ft == "JavaScript" then
elseif ft == "javascript" then
lint("jshint", "jshint " .. file, "%f: line %l,.+, %m")
end
end
function onSave()
function onSave(view)
if GetOption("linter") then
runLinter()
else

View File

@@ -1,5 +1,5 @@
## Syntax highlighting for Dockerfiles
syntax "Dockerfile" "Dockerfile[^/]*$" "\.dockerfile$"
syntax "dockerfile" "Dockerfile[^/]*$" "\.dockerfile$"
## Keywords
red (i) "^(FROM|MAINTAINER|RUN|CMD|LABEL|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD)[[:space:]]"

View File

@@ -1,5 +1,5 @@
# Apache files
syntax "Apacheconf" "httpd\.conf|mime\.types|vhosts\.d\\*|\.htaccess"
syntax "apacheconf" "httpd\.conf|mime\.types|vhosts\.d\\*|\.htaccess"
color yellow ".+"
color brightcyan "(AcceptMutex|AcceptPathInfo|AccessFileName|Action|AddAlt|AddAltByEncoding|AddAltByType|AddCharset|AddDefaultCharset|AddDescription|AddEncoding)"
color brightcyan "(AddHandler|AddIcon|AddIconByEncoding|AddIconByType|AddInputFilter|AddLanguage|AddModuleInfo|AddOutputFilter|AddOutputFilterByType|AddType|Alias|AliasMatch)"

View File

@@ -26,7 +26,7 @@
## /usr/share/nano/arduino.nanorc
## ...
syntax "INO" "\.?ino$"
syntax "ino" "\.?ino$"
##
color brightred "\<[A-Z_][0-9A-Z_]+\>"

View File

@@ -1,4 +1,4 @@
syntax "AsciiDoc" "\.(asc|asciidoc|adoc)$"
syntax "asciidoc" "\.(asc|asciidoc|adoc)$"
# main header
color red "^====+$"

View File

@@ -1,6 +1,6 @@
## Here is an example for assembler.
##
syntax "ASM" "\.(S|s|asm)$"
syntax "asm" "\.(S|s|asm)$"
color red "\<[A-Z_]{2,}\>"
color brightgreen "\.(data|subsection|text)"
color green "\.(align|file|globl|global|hidden|section|size|type|weak)"

View File

@@ -1,4 +1,4 @@
syntax "AWK" "\.awk$"
syntax "awk" "\.awk$"
header "^#!.*bin/(env +)?awk( |$)"
color brightyellow "\$[A-Za-z0-9_!@#$*?-]+"

View File

@@ -1,6 +1,6 @@
## Here is an example for C/C++.
##
syntax "C" "\.(c(c|pp|xx)?|C)$" "\.(h(h|pp|xx)?|H)$" "\.ii?$" "\.(def)$"
syntax "c" "\.(c(c|pp|xx)?|C)$" "\.(h(h|pp|xx)?|H)$" "\.ii?$" "\.(def)$"
color identifier "\b[A-Z_][0-9A-Z_]+\b"
color type "\b(float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\b"
color type "\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\b"

View File

@@ -1,6 +1,6 @@
## CMake syntax highlighter for GNU Nano
##
syntax "CMake" "(CMakeLists\.txt|\.cmake)$"
syntax "cmake" "(CMakeLists\.txt|\.cmake)$"
green (i) "^[[:space:]]*[A-Z0-9_]+"
brightyellow (i) "^[[:space:]]*(include|include_directories|include_external_msproject)\>"

View File

@@ -1,4 +1,4 @@
syntax "CoffeeScript" "\.coffee$"
syntax "coffeescript" "\.coffee$"
header "^#!.*/(env +)?coffee"
color red "[!&|=/*+-<>]|\<(and|or|is|isnt|not)\>"

View File

@@ -1,4 +1,4 @@
syntax "colorTest" "ColorTest$"
syntax "colortest" "ColorTest$"
color black "\<PLAIN\>"

View File

@@ -1,6 +1,6 @@
## Here is an example for nanorc files.
##
syntax "Conf" "\.c[o]?nf$"
syntax "conf" "\.c[o]?nf$"
## Possible errors and parameters
## Strings
white (i) ""(\\.|[^"])*""

View File

@@ -2,7 +2,7 @@
## Syntax highlighting for conkyrc files.
##
##
syntax "Conky" "(\.*conkyrc.*$|conky.conf)"
syntax "conky" "(\.*conkyrc.*$|conky.conf)"
## Configuration items
color green "\<(alignment|append_file|background|border_inner_margin|border_outer_margin|border_width|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|colorN|cpu_avg_samples|default_bar_height|default_bar_width|default_color|default_gauge_height|default_gauge_width|default_graph_height|default_graph_width|default_outline_color|default_shade_color|diskio_avg_samples|display|double_buffer|draw_borders|draw_graph_borders|draw_outline|draw_shades|extra_newline|font|format_human_readable|gap_x|gap_y|http_refresh|if_up_strictness|imap|imlib_cache_flush_interval|imlib_cache_size|lua_draw_hook_post|lua_draw_hook_pre|lua_load|lua_shutdown_hook|lua_startup_hook|mail_spool|max_port_monitor_connections|max_text_width|max_user_text|maximum_width|minimum_height|minimum_width|mpd_host|mpd_password|mpd_port|music_player_interval|mysql_host|mysql_port|mysql_user|mysql_password|mysql_db|net_avg_samples|no_buffers|nvidia_display|out_to_console|out_to_http|out_to_ncurses|out_to_stderr|out_to_x|override_utf8_locale|overwrite_file|own_window|own_window_class|own_window_colour|own_window_hints|own_window_title|own_window_transparent|own_window_type|pad_percents|pop3|sensor_device|short_units|show_graph_range|show_graph_scale|stippled_borders|temperature_unit|template|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|text|text_buffer_size|times_in_seconds|top_cpu_separate|top_name_width|total_run_times|update_interval|update_interval_on_battery|uppercase|use_spacer|use_xft|xftalpha|xftfont)\>"

View File

@@ -1,4 +1,4 @@
syntax "C#" "\.cs$"
syntax "c#" "\.cs$"
# Class
color brightmagenta "class +[A-Za-z0-9]+ *((:) +[A-Za-z0-9.]+)?"

View File

@@ -1,6 +1,6 @@
## Cython nanorc, based off of Python nanorc.
##
syntax "Cython" "\.pyx$" "\.pxd$" "\.pyi$"
syntax "cython" "\.pyx$" "\.pxd$" "\.pyi$"
brightred (i) "def [ 0-9A-Z_]+"
brightred (i) "cpdef [0-9A-Z_]+\(.*\):"
brightred (i) "cdef cppclass [ 0-9A-Z_]+\(.*\):"

View File

@@ -3,7 +3,7 @@
## Author: Andrei Vinokurov
## Based on D lexer specification (http://dlang.org/lex)
syntax "D" "\.(d(i|d)?)$"
syntax "d" "\.(d(i|d)?)$"
## Operators and punctuation
color statement "(\*|/|%|\+|-|>>|<<|>>>|&|\^(\^)?|\||~)?="

View File

@@ -1,4 +1,4 @@
syntax "DOT" "\.(dot|gv)$"
syntax "dot" "\.(dot|gv)$"
color cyan "\<(digraph|edge|graph|node|subgraph)\>"
color magenta "\<(arrowhead|arrowsize|arrowtail|bgcolor|center|color|constraint|decorateP|dir|distortion|fillcolor|fontcolor|fontname|fontsize|headclip|headlabel|height|labelangle|labeldistance|labelfontcolor|labelfontname|labelfontsize|label|layers|layer|margin|mclimit|minlen|name|nodesep|nslimit|ordering|orientation|pagedir|page|peripheries|port_label_distance|rankdir|ranksep|rank|ratio|regular|rotate|samehead|sametail|shapefile|shape|sides|size|skew|style|tailclip|taillabel|URL|weight|width)\>"

View File

@@ -4,7 +4,7 @@
##
## https://github.com/geomic/ERB-And-More-Code-Highlighting-for-nano
syntax "ERB" "\.erb$" "\.rhtml$"
syntax "erb" "\.erb$" "\.rhtml$"
color blue start="<" end=">"
color white start="<%" end="%>"
color red "&[^;[[:space:]]]*;"

View File

@@ -1,6 +1,6 @@
## Here is an example for Fortran 90/95
syntax "Fortran" "\.([Ff]|[Ff]90|[Ff]95|[Ff][Oo][Rr])$"
syntax "fortran" "\.([Ff]|[Ff]90|[Ff]95|[Ff][Oo][Rr])$"
#color red "\<[A-Z_]a[0-9A-Z_]+\>"
color red "\<[0-9]+\>"

View File

@@ -1,6 +1,6 @@
## GDScript syntax file, based on Python syntax file.
##
syntax "GDScript" "\.gd$"
syntax "gdscript" "\.gd$"
## built-in objects
color constant "\b(null|self|true|false)\b"

View File

@@ -1,6 +1,6 @@
## Here is an example for ebuilds/eclasses
##
syntax "Ebuild" "\.e(build|class)$"
syntax "ebuild" "\.e(build|class)$"
## All the standard portage functions
color brightgreen "^src_(unpack|compile|install|test)" "^pkg_(config|nofetch|setup|(pre|post)(inst|rm))"
## Highlight bash related syntax

View File

@@ -1,4 +1,4 @@
syntax "GLSL" "\.(frag|vert|fp|vp|glsl)$"
syntax "glsl" "\.(frag|vert|fp|vp|glsl)$"
color brightblue "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"
color green "\<(void|bool|bvec2|bvec3|bvec4|int|ivec2|ivec3|ivec4|float|vec2|vec3|vec4|mat2|mat3|mat4|struct|sampler1D|sampler2D|sampler3D|samplerCUBE|sampler1DShadow|sampler2DShadow)\>"

View File

@@ -1,4 +1,4 @@
syntax "Go" "\.go$"
syntax "go" "\.go$"
color statement "\b(append|cap|close|complex|copy|delete|imag|len)\b"
color statement "\b(make|new|panic|print|println|protect|real|recover)\b"

View File

@@ -1,4 +1,4 @@
syntax "Golo" "\.golo$"
syntax "golo" "\.golo$"
color type "\b(function|fun|)\b"
color type "\b(struct|DynamicObject|union|AdapterFabric|Adapter|DynamicVariable|Observable)\b"

View File

@@ -1,6 +1,6 @@
## Here is an example for groff.
##
syntax "Groff" "\.m[ems]$" "\.rof" "\.tmac$" "^tmac."
syntax "groff" "\.m[ems]$" "\.rof" "\.tmac$" "^tmac."
## The argument of .ds or .nr
color cyan "^\.(ds|nr) [^[[:space:]]]*"
## Single character escapes

View File

@@ -1,4 +1,4 @@
syntax "Haml" "\.haml$"
syntax "haml" "\.haml$"
color cyan "-|="
color white "->|=>"

View File

@@ -1,4 +1,4 @@
syntax "Haskell" "\.hs$"
syntax "haskell" "\.hs$"
## Keywords
color red "[ ](as|case|of|class|data|default|deriving|do|forall|foreign|hiding|if|then|else|import|infix|infixl|infixr|instance|let|in|mdo|module|newtype|qualified|type|where)[ ]"

View File

@@ -1,6 +1,6 @@
## Here is a short improved example for HTML.
##
syntax "HTML" "\.htm[l]?$"
syntax "html" "\.htm[l]?$"
color identifier start="<" end=">"
color special "&[^;[[:space:]]]*;"
color constant ""[^"]*"|qq\|.*\|"

View File

@@ -1,4 +1,4 @@
syntax "INI" "\.(ini|desktop|lfl|override)$" "(mimeapps\.list|pinforc|setup\.cfg)$" "weechat/.+\.conf$"
syntax "ini" "\.(ini|desktop|lfl|override)$" "(mimeapps\.list|pinforc|setup\.cfg)$" "weechat/.+\.conf$"
header "^\[[A-Za-z]+\]$"
color brightcyan "\<(true|false)\>"

View File

@@ -1,4 +1,4 @@
syntax "Inputrc" "inputrc$"
syntax "inputrc" "inputrc$"
color red "\<(off|none)\>"
color green "\<on\>"

View File

@@ -1,6 +1,6 @@
## Here is an example for Java.
##
syntax "Java" "\.java$"
syntax "java" "\.java$"
color type "\b(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\b"
color statement "\b(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\b"
color type "\b(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\b"

View File

@@ -1,4 +1,4 @@
syntax "JavaScript" "\.js$"
syntax "javascript" "\.js$"
color blue "\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\b"
color blue "\b[-+]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"

View File

@@ -1,4 +1,4 @@
syntax "JSON" "\.json$"
syntax "json" "\.json$"
header "^\{$"
color blue "\<[-]?[1-9][0-9]*([Ee][+-]?[0-9]+)?\>" "\<[-]?[0](\.[0-9]+)?\>"

View File

@@ -1,4 +1,4 @@
syntax "Keymap" "\.(k|key)?map$|Xmodmap$"
syntax "keymap" "\.(k|key)?map$|Xmodmap$"
color cyan "\<(add|clear|compose|keycode|keymaps|keysym|remove|string)\>"
color cyan "\<(control|alt|shift)\>"

View File

@@ -1,4 +1,4 @@
syntax "KickStart" "\.ks$" "\.kickstart$"
syntax "kickstart" "\.ks$" "\.kickstart$"
color brightmagenta "%[a-z]+"
color cyan "^[[:space:]]*(install|cdrom|text|graphical|volgroup|logvol|reboot|timezone|lang|keyboard|authconfig|firstboot|rootpw|user|firewall|selinux|repo|part|partition|clearpart|bootloader)"

View File

@@ -1,4 +1,4 @@
syntax "Ledger" "(^|\.|/)ledger|ldgr|beancount|bnct$"
syntax "ledger" "(^|\.|/)ledger|ldgr|beancount|bnct$"
color brightmagenta "^([0-9]{4}(/|-)[0-9]{2}(/|-)[0-9]{2}|[=~]) .*"
color blue "^[0-9]{4}(/|-)[0-9]{2}(/|-)[0-9]{2}"

View File

@@ -1,4 +1,4 @@
syntax "Lisp" "(emacs|zile)$" "\.(el|li?sp|scm|ss)$"
syntax "lisp" "(emacs|zile)$" "\.(el|li?sp|scm|ss)$"
color brightblue "\([a-z-]+"
color red "\(([-+*/<>]|<=|>=)|'"

View File

@@ -12,7 +12,7 @@
# Automatically use for '.lua' files
syntax "Lua" ".*\.lua$"
syntax "lua" ".*\.lua$"
# Operators
color statement ":|\*\*|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\b(not|and|or)\b"

View File

@@ -1,4 +1,4 @@
syntax "Makefile" "([Mm]akefile|\.ma?k)$"
syntax "makefile" "([Mm]akefile|\.ma?k)$"
header "^#!.*/(env +)?[bg]?make( |$)"
color preproc "\<(ifeq|ifdef|ifneq|ifndef|else|endif)\>"

View File

@@ -1,6 +1,6 @@
## Here is an example for manpages.
##
syntax "Man" "\.[1-9]x?$"
syntax "man" "\.[1-9]x?$"
color green "\.(S|T)H.*$"
color brightgreen "\.(S|T)H" "\.TP"
color brightred "\.(BR?|I[PR]?).*$"

View File

@@ -1,4 +1,4 @@
syntax "Markdown" "\.(md|mkd|mkdn|markdown)$"
syntax "markdown" "\.(md|mkd|mkdn|markdown)$"
# Tables (Github extension)
color type ".*[ :]\|[ :].*"

View File

@@ -1,4 +1,4 @@
syntax "MPD" "mpd\.conf$"
syntax "mpd" "mpd\.conf$"
color cyan "\<(user|group|bind_to_address|host|port|plugin|name|type)\>"
color cyan "\<((music|playlist)_directory|(db|log|state|pid|sticker)_file)\>"

View File

@@ -1,6 +1,6 @@
## Here is an example for nanorc files.
##
syntax "Nanorc" "\.?nanorc$"
syntax "nanorc" "\.?nanorc$"
## Possible errors and parameters
brightwhite (i) "^[[:space:]]*((un)?set|include|syntax|i?color).*$"
## Keywords

View File

@@ -1,4 +1,4 @@
syntax "Nginx" "nginx.*\.conf$" "\.nginx$"
syntax "nginx" "nginx.*\.conf$" "\.nginx$"
header "^(server|upstream)[a-z ]*\{$"
color brightmagenta "\<(events|server|http|location|upstream)[[:space:]]*\{"

View File

@@ -1,4 +1,4 @@
syntax "OCaml" "\.mli?$"
syntax "ocaml" "\.mli?$"
#uid
color red "\<[A-Z][0-9a-z_]{2,}\>"
#declarations

View File

@@ -1,6 +1,6 @@
## Here is an example for patch files.
##
syntax "Patch" "\.(patch|diff)$"
syntax "patch" "\.(patch|diff)$"
color brightgreen "^\+.*"
color green "^\+\+\+.*"
color brightblue "^ .*"

View File

@@ -1,4 +1,4 @@
syntax "PEG" "\.l?peg$"
syntax "peg" "\.l?peg$"
color cyan "^[[:space:]]*[A-Za-z][A-Za-z0-9_]*[[:space:]]*<-"
color blue "\^[+-]?[0-9]+"

View File

@@ -1,6 +1,6 @@
## Here is an example for Perl.
##
syntax "Perl" "\.p[lm]$"
syntax "perl" "\.p[lm]$"
header "^#!.*/(env +)?perl( |$)"
color red "\<(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(dir)?)\>" "\<(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)\>"

View File

@@ -2,7 +2,7 @@
## Hybrid perl5 / perl6 syntax highlighting
### Found in CPAN - http://cpansearch.perl.org/src/NIGE/Goo-0.09/lib/.gooskel/nanorc
syntax "Perl6" "\.p6$"
syntax "perl6" "\.p6$"
color brightblue "\<(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)\>"
color brightblue "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>"

View File

@@ -1,5 +1,5 @@
## PHP Syntax Highlighting
syntax "PHP" "\.php[2345s~]?$"
syntax "php" "\.php[2345s~]?$"
color white start="<\?(php|=)?" end="\?>"
# Functions
color brightblue "([a-zA-Z0-9_-]*)\("

View File

@@ -1,4 +1,4 @@
syntax "PC" "\.pc$"
syntax "pc" "\.pc$"
color cyan "^(Name|Description|URL|Version|Conflicts|Cflags):"
color cyan "^(Requires|Libs)(\.private)?:"

View File

@@ -1,6 +1,6 @@
## Arch PKGBUILD files
##
syntax "PKGBUILD" "^.*PKGBUILD$"
syntax "pkgbuild" "^.*PKGBUILD$"
color green start="^." end="$"
color cyan "^.*(pkgbase|pkgname|pkgver|pkgrel|pkgdesc|arch|url|license).*=.*$"
color brightcyan "\<(pkgbase|pkgname|pkgver|pkgrel|pkgdesc|arch|url|license)\>"

View File

@@ -1,4 +1,4 @@
syntax "PO" "\.pot?$"
syntax "po" "\.pot?$"
color cyan "\<(msgid|msgstr)\>"
color yellow ""(\\.|[^"])*"|'(\\.|[^'])*'"

View File

@@ -1,6 +1,6 @@
## Here is an example for POV-Ray.
##
syntax "POV" "\.(pov|POV|povray|POVRAY)$"
syntax "pov" "\.(pov|POV|povray|POVRAY)$"
color brightcyan "^[[:space:]]*#[[:space:]]*(declare)"
color brightyellow "\<(sphere|cylinder|translate|matrix|rotate|scale)\>"
color brightyellow "\<(orthographic|location|up|right|direction|clipped_by)\>"

View File

@@ -1,4 +1,4 @@
syntax "Privoxy-action" "\.action$"
syntax "privoxy-action" "\.action$"
color brightred "[{[:space:]]\-block([[:space:]{}]|$)"
color brightgreen "[{[:space:]]\+block([[:space:]{}]|$)"

View File

@@ -1,4 +1,4 @@
syntax "Privoxy-config" "privoxy/config$"
syntax "privoxy-config" "privoxy/config$"
color cyan "(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:]]"
color brightblack "(^|[[:space:]])#([^{].*)?$"

View File

@@ -1,4 +1,4 @@
syntax "Privoxy-filter" "\.filter$"
syntax "privoxy-filter" "\.filter$"
color cyan "^(FILTER|CLIENT-HEADER-FILTER|CLIENT-HEADER-TAGGER|SERVER-HEADER-FILTER|SERVER-HEADER-TAGGER): [a-z-]+"
color brightblue "^(FILTER|CLIENT-HEADER-FILTER|CLIENT-HEADER-TAGGER|SERVER-HEADER-FILTER|SERVER-HEADER-TAGGER):"

View File

@@ -1,6 +1,6 @@
## Nano syntax highlighting for Puppet.
##
syntax "Puppet" "\.pp$"
syntax "puppet" "\.pp$"
#This goes first, so the normal builtins will override in some classes
## Paramerers

View File

@@ -1,6 +1,6 @@
## Here is an example for Python.
##
syntax "Python" "\.py$"
syntax "python" "\.py$"
header "^#!.*/(env +)?python( |$)"
## built-in objects

View File

@@ -1,6 +1,6 @@
# R source code
syntax "R" "\.(r|R)$"
syntax "r" "\.(r|R)$"
color statement "\b(break|else|for|function|if|in|next|repeat|return|while)\b"
color constant "\b(TRUE|FALSE|NULL|Inf|NaN|NA|NA_integer_|NA_real_|NA_complex_|NA_character_)\b"

View File

@@ -1,5 +1,5 @@
## For reST
syntax "RST" "\.rest$" "\.rst$"
syntax "rst" "\.rest$" "\.rst$"
# italics
#color magenta "\*[^*]\*"
# bold

View File

@@ -1,4 +1,4 @@
syntax "Rpmspec" "\.spec$" "\.rpmspec$"
syntax "rpmspec" "\.spec$" "\.rpmspec$"
color cyan "\<(Icon|ExclusiveOs|ExcludeOs):"
color cyan "\<(BuildArch|BuildArchitectures|ExclusiveArch|ExcludeArch):"

View File

@@ -1,6 +1,6 @@
## Here is an example for Ruby.
##
syntax "Ruby" "\.rb$" "Gemfile" "config.ru" "Rakefile" "Capfile" "Vagrantfile"
syntax "ruby" "\.rb$" "Gemfile" "config.ru" "Rakefile" "Capfile" "Vagrantfile"
header "^#!.*/(env +)?ruby( |$)"
## Asciibetical list of reserved words

View File

@@ -2,7 +2,7 @@
# Copyright 2015 The Rust Project Developers.
#
# NOTE: Rules are applied in order: later rules re-colorize matching text.
syntax "Rust" "\.rs"
syntax "rust" "\.rs"
# function definition
color identifier "fn [a-z0-9_]+"

View File

@@ -1,6 +1,6 @@
## Here is an example for Scala.
##
syntax "Scala" "\.scala$"
syntax "scala" "\.scala$"
color green "\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\>"
color red "\<(match|val|var|break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\>"
color cyan "\<(def|object|case|trait|lazy|implicit|abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile|sealed)\>"

View File

@@ -1,4 +1,4 @@
syntax "SED" "\.sed$"
syntax "sed" "\.sed$"
header "^#!.*bin/(env +)?sed( |$)"
color red "[|^$.*+]"

View File

@@ -1,7 +1,7 @@
## SaltStack files (*.sls)
##
syntax "Salt" "\.sls$"
syntax "salt" "\.sls$"
# Anything ending in a colon (:), including things that start with a dash (-)
color blue "^[^ -].*:$"

View File

@@ -1,4 +1,4 @@
syntax "SQL" "\.sql$" "sqliterc$"
syntax "sql" "\.sql$" "sqliterc$"
cyan (i) "\<(ALL|ASC|AS|ALTER|AND|ADD|AUTO_INCREMENT)\>"
cyan (i) "\<(BETWEEN|BINARY|BOTH|BY|BOOLEAN)\>"

View File

@@ -2,7 +2,7 @@
# Swift syntax highlighting for Nano.
##############################################################################
syntax "Swift" "\.swift$"
syntax "swift" "\.swift$"
# Operators
color statement "[.:;,+*|=!?\%]" "<" ">" "/" "-" "&"

View File

@@ -1,4 +1,4 @@
syntax "Systemd" "\.(service|socket)$"
syntax "systemd" "\.(service|socket)$"
header "^\[Unit\]$"
color cyan "^(Accept|After|Alias|AllowIsolate|Also|ANSI_COLOR|_AUDIT_LOGINUID|_AUDIT_SESSION|Backlog|Before|BindIPv6Only|BindsTo|BindToDevice|BlockIOReadBandwidth|BlockIOWeight|BlockIOWriteBandwidth|_BOOT_ID|Broadcast|BUG_REPORT_URL|BusName|Capabilities|CapabilityBoundingSet|CHASSIS|cipher|class|_CMDLINE|CODE_FILE|CODE_FUNC|CODE_LINE|_COMM|Compress|ConditionACPower|ConditionCapability|ConditionDirectoryNotEmpty|ConditionFileIsExecutable|ConditionFileNotEmpty|ConditionHost|ConditionKernelCommandLine|ConditionNull|ConditionPathExists|ConditionPathExistsGlob|ConditionPathIsDirectory|ConditionPathIsMountPoint|ConditionPathIsReadWrite|ConditionPathIsSymbolicLink|ConditionSecurity|ConditionVirtualization|Conflicts|ControlGroup|ControlGroupAttribute|ControlGroupModify|ControlGroupPersistent|controllers|Controllers|CPE_NAME|CPUAffinity|CPUSchedulingPolicy|CPUSchedulingPriority|CPUSchedulingResetOnFork|CPUShares|CrashChVT|CrashShell|__CURSOR|debug|DefaultControllers|DefaultDependencies|DefaultLimitAS|DefaultLimitCORE|DefaultLimitCPU|DefaultLimitDATA|DefaultLimitFSIZE|DefaultLimitLOCKS|DefaultLimitMEMLOCK|DefaultLimitMSGQUEUE|DefaultLimitNICE|DefaultLimitNOFILE|DefaultLimitNPROC|DefaultLimitRSS|DefaultLimitRTPRIO|DefaultLimitRTTIME|DefaultLimitSIGPENDING|DefaultLimitSTACK|DefaultStandardError|DefaultStandardOutput|Description|DeviceAllow|DeviceDeny|DirectoryMode|DirectoryNotEmpty|Documentation|DumpCore|entropy|Environment|EnvironmentFile|ERRNO|event_timeout|_EXE|ExecReload|ExecStart|ExecStartPost|ExecStartPre|ExecStop|ExecStopPost|ExecStopPre|filter|FONT|FONT_MAP|FONT_UNIMAP|ForwardToConsole|ForwardToKMsg|ForwardToSyslog|FreeBind|freq|FsckPassNo|fstab|_GID|Group|GuessMainPID|HandleHibernateKey|HandleLidSwitch|HandlePowerKey|HandleSuspendKey|hash|HibernateKeyIgnoreInhibited|HOME_URL|_HOSTNAME|ICON_NAME|ID|IdleAction|IdleActionSec|ID_LIKE|ID_MODEL|ID_MODEL_FROM_DATABASE|IgnoreOnIsolate|IgnoreOnSnapshot|IgnoreSIGPIPE|InaccessibleDirectories|InhibitDelayMaxSec|init|IOSchedulingClass|IOSchedulingPriority|IPTOS|IPTTL|JobTimeoutSec|JoinControllers|KeepAlive|KEYMAP|KEYMAP_TOGGLE|KillExcludeUsers|KillMode|KillOnlyUsers|KillSignal|KillUserProcesses|LidSwitchIgnoreInhibited|LimitAS|LimitCORE|LimitCPU|LimitDATA|LimitFSIZE|LimitLOCKS|LimitMEMLOCK|LimitMSGQUEUE|LimitNICE|LimitNOFILE|LimitNPROC|LimitRSS|LimitRTPRIO|LimitRTTIME|LimitSIGPENDING|LimitSTACK|link_priority|valueListenDatagram|ListenFIFO|ListenMessageQueue|ListenNetlink|ListenSequentialPacket|ListenSpecial|ListenStream|LogColor|LogLevel|LogLocation|LogTarget|luks|_MACHINE_ID|MakeDirectory|Mark|MaxConnections|MaxFileSec|MaxLevelConsole|MaxLevelKMsg|MaxLevelStore|MaxLevelSyslog|MaxRetentionSec|MemoryLimit|MemorySoftLimit|MESSAGE|MESSAGE_ID|MessageQueueMaxMessages|MessageQueueMessageSize|__MONOTONIC_TIMESTAMP|MountFlags|NAME|NAutoVTs|Nice|NonBlocking|NoNewPrivileges|NotifyAccess|OnActiveSec|OnBootSec|OnCalendar|OnFailure|OnFailureIsolate|OnStartupSec|OnUnitActiveSec|OnUnitInactiveSec|OOMScoreAdjust|Options|output|PAMName|PartOf|PassCredentials|PassSecurity|PathChanged|PathExists|PathExistsGlob|PathModified|PermissionsStartOnly|_PID|PIDFile|PipeSize|PowerKeyIgnoreInhibited|PRETTY_HOSTNAME|PRETTY_NAME|Priority|PRIORITY|PrivateNetwork|PrivateTmp|PropagatesReloadTo|pss|RateLimitBurst|RateLimitInterval|ReadOnlyDirectories|ReadWriteDirectories|__REALTIME_TIMESTAMP|ReceiveBuffer|RefuseManualStart|RefuseManualStop|rel|ReloadPropagatedFrom|RemainAfterExit|RequiredBy|Requires|RequiresMountsFor|RequiresOverridable|Requisite|RequisiteOverridable|ReserveVT|ResetControllers|Restart|RestartPreventExitStatus|RestartSec|RootDirectory|RootDirectoryStartOnly|RuntimeKeepFree|RuntimeMaxFileSize|RuntimeMaxUse|RuntimeWatchdogSec|samples|scale_x|scale_y|Seal|SecureBits|_SELINUX_CONTEXT|SendBuffer|SendSIGKILL|Service|ShowStatus|ShutdownWatchdogSec|size|SmackLabel|SmackLabelIPIn|SmackLabelIPOut|SocketMode|Sockets|SourcePath|_SOURCE_REALTIME_TIMESTAMP|SplitMode|StandardError|StandardInput|StandardOutput|StartLimitAction|StartLimitBurst|StartLimitInterval|static_node|StopWhenUnneeded|Storage|string_escape|none|replaceSuccessExitStatus|SupplementaryGroups|SUPPORT_URL|SuspendKeyIgnoreInhibited|SyslogFacility|SYSLOG_FACILITY|SyslogIdentifier|SYSLOG_IDENTIFIER|SyslogLevel|SyslogLevelPrefix|SYSLOG_PID|SystemCallFilter|SYSTEMD_ALIAS|_SYSTEMD_CGROUP|_SYSTEMD_OWNER_UID|SYSTEMD_READY|_SYSTEMD_SESSION|_SYSTEMD_UNIT|_SYSTEMD_USER_UNIT|SYSTEMD_WANTS|SystemKeepFree|SystemMaxFileSize|SystemMaxUse|SysVStartPriority|TCPCongestion|TCPWrapName|timeout|TimeoutSec|TimeoutStartSec|TimeoutStopSec|TimerSlackNSec|Transparent|_TRANSPORT|tries|TTYPath|TTYReset|TTYVHangup|TTYVTDisallocate|Type|_UID|UMask|Unit|User|UtmpIdentifier|VERSION|VERSION_ID|WantedBy|Wants|WatchdogSec|What|Where|WorkingDirectory)="

View File

@@ -1,4 +1,4 @@
syntax "TCL" "\.tcl$"
syntax "tcl" "\.tcl$"
header "^#!.*/(env +)?tclsh( |$)"
## Standard Tcl [info commands]

View File

@@ -1,6 +1,6 @@
## Here is a short example for TeX files.
##
syntax "TeX" "\.tex$" "bib" "\.bib$" "cls" "\.cls$"
syntax "tex" "\.tex$" "bib" "\.bib$" "cls" "\.cls$"
color yellow "\$[^$]*\$"
green (i) "\\.|\\[A-Z]*"
color magenta "[{}]"

View File

@@ -1,4 +1,4 @@
syntax "Vala" "\.vala$"
syntax "vala" "\.vala$"
color green "\<(float|double|bool|char|int|uint|short|long|void|(un)?signed)\>"
color brightblue "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"

View File

@@ -1,4 +1,4 @@
syntax "VI" "(^|/|\.)(ex|vim)rc$|\.vim"
syntax "vi" "(^|/|\.)(ex|vim)rc$|\.vim"
color identifier "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"
color statement "\b([nvxsoilc]?(nore|un)?map|[nvlx]n|[ico]?no|[cilovx][um]|s?unm)\b"

View File

@@ -1,7 +1,7 @@
## Here is an example for xml files.
##
syntax "XML" "\.([jrs]?html?|xml|sgml?|rng|plist)$"
syntax "xml" "\.([jrs]?html?|xml|sgml?|rng|plist)$"
color white "^.+$"
color green start="<" end=">"
color cyan "<[^> ]+"

View File

@@ -1,4 +1,4 @@
syntax "Xresources" "X(defaults|resources)$"
syntax "xresources" "X(defaults|resources)$"
color green "^[[:alnum:]]+\*"
color brightyellow "\*[[:alnum:]]+\:"

View File

@@ -1,4 +1,4 @@
syntax "YAML" "\.ya?ml$"
syntax "yaml" "\.ya?ml$"
header "^---" "%YAML"
color green "(^| )!!(binary|bool|float|int|map|null|omap|seq|set|str) "

View File

@@ -1,4 +1,4 @@
syntax "YUM" "\.repo$|yum.*\.conf$"
syntax "yum" "\.repo$|yum.*\.conf$"
color cyan "^[[:space:]]*[^=]*="
color brightmagenta "^[[:space:]]*\[.*\]$"

View File

@@ -1,5 +1,5 @@
## Syntax highlighting for ZSH scripts (initially copied from sh.nanorc)
syntax "ZSH" "\.zsh$" "\.?(zshenv|zprofile|zshrc|zlogin|zlogout)$"
syntax "zsh" "\.zsh$" "\.?(zshenv|zprofile|zshrc|zlogin|zlogout)$"
header "^#!.*/(env +)?zsh( |$)"
## Numbers