Visual Mode Increment

In Vim patch 7.4.754, I noticed Vim now supports incrementing numbers in Visual mode. You can increment numbers by pressing CTRL-A, and decrement with CTRL-X. It's one of those features that doesn't sound amazingly useful but can be handy once you've memorised it. If you build off Vim's master branch you can try it out now.

Visual increment

To enter Visual mode, type CTRL-V (technically Visual mode blockwise). You can then use hjkl to select multiple lines, and increment the numbers on each line with CTRL-A. I thought this might be good for shifting sets of numbers in a numerical list, like you might find in a Markdown file for example.

Read More →

Reloading Your vimrc

If you're tinkering with Vim's config, did you know you can easily reload the settings file without restarting Vim? You basically just need to "source" the settings file: :source ~/.vimrc. You can use the abbreviated command, so it's just :so ~/.vimrc. If you use a plugin manager like Vundle and keep the list of plugins in ~/.vimrc, then you'll need to source it after changing the list of installed plugins. There's no need to quit and restart!

Once you get the hang of this, you'll find you just open vimrc during editing sessions, without opening a new terminal and a fresh Vim to edit something.

There's a really cool section in Learn Vimscript the Hard Way about editing your vimrc that suggests creating some handy mappings for opening and reloading the settings file.

Read More →

CTerm to GUI

I've seen some tools that map from Vim GUI themes to console, but what about the other way around? A reader sent in vim cterm2gui2cterm (GitHub: 97-109-107/vim_cterm2gui2cterm), a tool that maps from console themes to GUI themes and back again.

It's a Python script that has a dictionary that maps colours from the console number to a hex equivalent (xtermMap). It outputs the result in a cterm or vim colour scheme file, so you can easily load it as a colour scheme. It might be useful if you often switch between gVim and console Vim and want to unify the themes.

Read More →

Vim for iOS: ctags

Xcode has Vim emulation plugins, but you can get by quite nicely with Vim and xcodebuild. If you want better code navigation, however, what do you do? Colin Drake has written an article about using ctags for iOS development:

With implementation files, header files, and the numerous set of frameworks we use to build apps, I’ve always found auto-completion and code navigation to be particularly difficult when writing Objective-C, especially when dealing with larger projects.

To remedy this, I've started using a very old tool, called ctags. ctags is able to parse source code and index methods, functions, classes, etc. for quick access later. Modern versions of Vim are built with ctags support by default, so this makes for a very easy integration.

Read More →

Neovim's Smart UI Protocol

Thiago de Arruda posted about a new UI protocol for Neovim that aims to improve the amount of control native apps have over embedded Neovim:

The smart UI protocol will separate the drawing of window contents and other user interface elements such as completion boxes and window frames.

  • Embedders have complete freedom of how windows are displayed (custom decorators, floating windows...)

    Read More →


vim-tag-comment (GitHub: mvolkmann/vim-tag-comment, License: MIT) is another small but useful plugin by Mark Volkmann. This one adds/removes XML comments, but instead of adding a comment to each line it'll use one multi-line comment instead.

It's not quite as simple as wrapping a visual selection in the comment syntax, however. It'll try to wrap a given element, so if you've got nested elements they'll be included in the comment. The commands for this are ElementComment and ElementUncomment.

It comes with some built-in mappings:

Read More →


Tim Pope has just released a new plugin called Flagship (GitHub: tpope/vim-flagship, License: Vim). It makes customising the status line and tab line much easier, and other plugins can extend it as well. For example, if you've got fugitive.vim installed, then you should see the current Git branch in the status line.

This script isn't quite the same as the airline breed of plugins that use super fancy glyphs to make the status line look like a GUI. But it does integrate well with 'statusline' and makes the tab line saner.

The extension API is great for adding flags, but what if you want to change the core content? For the status line, Vim already provides a perfectly adequate 'statusline' option, and Flagship will use it in constructing its own. Customizing your status line is exactly the same with and without Flagship.

Read More →


Sometimes it's not clear if you should use a macro or a plugin for a common editing task. There are things that I'll instinctively create a macro for (:help complex-repeat), and others that are broad enough to be made into plugins. In those cases it's often best to search for a plugin first.

Here's one such example: Mark Volkmann's vim-js-arrow-function (GitHub: mvolkmann/vim-js-arrow-function). It's a small plugin, but does something broad enough that is safely tucked away in a plugin -- it turns anonymous JavaScript functions into their "fat arrow" equivalents.

In JavaScript you commonly pass anonymous functions to methods, like this:

Read More →

WASD Keyboards Vim Keys

I saw people talking about WASD Keyboards because apparently they now sell Vim layouts. WASD Keyboards sells mechanical keyboards, and part of the order process is a detailed customisation stage. You get all kinds of cool options, like switch type (Cherry Blue, Green, etc.), and even sound dampeners.

If you select the WASD V2 87-Key Custom Mechanical Keyboard, you should see "Vim Black" and "Vim White" under the "Alphanumeric Layout Style" section. Vim Black looks like this:

Read More →