Highlighter is an asynchronous syntax highlight engine (using ctags) for Neovim.
-
The highlighter plug-in is based on Exuberant Ctags that generates an index (or tag) file of language objects found in source files. This means that the highlighter is available for all of languages supported by ctags.
-
Tag data and syntax commands (for vim) are generated asynchronously by using python-client.
- Neovim with if_python3.
- Exuberant Ctags.
For vim-plug
Plug 'KeitaNakamura/highlighter.nvim', { 'do': ':UpdateRemotePlugins' }
You can update the syntax highlight by using :HighlighterUpdate
command.
example:
let g:highlighter#disabled_languages = ['c', 'cpp'] " set `filetype`s
let g:highlighter#auto_update = 0 " 0: disable (default), 1: after saving the file, 2: after saving and opening the file
Syntax highlight is updated only in the current file by default. If you add g:highlighter#project_root_signs
option, the highlighter set a directory having a root sign as project root, and all of your project files (same language) will be updated.
example:
let g:highlighter#project_root_signs = ['.git']
example:
let g:highlighter#syntax_python = [
\ { 'hlgroup' : 'HighlighterPythonFunction',
\ 'hlgroup_link' : 'Function',
\ 'tagkinds' : 'f',
\ 'syntax_type' : 'match',
\ 'syntax_suffix' : '(\@=',
\ },
\ { 'hlgroup' : 'HighlighterPythonMethod',
\ 'hlgroup_link' : 'Function',
\ 'tagkinds' : 'm',
\ 'syntax_type' : 'match',
\ 'syntax_prefix' : '\.\@<=',
\ },
\ { 'hlgroup' : 'HighlighterPythonClass',
\ 'hlgroup_link' : 'Type',
\ 'tagkinds' : 'c',
\ }]
hlgroup
: Highlight group (required)hlgroup_link
: If it is set,highlight link
command will be executed.tagkinds
: Seectags --help
in terminal for details. (required)syntax_type
:keyword
(default) ormatch
. See:h syn_keyword
and:h syn_match
for details.syntax_prefix
: This is used only formatch
syntax type.syntax_suffix
: This is used only formatch
syntax type.
I added above customizations for following languages, referring to xolox/vim-easytags.
- Lua
- C
- C++
- PHP
- Python
- Java
- C#
- Ruby
- Perl
- Julia
Please see 'Setting for each language' section in autoload/highlighter.vim
for details.