Increment only numbers matching regex in Vim

Long-time vim or neovim users are probably already aware that visually selecting a block of text then pressing CTRL + A in vim will result in any numbers in the selected block of text being incremented by 1. This works even if the block contains non-numeric text: each group of digits gets treated as a number and is incremented.1

For example, here’s a video that shows what happens when you select some text in vim and then use CTRL + A to increment the values:

Continue reading


  1. To be pedantic, only the first group-of-digits/number on each line gets incremented; like many vim commands this only works on the first match per line of text unless some sort /g global modifier is used. 

Using Bad Word Filters to Boost SEO & Productivity

If you’re a webmaster, administrator, or moderator of any large blog, forum, or other community site, you’ll find that a lot of time is wasted spelling out URIs to various useful links, whether they’re to guides, reviews, downloads, or forms. On a big website with lots of members (especially that kind that don’t use the search feature), you’ll find that dozens of hours or more are wasted looking up and writing these URIs for your readers/members to follow.

Compare [url=http://neosmart.net/wiki/display/EBCD/Windows+XP]Windows XP dual-boot guide[/url] to XP dboot — it doesn’t take a rocket scientist to figure out which is easier, quicker, and simpler to use. But of course, your readers have no idea what “dboot guide” is or where they can find it – that’s where the “bad word filters” come in.

Most forums, blogs, wikis, and just about any other “web platform engines” have a plugin, module, or admin center feature to enable the filtering of swear words and their ilk. Simply create a new entry that replaces a quick and easy-to-remember “keyword” with a fully-formatted link of your choice. You can replace “qwerty” with “The quick brown fox jumps over the lazy dog” or (much more usefully) replace things like “gsearch ” with “http://www.google.com/search?q=” which lets you type things like “gsearch EasyBCD” and have them automagically replaced with the appropriate link.

You can use this to boost productivity (by speeding up the process of finding, posting, and formatting links) and to increase SEO (by converting keywords to internal links to the respective pages). For instance, replacing all instances of “NeoSmart Technologies” with NeoSmart Technologies:

<a href="http://neosmart.net/" title="NeoSmart Technologies" style="color: red; font-weight: bold" rel="follow">NeoSmart Technologies</a>

Continue reading