Module textredux.core.indicator

The indicator module provides support for indicators in your buffers.

Indicators lets you visually mark a certain text range using various styles and colors. Using the event mechanism you can also receive events whenever the user clicks the marked text.

The indicator definition

An indicator is defined using a simple table with the properties listed below. For the most part, these properties maps directly to fields in the buffer API.

A simple example:

local reduxindicator = textredux.core.indicator
reduxindicator.RED_BOX = {style = c.INDIC_BOX, fore = '#ff0000'}

Using indicators

Start with defining your indicators using the format described above. You can then either apply them against a range of text using apply, or pass them to one of the text insertion functions in textredux.core.buffer.

local text = 'Text for a red box indicator\n\n'
buffer:add_text(text)
reduxindicator.RED_BOX:apply(0, #text)

buffer:add_text(text, nil, nil, reduxindicator.RED_BOX)

Please also see the file examples/buffer_indicators.lua.