3
04
2011
Vim XPath Plugin
Posted by Dave | Tags: plugin, vim, xml, xpathI’ve built a plugin that adds XPath search functionality to Vim. Check out the demo video below.
Features:
- Quick XPath search input with smart, context-sensitive tab completion
- Results shown in a pop-up results window. Jump to the line of a matching result easily.
- Debug invalid XML – jump to the the line number of an XML error from the results window
Requirements:
- Python support enabled in Vim
- lxml library installed for Python (ideally 2.7 or higher).
For more info, and to grab the plugin by downloading the vimball, visit my github:
https://github.com/actionshrimp/vim-xpath
Let me know what you think / any improvement suggestions in the comments below.
Hello,
I would like to use your XPath Vim plug-in but I am not able to get it to load. I get this message:
–
Error detected while processing /Users/Armando/.vim/bundle/actionshrimp-vim-xpath-26a7cb7/plugin/xpath.vim:
line 24:
XPath plugin not loaded – python lxml is required
–
I installed lxml and can import it in console mode.
I would appreciate any help you can give me troubleshooting this problem.
I’m running MacVim on Snow Leopard
Thank you!
Armando
Hmm, very strange Armando! I take it that when you say you can import from console you mean on the python prompt – what happens when in vim you try doing
:python import lxml
?
I have the same problem
When I :python import lxml
I get no message at all.
I have lxml installed with python 2.7, vim is also built with +python
Running MacVim on Lion
Turns out, the lxml version that I have doesn’t have lxml.etree.
The code relies on methods in that specific etree implementation (as opposed to others in lxml like xml.etree.cElementTree)
Glad it’s sorted Marc – I should probably tidy it up so it can use either etree implementation. Out of interest where did you get the version of lxml without etree? All the versions on their page seem to include it, was it an older version bundled with a package manager or something?
I did a brew install on the Mac and that’s what I ended up with.
I’m not quite sure how to go about nuking it correctly and getting the ‘correct’ one.