sponsor Vim development Vim logo Vim Book Ad

counterpoint.vim : Easily navigate file counterparts.

 script karma  Rating 21/10, Downloaded by 2086  Comments, bugs, improvements  Vim wiki

created by
Josh Petrie
script type
Use Counterpoint to easily cycle between file counterparts (.h, .cpp, .osx.mm, win.cpp, and so on) via the :CounterpointNext and :CounterpointPrevious commands.

Counterpoint works by taking the current file, determining the root file name, and switching between files with the same root but different extensions. This allows Counterpoint to operate on multi-level file extensions instead of just the traditional .h and .cpp pairs, and allows it to cycle in a natural way without any configuration beyond mapping at least one of the command commands in your .vimrc, perhaps like so:

nnoremap <leader>a :CounterpointNext

For feature requests, bugs, better documentation and the latest version, check out the GitHub page:


install details
Use your favorite plugin manager (Pathogen, Vundle, et cetera) or extract directly into ~/.vim.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
counterpoint.zip 1.6 2016-03-04 7.0 Josh Petrie Official 1.6 release.
counterpoint.zip 1.5 2016-01-23 7.0 Josh Petrie Official 1.5 release.
counterpoint.zip 1.0 2015-01-08 7.0 Josh Petrie Official 1.0 release.
counterpoint.zip 0.3 2014-03-28 7.0 Josh Petrie Adds support for excluding files from the counterpart set.
counterpoint.zip 0.2 2014-01-23 7.0 Josh Petrie Adds support for user search paths, allowing Counterpoint to cycle between counterparts located outside the current file's directory (useful if source and headers are in sibling directories).
counterpoint.zip 0.1 2014-01-21 7.0 Josh Petrie Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
Vim at Github