Any ideas on how to use xmllint, but change the tab/indent width? It seems to filter, on windows, with 2 spaces for a tab.Ī. is there another XML reformatter more suitable for producing output that Vim can use?Ī: I will change the solution described at the above URL since there is a very simple solution to the problem: The xmllint developer knows about this issue but feels that adding an option to keep/not keep UTF-8 would complicate the code too much. This isn't a problem if you're taking the input of xmllint and editing it with an XML editor that internally converts everything to UTF-8 (like XMetal), but if what you want to do is use Vim to edit the file as a native UTF-8 (with :set encoding=utf8), then you *don't* want a bunch of numeric references instead of Unicode. Q: One problem with "xmllint -format" is that it turns non-ASCII UTF-8 characters into numeric references. Here's how you use tidy with xml on Windows:Īu FileType xml exe ":silent 1,$!tidy -q -i -xml" Copy indent/xml.vim to ~/.vim/xml.vim (Unix systems) and change the line that says: A simple fix for single line comments can be made in indent/xml.vim. "xmllint -format" indents comment lines to 0 which screws up the formatting for vim. If not, I am sure you can find something to take its place.the tip is just that, a tip, build on it. As far as I know, xmllint can be run in windows if you have gcc, but I am just projecting.look into it. This tells it to dump the file contents to the stdin pipe for xmllint. Let &l:equalprg='xmllint -format -recover -'Ī: Yes, xmllint can read from stdin, please note the '-' that occurs at the end of the options. Let&l:equalprg='xmllint -format -recover'īut it didn't work since xmllint doesn't take STDIN?Ī: Notice the '-' given as the file argument to xmllint. When you are in command mode and press Vim will run all of the lines in the current file through the xmllint command. If you don't want the XML file to be automatically formatted as soon as you edit it, you can create a map by putting the following command in your vimrc: 1.4.1 Alternative xmllint Windows binaries and instructions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |