Running Sparkup Vim Plug-in on Arch Linux

The sparkup plugin for vim lets you write HTML markup faster by Zen Coding, in which you write short code, resembling CSS selectors, which is then expanded to HTML by the editor. For example, writing

div#nav>ul#menu>li.item*3

would give you:

<div id="nav">
    <ul id="menu">
        <li class="item"></li>
        <li class="item"></li>
        <li class="item"></li>
    </ul>
</div>

This is obviously extremely useful, as it saves a lot of typing. However, I encountered a bit of trouble using this plugin on my laptop, which runs on Arch Linux. It’s easily solved though.

The problem is that the plugin is written in python 2, which is an older version of python, however still the most widely used, because most systems with python installed have python 2. But, because one of the key points of Arch Linux is to have up-to-date software, the default python is python 3, so typing “python” in Arch Linux would run python 3, whereas the same command on another system, like Debian, would run python 2 and the sparkup plugin is not compatible with python 3, so you get lovely errors like :call <SNR>63_Sparkup() shell returned 1.

Of course python 2 is still available in Arch Linux, in a package cleverly named python2, so you just need to pacman -S python2 to get it. Now, python myscript.py runs your script with python 3 and python2 myscript.py runs your code with python 2, and you just need to do two things:

  1. Find the line in sparkup.vim where python is called and change it to python2
  2. change the shebang line in sparkup.py to use python2 instead of python, i.e. #!/usr/bin/env python2

and then it should all work fine! 🙂

3 thoughts on “Running Sparkup Vim Plug-in on Arch Linux

  1. If you don’t want to edit your scripts and plugins to call python2, there are a few alternative hacks you can do to your local environment. I have a number of scripts at work that assume 2.x, so I just put a symlink named “python” in my user’s PATH and point it to python2. Now everything I run redirects automatically, but the rest of my system is unaffected. See also https://wiki.archlinux.org/index.php/Python#Dealing_with_version_problem_in_build_scripts

  2. After I initially commented I seem to have clicked the -Notify me whwn new comments are added- checkbox and now eaach time a comment is added I receive four emails with the exact
    same comment. Is there aan easy method you can remove me from that service?
    Cheers!

Comments are closed.