Custom Motions Part 1

I'm doing a talk about custom motions at the next Vim London meetup, which I'm looking forward to. Why did I pick the topic "custom motions"? Well, mainly because it'll force the audience to revise modes, operators, motions, and Vim's grammar.

Drew Neil is one of the organizers of this group, and I'm going to use his Practical Vim book as a reference. Not specifically to explain custom motions -- mainly because it contains useful quotes that explain the underlying concepts. For example:

If we think of Vim as a finite-state machine, then Operator-Pending mode is a state that accepts only motion commands. It is activated when we invoke an operator command...

Read More →

Script Roundup: Supertab, scriptease.vim

Send in your Vim scripts for review through our contact form or @vimnews.

Supertab

Supertab (GitHub: ervandew / supertab, License: BSD) by Eric Van Dewoestine and created by Gergely Kontra is a plugin for invoking completion in Insert mode with the <Tab> key. It knows when not to invoke completion, but has a setting for preventing <Tab> from completing.

It's actually been kicking around since 2006, so over time it's grown to include several settings which are fully documented. For example, the first completion entry can be preselected, and completion functions can be chained together.

scriptease.vim

"Enjoy this amalgamation of crap I use for editing runtime files," says Tim Pope, about scriptease.vim (GitHub: tpope / vim-scriptease, License: Vim). It includes lots of useful functions for plugin developers, like :PP {expr} -- pretty print, :Time {command} -- a simple benchmarking function, zS -- show the active syntax highlighting groups under the cursor.

Read More →

Vim 101: The Core Skills

If you're like me, when you learn something new you rush straight in without a strategy -- picking up things as you go, using newly learned skills for practical work as soon as possible. The danger of this approach is you can miss out on some core skills, and develop bad habits. So what are the essential skills required to learn Vim?

As an experiment, I decided to write a list of what I consider the core skills for working with Vim. You can find the full list at the end of this article. It doesn't contain everything ever -- just the things I use on a daily basis. It will put you off from learning Vim! In one sense it's long and intimidating, in other it's testament to just how ridiculously flexible and powerful Vim is. However, you can learn everything on this list. Even being vaguely aware of the key topics will give you pointers on how to use Vim more productively.

Most books and tutorials focus on editing with Vim, but there's a lot more to daily work than editing. To master Vim you need to optimise your entire workflow, and that means configuring the editor, navigating between files, and even visualising the structure of projects and their myriad components.

Read More →

Universal Settings: sensible.vim

sensible.vim (License: Vim) by Tim Pope is a selection of default settings:

Think of sensible.vim as one step above 'nocompatible' mode: a universal set of defaults that (hopefully) everyone can agree on.

Tim suggests that it can be used by beginners who are new to Vim, without relying on "some random vimrc you found". The settings aren't a million miles off my own .vimrc, to the point that I'm wondering if I should just start using sensible.vim and clean it up a little bit.

Read More →

Script Roundup: vim-steam, File Pirate

Send in your Vim scripts for review through our contact form or @vimnews.

vim-steam

vim-steam (GitHub: raphaelr / vim-steam, License: New BSD) by Raphael Robatsch is capable of launching your Steam games, with tab completion! It uses Ruby to parse and launch the games -- if you look at the source the vdf.treetop file is a Treetop grammar for pulling out titles from Steam's cache.

It currently works in Windows, but the author is also working on Linux support.

File Pirate

File Pirate (GitHub: nfd / filepirate, License: MIT) by Nicholas FitzRoy-Dale is a fuzzy file finder designed purely for speed. It requires Python, and works using a window that appears at the top of the screen. It doesn't automatically reindex files when directories change, so you'll have to press CTRL-R to make it update them. It is, however, asynchronous -- searching an indexing runs in the background, so you can continue to use Vim without it blocking.

Read More →

Vim 101: Jumping Between Files

If you were born and raised on GUI editors, switching to the console and Vim feels like it lacks some of the speed of file navigation. Vim has a lot of different ways to quickly flip between files, and one that I like is the gf command (:help gf).

When in Normal mode, typing gf over text that refers to a file name will cause Vim to attempt to open that file. This is great when working with programming languages that include or require files relative to the current working directory.

By default, however, gf needs a little bit of assistance to find files. Let's say you're working on a project that's written with Node. In Node, files are referred to like this:

Read More →

VimClojure Winding Down

In On the state of VimClojure, Meikel Brandmeyer recommends using Tim Pope's foreplay.vim and Sung Pae's vim-clojure-static as an alternative to VimClojure, because he intends to step back from the project:

"That all said I still have some ideas on Clojure tooling I want to experiment with. So I will continue to work on the interactive part of VimClojure, but things will probably move in a much slower pace compared to the other projects."

So it's not exactly time to say goodbye to VimClojure, but the author himself is recommending moving to other projects.

Read More →

Plugins of The Year

Looking back over the past 40 or so script roundup posts, it's impressive just how much activity there is in the Vim plugins community. It really takes me no effort at all to find new and interesting scripts to write about.

Here are a few of my favourites that I covered in 2012.

EasyMotion

EasyMotion (GitHub: Lokaltog / vim-easymotion) by Kim Silkebaekken (who also wrote Powerline) helps make Vim's motions easier to visualise by highlighting the possible choices for motions like f:

Read More →

Vim 101: runtimepath

Vim looks for scripts and documentation in various directories, both in your home directory and system-wide. This is controlled by the 'runtimepath' option.

Depending on your system, the 'runtimepath' option will be set to several paths, separated by commas. Typing :set runtimepath? will display it. At the end of this list should be some 'after' directories:

runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after

Typing :help 'rtp' will show documentation that includes a list of every type of file that Vim searches for, as well as the standard locations.

Read More →

MacVim Updates

MacVim snapshot 66 was released earlier this month, which has some bug fixes and updates Vim to 7.3.754.

Bjorn has also moved the binary releases to Google Code, because GitHub has stopped hosting binaries. If you're looking for the latest MacVim release, remember to download it from here: code.google.com/p/macvim/downloads/list.

MacVim development continues on GitHub.

Read More →