Send in your Vim scripts for review through our contact form.
Vimpanel
Vimpanel (GitHub: mihaifm / vimpanel) by "mihaifm" is a new tree explorer, influenced by NERD Tree. Panels can be created based around projects, and can be comprised of different folders and files as required. Sessions are supported, so the state of panels and windows can be reloaded after exiting Vim.
Vimpanel is more like the project navigation panels found in GUI text editors like Sublime Text or TextMate, rather than being purely oriented around file system navigation.
Seek
Seek (GitHub: goldfeld / vim-seek, License: Vim) by Vic Goldfeld shows we still haven't mined the depths of the flexibility provided by the concept of motions. It provides a new motion, s, which works like f. Where f takes a single character as an argument to jump to the next occurrence, Seek takes two characters, thereby reducing the number of potential matches.
Continuing on from last week's Vim 101 on tags, another useful element to a tag-based workflow is the preview window (:help preview-window). There's only ever one preview window per tab page, and it can be used to display tag definitions without interruption.
Typing :ptag tagname will open the preview window for "tagname". If you follow through last week's tutorial using Vim's source, you could type :ptag curbuf to see the definition of EXTERN buf_T in src/globals.h. When the window opens, it won't steal focus, which makes it essential for quickly looking up function signatures without wrecking your concentration when you need to navigate back.
If you type :ptag again, Vim will display "tag 1 of 2 or more" (this will be automatically displayed when there's no other message). Typing :ptnext or :ptprevious allows you to navigate between the matching tags.
Powerline has been rewritten in Python. The old Vim script version is still available at Lokaltog / vim-powerline. There was a discussion last year, Port core code to Python, where Lokaltog (Kim Silkebækken) discussed the merits of porting the core of Powerline to Python. As a result, the same statusline effect can be applied elsewhere: Zsh, Bash, and tmux are all supported.
The only slight wrinkle in this new version, however, is Python on Macs. The Powerline installation instructions have the innocuous line: pip install git+git://github.com/Lokaltog/powerline. Let's just say if you're using a Mac, you may be in for a bit of extra work. It's possible your Vim has been built with a different Python than the one pip uses. You might have even installed Python with Homebrew, and you could have even installed Vim Homebrew as well. Either way: your particular environment might not work out of the box.
If you do have problems running the new Powerline, this comment in the GitHub repository explores it in some detail: Mac OSX 10.8.2 (Fails to load properly). The thing to do is type :python import sys; print(sys.path) from within Vim to determine which site-packages folder should be used to install the Powerline Python module.
togglecursor (GitHub: jszakmeister / vim-togglecursor, License: Vim) by John Szakmeister will change the cursor to a caret-style graphic when entering insert mode in iTerm and Konsole. I tested it in iTerm2 and it works. I'm not sure how I feel about it though, it makes the cursor harder to see on my screen which is probably a bad idea.
The script itself takes into account tmux, and I confirmed it works with Vim in tmux as well.
jk-jumps
jk-jumps (GitHub: teranex / jk-jumps.vim, License: Vim) by Jeroen Budts makes j and k add entries into the jumplist, so they behave more like jump motions (:help jump-motions). If I'm reading the source correctly, it remaps j and k to work using the G command, which modifies the jumplist.
A big part of editing that often gets overlooked is file navigation. Effective file navigation is a skill that can help improve productivity, but also aids visualisation of a project.
Vim's bare interface belies a wealth of hidden functionality that can help you dart around a project like a fake US crime drama hacker. One key feature is support for tag files. Tag files are simple text files that list "language objects" alongside file names and locations. It's very much like an index in a book, except it's generally interpreted by software rather than human readers.
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...
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.
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.
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.
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.