Skip to content
Cem Aksoylar edited this page Nov 21, 2019 · 27 revisions

TOC

Highlighters

Syntax highlighting is supported through highlighters. You may add your own Syntax definitions in the rc directory. There is a syntax highlighting section in the highlighters.asciidoc file.

Examples

column, line

# same ideas apply to `line`
addhl column 4 red           # all chars in column 4 will be have a red color
addhl column 5 red,blue+b    # all chars in column 5 will be red on blue and in bold
addhl column 6 PrimaryCursor # all chars in column 6 will be the same face than `PrimaryCursor` (see below)

ranges

declare-option range-specs foo                          # declare an option called foo, of type range-specs
add-highlighter window/ ranges foo                      # use this option as the parameter
set-option buffer foo %val{timestamp} '2:3.1,3.10|blue' # update the option to trigger changes

Volatile highlighting

Extensions

Highlight on yank, delete, change and paste commands. The highlight disappears at the next command. The highlighting gives useful visual feedback for what your operation actually changed in the buffer.

Search highlighting

First add a search face. Here, it will emphasis the searched word in bold and italic without changing the foreground or background colors:

set-face global search +bi

Then enable search highlighting. Dynregex is plugged on the content of the search register /:

add-highlighter global/search dynregex '%reg{/}' 0:search

Smart search highlighting

Extensions

A smart search highlighter, enabled in context of search.

Highlight a column

If you want a visual hint about code that exceeds a given width, try the column highlighter:

add-highlighter global/ column '%opt{autowrap_column}' default,red

...highlights the column named by the autowrap_column option with a red background, and will automatically move as the option is updated. The autowrap_column option is used by the autowrap script what column to wrap to, but even if you don't use autowrap's functionality, it's a good place to record the buffer's wrapping column so other wrapping and formatting hooks can find it.

FIXME/TODO/XXX keywords

Source the following script in your kakrc: comnotes.kak. It will display the word "FIXME"/"TODO"/"XXX" in bold and reversed.

Faces

Faces can be taken from the colorscheme files, which is what is usually done, or directly from the the list of default faces:

Name Foreground Background Attribute
Default Default Default
PrimarySelection White Blue
SecondarySelection Black Blue
PrimaryCursor Black White
SecondaryCursor Black White
PrimaryCursorEol Black Cyan
SecondaryCursorEol Black Cyan
LineNumbers Default Default
LineNumberCursor Default Default Reverse
MenuForeground White Blue
MenuBackground Blue White
MenuInfo Cyan Default
Information Black Yellow
Error Black Red
StatusLine Cyan Default
StatusLineMode Yellow Default
StatusLineInfo Blue Default
StatusLineValue Green Default
StatusCursor Black Cyan
Prompt Yellow Default
MatchingChar Default Default Bold
BufferPadding Blue Default
Whitespace Default Default
WrapMarker Blue Default
Clone this wiki locally