我需要使用通常的方式在 vim 中运行 tidy:
:compile tidy
:make
但是,如果我在一个 utf-8 文件上,我会得到错误,如果我在 vim 之外运行 tidy,我看不到,即,
tidy -e -q -utf8 <filename>
我得到了我所期待的
My Vim script skills do not go far enough to have a general solution ready, but what you can do when editing a utf-8 file:
:compiler tidy
:setlocal makeprg=<TAB> [and edit the tidy command line to include -utf8]
:make
Explanation:
":compile tidy" just executes the compiler plugin file for tidy and does setlocal to set makeprg to tidy call with some options (-q -e --gnu-emacs yes). Apparently for utf-8 files tidy needs the additional option -utf8, so you have to set this manually. Afterwards you call :make as normal.
If you are only editing utf8 files, you can of course edit the tidy compiler plugin file directly and hard code the -utf8 option to tidy there. Use the following to edit the plugin file
:e $VIMRUNTIME/compiler/tidy.vim