Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format/prettify xml #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

tfnico
Copy link
Collaborator

@tfnico tfnico commented Sep 11, 2013

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
Copy link
Owner

sukima commented Sep 11, 2013

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
Copy link
Collaborator Author

tfnico commented Sep 11, 2013

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

@sukima
Copy link
Owner

sukima commented Sep 12, 2013

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