You can check my C/C++ guide for all the needs above:
You can use GNU Global with ggtags or helm-gtags. GNU Global can use cscope backend, but you should use its native backend for generating tag datdabase for C/C++ code. You can jump to definitions or references instantly, even for project as large as Linux kernel.
You don't need to jump back to local definition to see the details. Simply using semantic-idle-summary-mode
, it will show definition of any variable/function/class/struct at point like this:
As you can see in the screenshot, the function signature of find_if
is shown in the minibuffer.
You can also keep the definition of current function always visible at the top like this:
To enable those features, add this configuration to your init file (either ~/.emacs
or ~/.emacs.d/init.el
:
(semantic-mode 1)
(add-to-list 'semantic-default-submodes 'global-semantic-stickyfunc-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-idle-summary-mode)
You can use highlight-symbol (you can install from MELPA to highlight and jump back and forth occurrences of the same symbol in buffer with the following configuration:
(require 'highlight-symbol)
(highlight-symbol-nav-mode)
(add-hook 'prog-mode-hook (lambda () (highlight-symbol-mode)))
(add-hook 'org-mode-hook (lambda () (highlight-symbol-mode)))
(setq highlight-symbol-idle-delay 0.2
highlight-symbol-on-navigation-p t)
(global-set-key (kbd "M-n") 'highlight-symbol-next)
(global-set-key (kbd "M-p") 'highlight-symbol-prev)
After that, you can jump back and forth with M-p and M-n
- Use GNU Global to look thins up. It just works.
You may want to check Semantic Refactor, a package for common refactoring tasks (i.e. rename local variables easy and precisely, extract a piece of code into a separate function...). Here are the demos