tags:

views:

675

answers:

1

I need to run tidy in vim, using the usual:

:compile tidy :make

However, if I'm on an utf-8 file, I get errors that I don't see if I run tidy outside of vim, i.e.,

tidy -e -q -utf8

I get what I'm expecting

TIA!

+1  A: 

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
That is excellent, thanks and I confirmed it works. Can I modify my .vimrc instead, making this more portable?
figgles
That depends. If you are only using the tidy compiler, you can probably get away with putting "compiler tidy" and "set makeprg=..." hard coded into your .vimrc. What might be in general be a good idea is to contact the maintainer of tidy.vim (you can find the name at the top of the tidy.vim file), maybe he has some general solution to your problem.