Add colorscheme support for selection color

This commit is contained in:
Zachary Yedidia
2016-03-23 13:23:50 -04:00
parent b85edeebd6
commit e2f25947cc
2 changed files with 21 additions and 20 deletions

View File

@@ -1,48 +1,45 @@
syntax "Markdown" "\.(md|mkd|mkdn|markdown)$" syntax "Markdown" "\.(md|mkd|mkdn|markdown)$"
# Tables (Github extension) # Tables (Github extension)
color cyan ".*[ :]\|[ :].*" color type ".*[ :]\|[ :].*"
# quotes # quotes
color brightblack "^>.*" color statement "^>.*"
# Emphasis # Emphasis
color green "(^|[[:space:]])(_[^ ][^_]*_|\*[^ ][^*]*\*)" color type "(^|[[:space:]])(_[^ ][^_]*_|\*[^ ][^*]*\*)"
# Strong emphasis # Strong emphasis
color brightgreen "(^|[[:space:]])(__[^ ][^_]*__|\*\*[^ ][^*]*\*\*)" color type "(^|[[:space:]])(__[^ ][^_]*__|\*\*[^ ][^*]*\*\*)"
# strike-through # strike-through
color red "(^|[[:space:]])~~[^ ][^~]*~~" color type "(^|[[:space:]])~~[^ ][^~]*~~"
# horizontal rules # horizontal rules
color brightmagenta "^(---+|===+|___+|\*\*\*+)\s*$" color special "^(---+|===+|___+|\*\*\*+)\s*$"
# headlines # headlines
color brightmagenta "^#{1,6}.*" color special "^#{1,6}.*"
# lists # lists
color blue "^[[:space:]]*[\*+-] |^[[:space:]]*[0-9]+\. " color identifier "^[[:space:]]*[\*+-] |^[[:space:]]*[0-9]+\. "
# leading whitespace
color black "^[[:space:]]+"
# misc # misc
color magenta "\(([CcRr]|[Tt][Mm])\)" "\.{3}" "(^|[[:space:]])\-\-($|[[:space:]])" color preproc "\(([CcRr]|[Tt][Mm])\)" "\.{3}" "(^|[[:space:]])\-\-($|[[:space:]])"
# links # links
color brightblue "\[[^]]+\]" color constant "\[[^]]+\]"
color brightblue "\[([^][]|\[[^]]*\])*\]\([^)]+\)" color constant "\[([^][]|\[[^]]*\])*\]\([^)]+\)"
# images # images
color magenta "!\[[^][]*\](\([^)]+\)|\[[^]]+\])" color underlined "!\[[^][]*\](\([^)]+\)|\[[^]]+\])"
# urls # urls
color brightyellow "https?://[^ )>]+" color underlined "https?://[^ )>]+"
# code # code
color yellow "`.*?`|^ {4}[^-+*].*" color special "`.*?`|^ {4}[^-+*].*"
# code blocks # code blocks
# color yellow (s) "^```[^$].*?^```$" # color yellow (s) "^```[^$].*?^```$"
color yellow "^```$" color special "^```$"

View File

@@ -402,8 +402,12 @@ func (v *View) Display() {
if v.cursor.HasSelection() && if v.cursor.HasSelection() &&
(charNum >= v.cursor.selectionStart && charNum <= v.cursor.selectionEnd || (charNum >= v.cursor.selectionStart && charNum <= v.cursor.selectionEnd ||
charNum <= v.cursor.selectionStart && charNum >= v.cursor.selectionEnd) { charNum <= v.cursor.selectionStart && charNum >= v.cursor.selectionEnd) {
lineStyle = tcell.StyleDefault
lineStyle = lineStyle.Reverse(true) lineStyle = tcell.StyleDefault.Reverse(true)
if _, ok := colorscheme["selection"]; ok {
lineStyle = colorscheme["selection"]
}
} else { } else {
lineStyle = highlightStyle lineStyle = highlightStyle
} }