Skip to content

Instantly share code, notes, and snippets.

@brettbuddin
Created May 5, 2011 17:43
Show Gist options
  • Save brettbuddin/957498 to your computer and use it in GitHub Desktop.
Save brettbuddin/957498 to your computer and use it in GitHub Desktop.
Switch between .h and .c, .m, .cc or .cpp files quickly. Change the function name to whatever you want. She's ugly.
function! Switch()
if expand('%:e') == 'h'
try | find %:t:r.m
catch
try | find %:t:r.c
catch
try | find %:t:r.cc
catch
try | find %:t:r.cpp | catch | endtry
endtry
endtry
endtry
else
find %:t:r.h
endif
endfunction
command! Switch call Switch()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment