Vim plugin that makes it trivial to jump between alternate files (test files & implementation, etc.)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Build Status


Note: This project is no longer maintained. Please see my new project alt that provides the same type of functionality in a more general way.

Bringing alternate file opening to the forefront

It in Action

What it provides?

This plugin provides a simple solution for opening alternate files intelligently in vim. It does this by providing a user-command called OpenAlternate which when executed will open the alternate file to the currently opened file.

Supported File Types

Currently, this plugin supports the following list of file types.

Current File Alternate File
RSpec File Ruby Implementation file (includes logic for Hanami and Ruby on Rails)
Ruby Implementation File RSpec file (includes logic for Hanami and Ruby on Rails)
Cucumber Feature File Cucumber Step Definition file
Cucumber Step Definition File Cucumber Feature file
Rails Rake File Rails Rake Spec file
Elixir ExUnit File Elixir Module Implementation File
Elixir Module Implementation File Elixir ExUnit File


If you don't have a preferred installation method, I recommend installing pathogen.vim and using it in combination with git submodules as describe in this Vimcast - Synchronizing plugins with git submodules and pathogen.

If your installation method is the above recommended one, it should be as simple as running the following commands:

cd ~/.vim/
git submodule add bundle/vim-open-alternate
git add .
git commit -m "Added vim-open-alternate plugin to my setup."

If you're using Janus it's very similar, just omit the bundle directory:

cd ~/.janus/
git submodule add vim-open-alternate
git add .
git commit -m "Added vim-open-alternate plugin to my setup."

If you are using another method, you are on your own. I have been told that this plugin is compatible with Vundle but I have not tested it myself.


The recommended configuration for this plugin is to simply map a key combo to run the OpenAlternate command for you. This can easily be done by adding the following to your ~/.vimrc.

nnoremap <leader>. :OpenAlternate<cr>

In the above example I map my normal mode <leader>. key combo to execute the OpenAlternate command, in turn opening the alternate file for editing.

You can of course map this command anyway you like, or even choose not to map it and just execute the command as follows when you need it.



I took the idea for my <leader>. binding and some logic for opening the alternate file from Gary Bernhardt's vim setup. I also took bits and pieces of file path conversions for alternate files from numerios friends .vimrc files. Therefore, credit must go out to Gary Bernhardt for a reasonable starting point as well as my numerous friends for sharing their alternate file path conversions with me.


Copyright (c) Andrew De Ponte. Distributed under the same terms as Vim itself. See :help license.