项目作者: erf

项目描述 :
highlight Lua patterns in vis
高级语言: Lua
项目地址: git://github.com/erf/vis-highlight.git
创建时间: 2020-10-30T14:37:03Z
项目社区:https://github.com/erf/vis-highlight

开源协议:MIT License

下载


vis-highlight 🌈

A vis-plugin to highlight Lua patterns.

Commands

:hi [pattern] (style) - highlight a Lua pattern with optional style

This will highlight all windows with the given pattern and style

:hi-ls - list patterns and style

:hi-clear - clear patterns

:hi-rm [pattern] - remove a specific pattern

Example

  1. :hi ' +\n' back:#444444
  2. :hi-ls
  3. :hi-rm " +\n"
  4. :hi hi back:yellow,fore:blue,underlined:true,bold:true
  5. :hi-clear

You only need quotation marks if you use spaces in your patterns

Configure patterns in visrc

You can configure multiple patterns with style in your visrc.lua file:

  1. local hi = require('plugins/vis-highlight')
  2. hi.patterns[' +'] = { style = 'back:#666600' }
  3. hi.patterns[' +\n'] = { style = 'back:#444444', hideOnInsert = true }
  4. hi.patterns['hi'] = { style = 'back:yellow,fore:blue,underlined:true,bold:true' }

The number of custom styles are limited to 64 and may be overridden by lexer styles

If style is empty, win.STYLE_CURSOR will be used.

You can set the hideOnInsert = true option to avoid highlighting when in
INSERT mode.

See Patterns for how to Lua define patterns.

Style definitions

Style definitions may contain the following:

  • fore: Font face foreground color in 0xBBGGRR or “#RRGGBB” format.
  • back: Font face background color in 0xBBGGRR or “#RRGGBB” format.
  • bold: Whether or not the font face is bold. The default value is false.
  • underlined: Whether or not the font face is underlined. The default value is false.

See LPegLexer for more info on styles.