Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A configurable utility for jumping across files

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 CHANGELOG.markdown
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Guardfile
Octocat-spinner-32 README.markdown
Octocat-spinner-32 Rakefile
Octocat-spinner-32 switch_file.gemspec


SwitchFile is a simple gem for opening a file related to a currently open file.


  1. Install SwitchFile

    gem install switch_file

  2. Add a .switch_file to your project root directory. A .switch_file is a plain ruby file containing an array of hashes. Each hash represents a file type. A file type has the following attributes:

    • name - name of the file type
    • shortcut - a short, unique key for the file type
    • path_generator - a ruby block that will determine the path of the matching file type of a class name
    • path_regex - a regex that determines if a file path matches the file type
    • command - the editor that will open the file

    You can find sample SwitchFile configuration files at the examples.

  3. Configure your editor to launch switch_file based on the current file. With geany,

    1. Go to Build/Set Build Commands.
    2. Change the execute command to switch_file --path %d/%f.
    3. Running Build/Execute will now launch switch_file based on the currently open file.
Something went wrong with that request. Please try again.