Putting Text in Insert and Replace Mode

One of my colleagues asked me how to paste over text in Vim. There are three steps to this:

  1. Enter the right mode (Replace): R
  2. Invoke the Insert/Replace mode's "insert register contents" command: CTRL-R
  3. Press the key for a register: " for the last delete or yank, or * for the system clipboard

I'd wager that Replace mode is quite underused, and CTRL-R is even less common. If CTRL-R is new to you, the help page is available at :help i_CTRL-R -- notice the preceding i_ for "Insert mode". This is a good command to learn because it means you can paste registers during editing, but you should generally prefer using Normal mode for yank/put because you'll get a more fine grained undo history.

Also, if you're not used to "registers" and are a little scared off by the terminology, just remember that they're only like extra copy and paste buffers and get filled when you perform certain operations. You can worry about what registers really are once you've got used to the basics.

Read More →

Vim Web Development Icons

If you're a fan of NERDTree, patched fonts, and vim-airline, then you might like Ryan L McIntyre's vim-webdevicons (GitHub: ryanoasis/vim-webdevicons, License: MIT). It adds icons for web development-related file types, and includes things like an image icon, logos for programming languages, and even some logos for templating languages.


You can configure whether or not icons appear in NERDTree or airline individually, and you can also configure the amount of space glyphs get. There are character mapping settings that let you change the default character, or use custom characters as well.

Read More →

Athame: Vim for Readline

If you use readline's Vim mode, then you might be interested in athame. This project is a patch for readline that embeds Vim, so you can use Vim's full editing capabilities rather than the more limited vi-mode subset that readline provides.

It uses the same author's Vimbed project, which is used by Pterosaur. Athame works by sending keys to an instance of Vim, which means you can search history using / and ?.

Because one of the advantages of Neovim is embedding, I wondered what a similar Neovim/readline fork would look like. However, it might be possible to approach the problem differently: use a Vim script to communicate with a Neovim :terminal.

Read More →

Neovim: Mac GUI, Rust IDE, and More

There hasn't been a Neovim update since last year, so I was pleased to see Newsletter #5 - Out of the Box. This edition has some interesting news about embedding Neovim: there's a Rust IDE called SolidOak that uses an embedded Neovim, and a new Mac OS X GUI for Neovim. The Mac app has build instructions in the readme, and it currently supports mouse input, tabs, and has Mac GUI features like menus and font options.

Neovim Mac

I managed to get it to run, but I had to update msgpack from Homebrew first.

Read More →

Color Coded: A Plugin for Semantic Highlighting

The author of color_coded has really gone the extra mile to implement more semantic highlighting for the C family of languages. To provide real-time tagless highlighting, it actually uses a self-contained clang 3.6.0 (due to bugs in clang). It works with C, C++, and Objective-C.

It highlights as you type, which means it has to know how your program is built. You can add a .color_coded file to your project to give it compiler options.

This plugin adds highlighting groups, and these new groups are based on libclang's internals. The groups can be found in after/syntax/color_coded.vim.

Read More →

Neovim Terminal PR Merged

The pull request to add a terminal emulator to Neovim has been merged into master. That means you can now use a terminal from within Neovim!

nvim terminal

There are several ways to start a "terminal buffer", one is to open a file that starts with term://. For example, :e term://zsh. You can send input to the terminal by entering Insert mode -- Neovim just forwards key presses to the terminal process.

Read More →

Script Roundup: vim-showspaces, ColumnTags.vim


If you've got a colleague who just can't stop messing up whitespace, then you may want to politely suggest (or surreptitiously install) Laurent Georget's ShowSpaces (GitHub: guiniol/vim-showspaces) plugin.

It's a small albeit focused plugin that shows whitespace at the beginning of lines. You can change the highlight colour and turn it off -- the full details are in the readme and bundled documentation.


ColumnTags (GitHub: kbairak/ColumnTags.vim) by Konstantinos Bairaktaris is a plugin that uses ctags with split windows to allow you to navigate code.

Read More →

vi-mode for oh-my-zsh

Here's a debate with no right answer: should you use default keybindings or highly customised ones that you prefer? I have tmux set up to use vi-like keybindings, and I have a few vi-inspired tweaks for zsh as well. Now whenever I switch to a colleague's machine that uses tmux I struggle for a few minutes to get used to the standard shortcuts.

If, like me, you like to customise everything, then you might be interested new oh-my-zsh vi-mode changes. There are pull requests for these changes on GitHub, in case you want to help test.

I've summarised the recent changes below:

Read More →

Vim is on GitHub

Google Code is shutting down, so Vim is finally moving to GitHub! You can find it at vim/vim.

I found this through the vim dev group. Given that almost every Vim script that I write about is hosted on GitHub, is seems clear that the community at large prefers GitHub. So why was Vim so slow to follow everyone else? Bram Moolenaar said the following on the vim dev mailing list:

This is not without disadvantages, since it means moving from Mercurial to git. Some may like this, some not. Will take some getting used to. I personally prefer the Mercurial commands, they are more obvious to use.

Read More →