- Notifications
You must be signed in to change notification settings - Fork750
Highlighters
Syntax highlighting is supported through highlighters. You may add your own Syntax definitions in therc
directory. There is a syntax highlighting section in thehighlighters.asciidoc file.
There is a good overview of highlighters in Kakounehere.
# same ideas apply to `line`addhl column 4 red # all chars in column 4 will be have a red coloraddhl column 5 red,blue+b # all chars in column 5 will be red on blue and in boldaddhl column 6 PrimaryCursor # all chars in column 6 will be the same face than `PrimaryCursor` (see below)
https://github.com/insipx/kak-crosshairs provides automatic highlighting of current Line/Column
declare-option range-specs foo # declare an option called foo, of type range-specsadd-highlighter window/ ranges foo # use this option as the parameterset-option buffer foo %val{timestamp} '2:3.1,3.10|blue' # update the option to trigger changes
Theui.kak plugin provides commands and a user mode to quickly toggle various highlighters and related hooks.
First add asearch
face. Here, it will emphasis the searched word in bold and italic without changing the foreground or background colors:
set-faceglobal search +bi
Then enable search highlighting. Dynregex is plugged on the content of the search register/
:
add-highlighterglobal/search dynregex'%reg{/}'0:search
If you want a visual hint about code that exceeds a given width, try thecolumn
highlighter:
add-highlighterglobal/ column'%opt{autowrap_column}'default,red
...highlights the column named by theautowrap_column
option with a red background, and will automatically move as the option is updated. Theautowrap_column
option is used bythe 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.
The following highlighter will display words "FIXME"/"TODO"/"XXX"/"NOTE" in bold and reversed.
add-highlighterglobal/regex \b(TODO|FIXME|XXX|NOTE)\b0:default+rb
Faces can be taken from thecolorscheme
files, which is what is usually done, or directly from the the list ofdefault 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 |
LineNumbersWrapped | Default | Default | Italic |
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 | FinalFg |
WrapMarker | Blue | Default |
- Normal mode commands
- Avoid the escape key
- Implementing user mode (Leader key)
- Kakoune explain
- Kakoune TV