Skip to content
A fast and easy way to switch between files (following #includes, .c -> .h, etc)
Emacs Lisp
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


switch-files is a utility to help you easily switch between files. It knows how to do two things well:

  1. Find a matching “header” or other file and switch to it even if it is not located in the same directory as the base file. For example, if you’re editing “foo.c” then it can auto-switch-to (and open if necessary) the “foo.h” file even if it’s not in the same directory.
  2. Follow file references when sitting on an “include” statement. For example, if in C we had:
#include "bar.h"

and if the cursor was sitting on the line when switch-files was invoked, then switch-files would jump to the bar.h file.

  1. Keep track of your path. If you switch from one file to another by following either of the usage patterns in #1 or #2 then it’s a simple key-stroke to get back to where you came from.


(require 'switch-files)

;; XXX: document how to extend the lists
;; eg:
;;   - extend switch-files-list
;;   - extend switch-file-paths
You can’t perform that action at this time.