vimsparkup

vim sparkup item number in content


Using the sparkup plugin for vim (specifically vim-gnome on Ubuntu 15.04, although I doubt that matters), I am generating a list with item numbers:

ion-content.has-tabs > .list > a.item[href=#/item/$]{Item $}*3

The result substitutes the item number in [href=#/item/$] but not in {Item $}:

<ion-content class="has-tabs"> <div class="list"> <a href="#/item/1" class="item">Item $</a> <a href="#/item/2" class="item">Item $</a> <a href="#/item/3" class="item">Item $</a> </div> </ion-content>

Feature, bug, or user error?


Solution

  • I am afriad that this plugin deems the $ in curly braces as a text which should not be affected. To numerate your Item $ list, you can try this command

    :let @a=1 | %s/\$/\=(@a+setreg('a',@a+1))/g
    

    or for selected block in visual mode

    :let @a=1 | '<,'>s/\$/\=(@a+setreg('a',@a+1))/g