GithubHelp home page GithubHelp logo

vis-highlight's Introduction

vis-highlight ๐ŸŒˆ

A vis-plugin to highlight Lua patterns.

Commands

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

:hi-ls - list patterns with style

:hi-clear - clear patterns

:hi-rm [pattern] - remove specific pattern

Example

:hi ' +\n' back:#444444
:hi-ls
:hi-rm " +\n"
:hi hi back:yellow,fore:blue,underlined:true,bold:true
:hi-clear

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

Patterns in visrc

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

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

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

If pattern is set to empty {} it defaults to STYLE_CURSOR style.

You can set a hideOnInsert = true option to not highlight pattern when in vis.modes.INSERT.

See 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

vis-highlight's People

Contributors

erf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vis-highlight's Issues

Second window does not use the same highlighting settings as the first

I assume that this is due to a misunderstanding on my part that I do not have the configuration properly setup. The problem is obvious from a picture:

image

My config:

-- load standard vis module, providing parts of the Lua API
require('vis')
local plug = require('plugins/vis-plug')

vis.events.subscribe(vis.events.INIT, function()
	-- Your global configuration options
	-- vis.hi.patterns['\t'] = { style = 'back:#ffffff' }
	plug.plugins.hi.patterns[' +\n'] = { style = 'back:#ff0000' }
	plug.plugins.hi.patterns['\t+'] = { style = 'fore:#303030' }
	plug.plugins.hi.patterns['\n'] = { style = 'fore:#303030' }
end)

vis.events.subscribe(vis.events.WIN_OPEN, function(win)
	-- Your per window configuration options e.g.
	-- vis:command('set number')
	vis:command('set show-tabs on')
	vis:command('set show-newlines on')
end)

-- configure plugins in an array of tables with git urls and options
local plugins = {

	-- load a plugin given a repo (https://github.com/ can be omitted and expects a 'init.lua' file)
	-- { 'erf/vis-cursors' },

	-- first parameter is a shorthand for 'url'
	{ url = 'erf/vis-cursors' },

	-- specify an alias to later use to access plugin variables (see example below)
	{ 'erf/vis-highlight', alias = 'hi' },

	-- configure themes by setting 'theme = true'. The theme 'file' will be set on INIT
	{ 'samlwood/vis-gruvbox', theme = true, file = 'gruvbox' },

	{ 'seifferth/vis-editorconfig' },
}

plug.init(plugins, true)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.