Sunday, March 08, 2009

Switch Editor from Vim to Emacs.

Recently I begin to maintain a new project in SUSE Linux, glad to return the C++ world. The new project is tough, but more challenging, so the last month is very busy.

On Feb 10, I am trying to switch editor to emacs. In the past, I use emacs for my own project, and use vim to make patches for SUSE Linux. But I still feel uncomfortable on mode editor like vim, already get used to mode-less editor. But I didn't know how to use emacs to browse function definitions in large projects before, finally I settled this.

First, turn cua-mode on, by which you can use Ctrl-X, Ctrl-C, Ctrl-V, for cut, copy, paste, and Ctrl-Z for undo.

Then use ctags or etags to generate TAGS files.
And enable emacs to browse multiple function definitions in C++ by using etags-select.el.
Here are the URL:
http://www.emacswiki.org/emacs/EtagsSelect.

Now browsing C++ code is easy, but the code completion still does not work. It doesn't matter I don't rely on code completion much now.

PS: command examples for generating TAGS file.
$ctags -eR .
or
$find \( -name '*.h' -or -name '*.cpp' \) -print | etags -

No comments: