Module: RuVim::Highlighter
- Defined in:
- lib/ruvim/highlighter.rb
Constant Summary collapse
- KEYWORD_COLOR =
"\e[36m"- STRING_COLOR =
"\e[32m"- NUMBER_COLOR =
"\e[33m"- COMMENT_COLOR =
"\e[90m"- VARIABLE_COLOR =
"\e[93m"- CONSTANT_COLOR =
"\e[96m"
Class Method Summary collapse
- .apply_regex(cols, text, regex, color, override: false) ⇒ Object
- .color_columns(filetype, line) ⇒ Object
Class Method Details
.apply_regex(cols, text, regex, color, override: false) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ruvim/highlighter.rb', line 26 def apply_regex(cols, text, regex, color, override: false) text.to_enum(:scan, regex).each do m = Regexp.last_match next unless m (m.begin(0)...m.end(0)).each do |idx| next if cols.key?(idx) && !override cols[idx] = color end end end |
.color_columns(filetype, line) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ruvim/highlighter.rb', line 14 def color_columns(filetype, line) ft = filetype.to_s return {} if line.empty? entry = Lang::Registry[ft] if entry && entry[:mod].respond_to?(:color_columns) entry[:mod].color_columns(line) else {} end end |