MacVim in Yosemite


If you've updated to Mac OS X Yosemite MacVim won't display a window, then try reinstalling it with brew install macvim. There's a discussion about it on the macvim issues page. The latest release is quite old (Snapshot 73), which you can download directly from here: b4winckler / macvim / releases. Using brew cask install displays an error saying you should use brew install macvim.

The GitHub pull requests for MacVim include this one: Refactor/adapt to yosemite #45. It has UI modifications, like updating the close button and changing the new tab icon.

Read More →

Share Vimrc Snippets with vimrcfu

vimrc fu

Florian Beer sent in vimrcfu, a site for sharing Vim configuration snippets. You can up and down-vote each snippet, and share new ones by signing in with GitHub.

Florian said he created the site as a way to learn more Vim. He's looking for snippets, so please help him by adding some of your favourites!

Read More →

Manage Files in Vim with vimdir

vimdir.vim (GitHub: c0r73x / vimdir.vim, License: MIT) by Christian Persson is a plugin that allows you to manage files and directories in Vim. You can list files and folders recursively with :VimdirR, and then edit the buffer to change the layout of the filesystem.

For example, :Vimdir will list the files in the current directory. You can then use Vim's search tools to find a particular file and dd to delete the line. Saving the buffer will cause vimdir to persist the changes. It'll even delete directories, so you should be careful when using it.

If you're totally taken by the idea of a buffer-based file manager, then you can even use the vimdir script to pull up Vim with vimdir when by typing vimdir in the terminal.

Read More →

The Power of C

Seasoned Vim vets will tell you to stay out of Insert mode as much as possible. It's hard to master, but will make your edits more resilient to mistakes and more reusable with repeats.

To reach this goal you need to master entering and exiting Insert mode. One command that makes entering Insert mode better is the change command, which you can issue by pressing c. It accepts a motion, so you can change a word under the cursor cw, or even change up to a specific character (cfx where x is the character). The power lies in your understanding of motions.

Like d there are shortcuts: cc deletes the current line and starts Insert mode. I often C which deletes from the cursor position to the end of the line. This is great for editing copy and pasted lists.

Read More →

Switch Settings with VimSwitch

VimSwitch (GitHub: priomsrb/vimswitch, License: GPL) is a Python program that can change Vim's settings based on a GitHub repository. That means you can switch to a totally different setup like this:

./vimswitch amix/vimrc

Why would you want to do that? I'd probably use it to try out someone else's vimrc from GitHub, particularly if I wanted to write about a set of dotfiles that's suddenly getting hundreds of stars on GitHub. It may also be useful if you regularly ssh into new servers, or Vagrant virtual machines.

Read More →

cVim: Vim for Chrome


cVim (GitHub: 1995eaton / chromium-vim, License: MIT) by Jake Eaton is a Chrome extension that makes Chrome behave like Vim. There are other Vim for Chrome extensions, but I found this one really easy to learn. It's possibly more idiomatic than the others that I've tried.

Typing :o has a cool history search open prompt, which supports ! (new tab) and * (pin tab). Pressing f shows quick open link hints that are alphabetical rather than numerical. Like Vim, F is different to f -- in cVim it causes links to open in a new window.

Read More →

Stop the Tab Madness

If you've switched to Vim from a GUI tab-based editor like TextMate or Sublime Text, then you've probably learned how to use Vim's tabs. However, Vim's version of tabs are different, and to really take advantage of them involves properly learning buffers and split windows.

In Vim Tab Madness. Buffers vs Tabs, Josh Davis points out how he uses Vim's buffers, windows, and tabs. He shows you how to disable tabs until you learn how to use windows and buffers, and he's got some mappings for using buffers more efficiently.

Thinking back to when I started using Vim as my main editor, I struggled to understand how buffers should be used. It seemed weird that every file ever opened gets added to the buffer list, and switching between buffers seems less instant than the keyboard shortcuts in a GUI editor.

Read More →

Script Roundup: smartpairs, ftcolor.vim


smartpairs (GitHub: gorkunov / smartpairs.vim, License: wtfpl) by Alexander Gorkunov is a plugin for visually selecting ranges based on brackets or quotes, without needing to type the brackets or quotes. So rather than vi{ you can type viv -- the last v will cause the plugin to search for the pair of the symbol under the cursor. It's a nice tweak to the existing behaviour that seems easy to learn.

Alexander also sent in smartgf.vim. This is a method definition search plugin designed for Ruby. Once the cursor is over a method name you should be able to type gf to search for related methods. The results are obtained using The Silver Searcher, and each entry has a number so you can quickly jump to the corresponding file and location.


ftcolor.vim (GitHub: caglartoklu / ftcolor.vim, License: BSD 2-clause) by Caglar Toklu is a handy plugin for switching colour scheme based on language. That means you could have a totally different scheme for JavaScript or Lisp code, for example.

Read More →

No Vim Stack Exchange

It turns out there won't be a Vim Stack Exchange (see my previous post).

We recently launched an Emacs site, and the Vi/Vim community quickly followed to have a site of their own. The show of support here was nothing short of amazing. It weighed heavily in our evaluation of this site, but we ultimately decide not to split off Vi/Vim from Stack Overflow and the other communities that support this subject.

A comparison between Emacs and Vi/Vim is inevitable. It's a good question, and we talked about this a lot. We were on the fence about creating the Emacs site in the first place, but the argument that there was an ecosystem of questions not suitable to Stack Overflow won over by the narrowest of margins.

Read More →