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 →

Script Roundup: vim-nerdtree-tabs, Recover.vim

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

vim-nerdtree-tabs

Something that I see a lot of people asking about is how to make NERD Tree stay open across all tabs. vim-nerdtree-tabs by Jiří Stránský is a plugin that can do this. All expanded and collapsed file tree nodes will appear the same in every tab, and it can be configured to always open when Vim launches.

It also automatically closes the panel when the last file is closed, so NERD Tree is never left hanging open by itself.

It comes with several commands, mappings, and configuration options.

Read More →

Vim 101: Help Tags

I've seen many people confused by Vim's help system, particularly when installing a new plugin. An IRC friend of mine had installed Tim Pope's rails.vim, and couldn't work out why :help rails didn't work. The reason for this is Vim has to be told about new help files through the :helptags command.

Vim itself has documentation for :helptags in :help :helptags, and the command can be abbreviated to :helpt. Running it with the directory your plugin was installed to will make the help file available.

Let's say you've installed rails.vim to ~/.vim/bundle/vim-rails because you use Pathogen, then to generate the help tags you'd have to type :helpt ~/.vim/bundle/vim-rails/doc.

Read More →

Christmas Gifts for Vim Hackers

It's testament to how popular programming and Vim have become that it's not actually too difficult to come up with gift ideas for Vim hackers. This year has seen some cool projects take off thanks in part to crowdsourcing sites, but also due to a resurgence of interest in Vim.

Here are just some of my gift ideas for Vim hackers.

Book: Practical Vim

Practical Vim

Read More →

Script Roundup: rsi.vim, Tablify

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

rsi.vim

rsi.vim (GitHub: tpope / vim-rsi, License: Vim) by Tim Pope adds Readline/Emacs-style bindings to Vim. It does sometimes feel like everything apart from Vim has the same shortcuts, and so Tim has made a plugin that brings them to Vim without overriding commonly used existing bindings.

The Readline mappings work in the Insert and Command-line modes. You can review the mappings here: rsi.vim.

Tablify

Tablify (GitHub: Stormherz / tablify) by Vladimir Shvets turns structured data into tables. Pressing \tt turns a selection into a table with left-aligned text. The example from the readme is as follows:

Read More →

Vim 101: Insert Mode Shortcuts

When editing a file in Insert mode, it sometimes feels restrictive in terms of editing shortcuts. However, many shortcuts used elsewhere in Unix and other text editors are available. For example, CTRL-w (:help i_CTRL-W) will delete the word before the cursor, and CTRL-u (:help i_CTRL-U) will delete the current line. Pressing CTRL-[ (:help i_CTRL-[) quits Insert mode and goes back to Normal mode.

There's even a shortcut for putting text from a register: CTRL-r {reg} (:help i_CTRL-R). This is extremely useful when working with the system paste buffer.

You may already know about these, but CTRL-n and CTRL-p (:help CTRL-N) will invoke Vim's auto completion, displaying a menu of matches.

Read More →