This commit is contained in:
Zachary Yedidia
2016-05-20 09:19:28 -04:00
8 changed files with 156 additions and 115 deletions

View File

@@ -71,6 +71,7 @@ func InitBindings() {
"EndOfLine": (*View).EndOfLine,
"ToggleRuler": (*View).ToggleRuler,
"JumpLine": (*View).JumpLine,
"ClearStatus": (*View).ClearStatus,
}
keys := map[string]Key{
@@ -294,6 +295,7 @@ func DefaultBindings() map[string]string {
"CtrlR": "ToggleRuler",
"CtrlL": "JumpLine",
"Delete": "Delete",
"Esc": "ClearStatus",
}
}
@@ -847,6 +849,12 @@ func (v *View) JumpLine() bool {
return false
}
// ClearStatus clears the messenger bar
func (v *View) ClearStatus() bool {
messenger.Message("")
return false
}
// None is no action
func None() bool {
return false

File diff suppressed because one or more lines are too long

View File

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

View File

@@ -75,6 +75,7 @@ func DefaultSettings() map[string]interface{} {
"colorscheme": "default",
"tabsize": float64(4),
"indentchar": " ",
"ignorecase": false,
"autoindent": true,
"syntax": true,
"tabsToSpaces": false,

View File

@@ -182,6 +182,10 @@ Here are the options that you can set:
default value: ` `
* `ignorecase`: perform case-insensitive searches
default value: `off`
* `syntax`: turns syntax on or off
default value: `on`

4
runtime/syntax/Makefile Normal file
View File

@@ -0,0 +1,4 @@
export
:=
error

View File

@@ -1,22 +1,20 @@
syntax "Makefile" "([Mm]akefile|\.ma?k)$"
header "^#!.*/(env +)?[bg]?make( |$)"
color cyan "\<(ifeq|ifdef|ifneq|ifndef|else|endif)\>"
color cyan "^(export|include|override)\>"
color brightmagenta "^[^:= ]+:"
color red "[=,%]" "\+=|\?=|:=|&&|\|\|"
color brightblue "\$\((abspath|addprefix|addsuffix|and|basename|call|dir)[[:space:]]"
color brightblue "\$\((error|eval|filter|filter-out|findstring|firstword)[[:space:]]"
color brightblue "\$\((flavor|foreach|if|info|join|lastword|notdir|or)[[:space:]]"
color brightblue "\$\((origin|patsubst|realpath|shell|sort|strip|suffix)[[:space:]]"
color brightblue "\$\((value|warning|wildcard|word|wordlist|words)[[:space:]]"
color black "[()$]"
color yellow ""(\\.|[^"])*"|'(\\.|[^'])*'"
color brightyellow "\$+(\{[^} ]+\}|\([^) ]+\))"
color brightyellow "\$[@^<*?%|+]|\$\([@^<*?%+-][DF]\)"
color magenta "\$\$|\\.?"
color brightblack "(^|[[:space:]])#([^{].*)?$"
color brightblack "^ @#.*"
# Show trailing whitespace
color ,green "[[:space:]]+$"
color preproc "\<(ifeq|ifdef|ifneq|ifndef|else|endif)\>"
color statement "^(export|include|override)\>"
color operator "^[^:= ]+:"
color operator "[=,%]" "\+=|\?=|:=|&&|\|\|"
color statement "\$\((abspath|addprefix|addsuffix|and|basename|call|dir)[[:space:]]"
color statement "\$\((error|eval|filter|filter-out|findstring|firstword)[[:space:]]"
color statement "\$\((flavor|foreach|if|info|join|lastword|notdir|or)[[:space:]]"
color statement "\$\((origin|patsubst|realpath|shell|sort|strip|suffix)[[:space:]]"
color statement "\$\((value|warning|wildcard|word|wordlist|words)[[:space:]]"
color identifier "^.+:"
color identifier "[()$]"
color constant ""(\\.|[^"])*"|'(\\.|[^'])*'"
color identifier "\$+(\{[^} ]+\}|\([^) ]+\))"
color identifier "\$[@^<*?%|+]|\$\([@^<*?%+-][DF]\)"
color identifier "\$\$|\\.?"
color comment "(^|[[:space:]])#([^{].*)?$"
color comment "^ @#.*"

View File

@@ -1,6 +1,6 @@
## Here is an example for Bourne shell scripts.
##
syntax "SH" "\.sh$" "\.bash" "\.bashrc" "bashrc" "\.bash_aliases" "bash_aliases" "\.bash_functions" "bash_functions" "\.bash_profile" "bash_profile"
syntax "SH" "\.sh$" "\.bash" "\.bashrc" "bashrc" "\.bash_aliases" "bash_aliases" "\.bash_functions" "bash_functions" "\.bash_profile" "bash_profile" "Pkgfile" "PKGBUILD" ".ebuild\$" "APKBUILD"
header "^#!.*/(env +)?(ba)?sh( |$)"
color statement "\b(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\b"