Skip to content

Format/prettify xml#29

Open
tfnico wants to merge 1 commit into
sukima:masterfrom
tfnico:pretty-print-xml
Open

Format/prettify xml#29
tfnico wants to merge 1 commit into
sukima:masterfrom
tfnico:pretty-print-xml

Conversation

@tfnico

@tfnico tfnico commented Sep 11, 2013

Copy link
Copy Markdown
Collaborator

I expected xmledit to contain some shortcut for formatting or prettifying XML, but couldn't find any such feature.

So I just quickly copied in one I found in http://vim.wikia.com/wiki/Pretty-formatting_XML

Note that I've never done any vimscript before, this is just copying stuff in 🎱

Bind the suggestion from [1] <leader>x

[1] http://vim.wikia.com/wiki/Pretty-formatting_XML
@sukima

sukima commented Sep 11, 2013

Copy link
Copy Markdown
Owner

This is a nice feature. Where do we find xmllint? It is an external dependency.

Here is some ideas to improve this feature:

  • Really good documentation for others who want to use this feature.
  • Allow this feature to be enabled via a g:xmledit_enable_xmllint and / or g:xmledit_xmllint_path
  • Maybe a nice error message if xmllint isn;t installed on the system

@tfnico

tfnico commented Sep 11, 2013

Copy link
Copy Markdown
Collaborator Author

Perhaps we could fall back to doing some rudimentary regexp formatting if xmllint is not available?

@sukima

sukima commented Sep 12, 2013

Copy link
Copy Markdown
Owner

Regexp == Red Flags.

I think xmllint is the correct way to go. I'm assuming it does a lot more than just a few regexp replacements. Anyway, it is not unreasonable for a plugin like this to support an external program.

Maybe, instead, a simple check: IF g:xmledit_xmllint_path is defined OR xmllint is in the path THEN enable the mappings ELSE disable the mapping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants