highlighter.nvim


Ⅰ. 插件描述

Asynchronous syntax highlight engine for Neovim

Ⅱ. 基本信息

创建日期:  2016-10-18
使用用户:  3
Github星:  12
插件作者:  Keita Nakamura

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'keitanakamura/highlighter-nvim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'keitanakamura/highlighter-nvim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'keitanakamura/highlighter-nvim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/keitanakamura/highlighter.nvim

Ⅳ. 文档说明

# highlighter.nvim

Highlighter is an asynchronous syntax highlight engine (using ctags) for Neovim.

Features

  • 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.

Reguirements

Installation

For vim-plug

Plug 'KeitaNakamura/highlighter.nvim', { 'do': ':UpdateRemotePlugins' }

Usage

You can update the syntax highlight by using :HighlighterUpdate command.

Options

Languages that you want to disable syntax highlight

example:

let g:highlighter#disabled_languages = ['c', 'cpp'] " set `filetype`s

Automatic syntax highlight

let g:highlighter#auto_update = 0 " 0: disable (default), 1: after saving the file, 2: after saving and opening the file

Project root directory sign

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']

Customization

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: See ctags --help in terminal for details. (required)
  • syntax_type: keyword (default) or match. See :h syn_keyword and :h syn_match for details.
  • syntax_prefix: This is used only for match syntax type.
  • syntax_suffix: This is used only for match 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.

添加新评论