-
Notifications
You must be signed in to change notification settings - Fork 715
Highlighters
- Highlighters
- Volatile highlighting
- Search highlighting
- 81st column chars
- FIXME/TODO/XXX keywords in comments
- Faces
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.
# 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)
decl range-specs foo '1:3.1,3.4|red' # declare an option called foo, of type range-specs
addhl ranges foo # use this option as the parameter
set buffer foo '2:3.1,3.10|blue' # update the option to trigger changes
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.
First add a search
face. Here, it will emphasis the searched word in bold and italic without changing the foreground or background colors:
face search +bi
Then enable search highlighting. Dynregex is plugged on the content of the search register /
:
add-highlighter dynregex '%reg{/}' 0:search
A smart search highlighter, enabled in context of search.
Declare this hook in your kakrc
file if you use spaces for indentation:
hook global WinCreate .* %{addhl regex ^\V{80}(\V) 1:Error}
Declare this instead if you use tabs for indentation, where [tabstop] is the value of tabstop, and [80/tabstop] is 80 divided by the value of tabstop:
hook global WinCreate .* %{addhl regex ^(\t|\V{[tabstop]}){[80/tabstop]}(\V) 2:Error}
Source the following script in your kakrc
: https://gist.github.com/lenormf/e8e2b0f512efa3cf4bbf[gdt.kak]. It will display the word "FIXME"/"TODO"/"XXX" in bold and inverted video whenever it is written in a comment, to highlight bits of code that still need modification.
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
- Default, Default, Default,
- PrimarySelection, White, Blue,
- SecondarySelection, Black, Blue,
- PrimaryCursor, Black, White,
- SecondaryCursor, Black, White,
- 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,
- Normal mode commands
- Avoid the escape key
- Implementing user mode (Leader key)
- Kakoune explain
- Kakoune TV