Vim Bootstrap

Vim Bootstrap is a web app that helps you to quickly generate a new .vimrc. It allows you to select from a list of programming languages, then creates a file that includes the appropriate NeoBundle dependencies.

To use the file, copy it to ~/.vimrc and then install the dependencies with vim +NeoBundleInstall +qall.

Vim Bootstrap supports further customisation through an optional .vimrc.local file, so you don't need to modify the original.

Read More →

Windows Font Rendering Improvements

I noticed patch 7.4.393 has support for improved font rendering in Windows:

Problem: Text drawing on newer MS-Windows systems is suboptimal. Some multi-byte characters are not displayed, even though the same font in Notepad can display them. (Srinath Avadhanula).

Solution: Add the 'renderoptions' option to enable Direct-X drawing. (Taro Muraoka)

Read More →

Script Roundup: Vimproc, vCoolor

Vimproc

Vimproc (License: MIT) by Shougo is an asynchronous process manager. It's a fork of Yukihiro Nakadaira's proc.vim, and requires compilation to run.

Once it's installed, you can run :VimProcBang to run a command and echo the results. You can also run :VimProcRead to paste the output of a command in the current buffer.

It also includes functions like vimproc#open and vimproc#system, so you could use it to build other plugins.

Read More →

Crazy Escape Key Mappings

One of my colleagues asked me about whether jk is a good mapping for escape. I've always used <Esc> for leaving Insert mode, but I don't think it's unreasonable to want to use a key combination that's easier to press.

If you want to try jk, then you need to imap it:

:imap jk <Esc>

Avoid the escape key on the Vim Wiki has lots more examples, including <Space> for entering Insert mode.

Read More →

A Vim-inspired Mac Window Manager

In Mac OS X, window management is pretty horrible. If you switch between a laptop and external monitor display, then the windows seem to get squashed and you have to manually resize them. Also, maximise is purely advisory and rarely does what you might expect. I just pressed maximise in Finder and it made the window thinner, so who knows how it's supposed to work.

That means power users install "window managers". They're not window managers like the X11 type, they're utilities for making window positioning more bearable. I use Spectacle so I can quickly maximise iTerm, and occasionally fill two windows across the left and right portions of the screen. Spectacle is open source, and it's customisable as well.

Spectacle

Read More →

Script Roundup: a_pair

a_pair

a_pair by Colin Cai combines the brackets {}, [], and () into a text object called ap. That means if you've got sets of nested brackets you can operate on multiple levels at once.

I thought this might be useful if you're working with JSON documents, where you can often find arrays nested inside objects.

Read More →

Flat Vim Icons

Flat Vim icons

When you've carefully curated your desktop wallpaper, terminal colours, and system icons, it's a little bit annoying when one of your icons stands out. So if your gVim or MacVim icon looks too retro, then just switch to terminal Vim for everything!

Or, try one of these new flat icon designs:

Read More →

Vim and TypeScript

TypeScript has a rich type system that can be used by compilers and IDEs to infer things about method and object usage. If you write TypeScript in Visual Studio, then you get IntelliSense completion and hints as you work. Due to the design of the language, the hints can actually help you how to use and navigate around code.

Vim's Omni completion supports several languages, including C and JavaScript, but it can't do deeper IntelliSense-like completion and documentation.

The way people usually solve this is to run a "server" that can index your code, providing language-specific features that Vim doesn't support. Then a Vim script is used to send queries to the server. typescript-tools by Claus Reinke does exactly that, with its TypeScript server (tss).

Read More →

Script Roundup: textobj-delimited

textobj-delimited

textobj-delimited (GitHub: machakann / vim-textobj-delimited, License: NYSL) by Masaaki Nakamura makes textobjects work better with delimited strings. The default mappings are id, ad, iD, and aD. Visual mode is supported as well.

By passing a change command, like d for example, you can manipulate text based on the recognised separators. Given a string like foo_bar_baz, d3id would move the cursor to the last separator and delete the remaining text, resulting in foo_bar_.

Given the same string, vid would select the "inner" text between two separators. So in the case of foo_bar_baz, with the cursor on b, bar would be selected.

Read More →

Peer to Peer

Peer to Peer

Peer to Peer has launched! This is a service by Drew Neil of Vimcasts. The idea is that an expert demonstrates how they solve problems using their preferred tools, while they're filmed both in-person and on-screen.

The first episode is Counting Tree Nodes with Tom Stuart. Tom uses Vim, and you can see him using it to write a Ruby project that uses Cucumber, Rspec, and immutable data structure APIs.

Read More →