Hermes

When I was at the Vim London meetup, one of the talks announced Hermes (GitHub: New-Bamboo / Hermes). This is a Vim, tmux, iTerm 2 environment for writing Ruby and JavaScript. The developers behind the project work for New-Bamboo, which is a company that specialises in Ruby web development.

Hermes is basically an installer based around manifest files, which are lists of either Homebrew dependencies or the dotfiles used by the project. The installer backs up existing dotfiles that would otherwise be overwritten.

As an example of the bundled dotfiles, the Hermes tmux.conf file has Vim mappings configured:

Read More →

Script Roundup: multichange.vim, vim-detailed

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

multichange.vim

Don't be shy about renaming things as you work.

-- From Organizing Go code

multichange.vim (GitHub: AndrewRadev / multichange.vim) by Andrew Radev is a plugin that makes renaming things a lot easier. By typing :Multichange, the plugin enters a mode that causes word changes to propagate through the current buffer.

Read More →

Vim 101: Managing Options

We've all been there: bursting with creativity, ready to roll, but held back by a configuration option. So we search: over to Stack Overflow, the Vim Tips wiki, and various forums and mailing lists. Then the answer is discovered: :set this-or-that, and it's added to our vimrc and forgotten about.

Like most things in Vim, you can get by this way for a certain amount of time, but there comes a point when you need to properly understand how to use this innocuous command. Everything I'm going to discuss here can be found in :help :set, so if you forget something in the future that's the easiest way to find an answer.

Options in Vim can be one of three types: boolean, number, or string. They work slightly differently, so it's a good idea to pay attention to the type of a given option. To check the type of an option, type :help 'option', and you'll see it displayed in the documentation. In general, options change Vim's behaviour. It's important to distinguish between options and variables, which are set with :let. If you're using a plugin, it's likely to be configured with :let rather than :set.

Read More →

Repeatability

As I noted in my review of Practical Vim, one of Drew Neil's most interesting tips for mastering Vim is to use repeatable commands. What isn't repeatable? Well, Drew's main example was using the mouse -- Vim's macros are based around text sequences, so it's impossible to record movements and selections made with the mouse.

Much like forcing yourself to learn hjkl, disabling the mouse and using console Vim may help you learn to exploit Vim's repeatable commands. Also, it's worth being aware of the range of commands that are repeatable. Although . can be used to repeat the last change, @: can repeat the last command-line, and ; will repeat the last f and t command. When searching, n will move to the next match, and substitutions with :s can be repeated with &. I covered this in Vim 101: Repeating Commands and Vim 101: Repeating Motions.

Repeating commands isn't just a clever trick, it's the basis of macros. What we call macros are called "complex repeats" in Vim: typing q causes Vim to record typed characters into a register, and then pressing q again stops recording. I wrote a brief introduction to this in Vim 101: A Gentle Introduction to Macros.

Read More →

Script Roundup: eunuch.vim, mozilla.vim

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

eunuch.vim

The wittily-named eunuch.vim (GitHub: tpope / vim-eunuch, License: Vim) by Tim Pope just reached version 1.0. It provides a set of wrappers around Unix commands to optimise them for a Vim-oriented workflow. For example: :Chmod changes the permissions on the current file, and :SudoWrite will write a file using sudo.

mozilla.vim

mozilla.vim is a collection of scripts related to working on Mozilla's various projects, put together by Fabien Cazenave. It includes C++ additions for Gecko components and macros, an updated syntax file with CSS3 and HTML5 support, and the author is currently looking for a JavaScript syntax file and other tools for working with ES6 and the latest DOM APIs.

Read More →

Vim 101: Version Information

Reading this article will teach you the following:

  • How to understand Vim's version information
  • How to check if a given build of Vim meets the requirements of a Vim script
  • How this relates to Vim's build process

Vim can be built in many different ways, so it's sometimes necessary to check how a particular build was compiled. Most of us install Vim through our operating system's package manager, so querying version information can be useful. To do this, type :version (alias: :ve), or run vim --version. A lot of text will be displayed, and I'll break it down below.

Let's say you've discovered a new Vim script that you want to try out, and the documentation says it requires Python support. Typing :ve in Vim will show either +python or -python. In my case I see +python, which means I can run plugins that use Python. There are also a lot of Ruby plugins out there, and my build shows +ruby.

Read More →

Book Review: Practical Vim

Practical Vim cover

There aren't a lot of great books about Vim. Learning the vi and Vim Editors published by O'Reilly is the most popular book, and while it's fairly detailed I've always felt it loses focus by including too much coverage of vi clones. The content is dry, feeling more like a standard manual than an affable educational guide.

In contrast, Practical Vim: Edit Text at the Speed of Thought (Amazon) by Drew Neil draws on the personality and experience of the author -- and this is a good thing. There was a lot of excitement around this book, as the author is behind the popular Vimcasts site. Drew has done a lot to make Vim accessible to more popular, and he's distilled all of this in Practical Vim.

Read More →

Script Roundup: vim-signature, vim-foldsearch

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

vim-signature

vim-signature (GitHub: kshenoy / vim-signature) by Kartik Shenoy can display marks and help navigate between them. This is similar to vim-showmarks, but removes the delay between setting and displaying marks, and adds navigate features inspired by mark-tools. It can also display multiple marks.

vim-foldsearch

vim-foldsearch (GitHub: embear / vim-foldsearch, License: GPL) by Markus Braun can fold lines based on a search pattern. This can be the word under the cursor, the last search pattern, a regular expression, or spelling errors.

The documentation includes suggested leader mappings, but the commands are easy to remember. Each command is two characters and starts with a F. For example, :Fp <pattern> will show lines matching <pattern>.

Read More →

10 Reasons to Learn Vim

Vim can be tough for beginners. If you're struggling along with my Vim 101 posts, but still haven't felt confident enough to use it every day, then my advice is to be patient. Here are some reasons to keep learning Vim.

1. Ubiquity

There are innovative editors out there apart from Vim. However, some are only available for a single platform. What happens if you invest time learning one of these editors, then get a new job where you can't use that platform?

If I got stuck in Windows on a job then I'd get straight to work using gVim. With Mac OS X I'm comfortable with console Vim. Both also run extremely well in Linux and the BSDs. I've even got Vim on my iOS and Android devices.

Read More →

Vim London

The Vim London Meetup is a new event organised by Drew Neil, with a launch party planned for Monday, October 29, 2012. They're currently looking for a location.

There are a lot of great regular events in London, I've been to a few of the London Hacker News meetups, and lots of programming language user groups. Hopefully Vim London will get off the ground to give us Vim addicts somewhere to drink too much and share techniques.

Read More →