Emacs C++, opening corresponding header file

后端 未结 3 1125
既然无缘
既然无缘 2021-02-02 10:11

I am new to emacs and I was wondering

  • if there is a shortcut to switch between header/source and the corresponding source/header file

  • if there i

3条回答
  •  囚心锁ツ
    2021-02-02 10:45

    Check the excellent Emacs-fu article Quickly switching between header and implementation

    In case the blog post has gone, here is copy of the solution:

    (add-hook 'c-mode-common-hook
      (lambda() 
        (local-set-key  (kbd "C-c o") 'ff-find-other-file)))
    

    Now, we can quickly switch between myfile.cc and myfile.h with C-c o. Note the use of the c-mode-common-hook, so it will work for both C and C++.

提交回复
热议问题