quickly switching between header and implementation
A trivial yet useful trick: when coding C/C++, you often jump from header file (.h, .hh etc.) to implementation file (.c, .cc etc.). Emacs has built-in support for this, using ff-find-other-file. We can add a key binding to .emacs:
Nice post. Just to make it clear, c-mode-common-hook goes beyond just C and C++, and also applies to all major modes with roots in CC mode (C, C++, Java, Objective C, etc.). You can read it here
Cool!
ReplyDeleteBut shouldn't this be:
(add-hook 'c-mode-common-hook (lambda() (local-set-key (kbd "C-c o") 'ff-find-other-file)))
You are very right Zung!, updated, thanks. I had copied it out-of-context.
ReplyDeleteNice post. Just to make it clear, c-mode-common-hook goes beyond just C and C++, and also applies to all major modes with roots in CC mode (C, C++, Java, Objective C, etc.). You can read it here
ReplyDeleteFor this task I use eassist-switch-h-cpp function from the eassist package, included into cedet.
ReplyDelete@rodrigo: that's true of course; but I'm not sure what ff-find-other-file would do for these other languages.
ReplyDelete@Alex: does that have any advantages? Cedet does scare me a bit...