Ⅰ. 插件描述
C++ semantic highlighting for VimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'davits/dyevim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'davits/dyevim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'davits/dyevim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/davits/dyevim
Ⅳ. 文档说明
DyeVim: C++ semantic highlighting for Vim
Pictures worth a thousand words:

Features
Currently it can differentiate and higlight the following C++ idioms:
Namespace
Class, Struct, Union, TypeAlias
Variable, GlobalVariable, MemberVariable, StaticMemberVariable
Function, MemberFunction, StaticMemberFunction
FunctionParameter
Enumeration, Enumerator
TemplateParameter, TemplateNonTypeParameter
Macro, PreprocessingDirective
It also greys out the skipped ranges between #ifdef...#endif preprocessing directives.
How it works
Semantic tokens are provided by the clang,
extracted by the ycmd and obtained via
YouCompleteMe plugin's frontend API,
so in order to work DyeVim requires YouCompleteMe plugin to be installed.
Currently I am maintaining my own forks for
ycmd and
YouCompleteMe with changes required
for the semantic tokens to work, but I hope that in time these changes will be
merged back.
Setup
DyeVim works out of box and does not require any special configuration
(assuming that YouCompleteMe is up and working normal), the only requirement
is that it should be added to the Vim's runtimepath after YouCompleteMe.
If you are using Vundle:
Plugin davits/YouCompleteMe
Plugin davits/DyeVim
Currently only 2 colorschemes are supported: solarized and wombat256mod.
If your colorscheme is not supported DyeVim will try its best to highlight
your code by adding bold and italic modifiers to the existing colors.
You can also place your own coloring scheme in the autoload/dyevim/ft/cpp
directory, named your_colorscheme.vim (see existing ones as an example).
Options
The g:dyevim_timeout option
This option sets query timeout in milliseconds for the tokens and
skipped ranges. Note that request is a blocking operation and for worst case
scenario Vim will be blocked by the specified amount, so it is not recomended to
set timeout to >50 values.
Default: 10
let g:dyevim_timeout = 10Caveats
Since I mainly use gvim in my workflow, there is no terminal support... yet,
sorry for that.
Acknowledgements
Thanks to the YouCompleteMe
maintainers team for the inspiration, help and support.
I walked the path prepared by the
color_coded plugin.