Ⅰ. 插件描述
Some vim scripts for CONLL-U syntax highlighting and perhaps syntastic checking as wellⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'flammie/vim-conllu'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'flammie/vim-conllu'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'flammie/vim-conllu'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/flammie/vim-conllu
Ⅳ. 文档说明
# vim-conllu
Some vim scripts for working with CONLL-U files, e.g. universal dependencies
- Works for version 2, as detailed in
https://universaldependencies.org/format.html
Installation
Vundle should just work, add this to your plugins in .vimrc:
Plugin 'flammie/vim-conllu'If you don't use Vundle, you can copy the files manually, e.g.:
cp plugin/conllu.vim ~/.vim/plugin/
cp syntax/conllu.vim ~/.vim/syntax/
mkdir -p ~/.vim/syntax_checkers/conllu
cp syntax_checkers/conllu/validate.vim ~/.vim/syntax_checkers/conllu/
mkdir -p ~/.vim/ale_linters/conllu
cp ale_linters/conllu/validate.vim ~/.vim/ale_linters/conllu/Plugin
The plugin is just there to register filetypes and .conllu extension and etc.
Syntax highlighting
There's nothing really advanced here, I've just listed the known names and
values as keywords to be highlighted, so if I typo something it will be
- The syntax highlighter does not count columns or anything. It
- knows the special comment names and the format of index numbers also for
ellipses and multiwords.
Syntax checking
Syntax checking is done with validate.py from UD repo, to have it work you need to
go to https://github.com/universaldependencies/tools and get the validate.py.
ALE
There's an ALE plugin for automatic syntax
- It uses validate.py only at the moment. You need to set the following
- for it to work:
ale_conllu_validate_executableneeds to point tovalidate.pyale_conllu_validate_optionsneeds to contain at least the lang option
E.g.:
let g:ale_conllu_validate_executable = $HOME . '/github/universaldependencies/tools/validate.py'
let g:ale_conllu_validate_options = '--lang olo'Syntastic
There's a syntastic script that gets
registered as conllu/validate, you have to add it to syntastic registry to enable
automatic checking on write manually.
NB: the --lang en is hard-coded... not sure there's any easy way around it.
You need to copy validate.py into $PATH as conllu_validate.py. The syntastic
stuff has been replaced by ALE and is no longer developed.