Tuesday, April 19, 2011

Emacs commands

  1. Search
    • forward searching: C-s
    • backward searching: C-r
    • quit searching: ret or C-a
    • finding the next/previous: repeat C-s or C-r
  2. How to use emacs to compile and run C/C++ files
    1. compile the source code: "M-x compile", first; and then "g++ hello.cpp -o hello"
    2. open the shell window to run: "M-x shell" or "M-x eshell"; and then "./hello"
    3. go back to the source code window: "C-x b"
    4. get away of the minibuffer: "C-g"
    5. clear some minibuffer: "C-x k"
    6. only keep the window where the cursor is: "C-x 1"
    7. switch between windows: "C-x o"
  3. How to use etags
    • generate the TAGS file: $ etags `find . -name "*.c" -o -name "*.cpp" -o -name "*.h"`
    • let emacs know about this TAGS file: M-x visit-tag-table [location of the TAGS file]

No comments:

Post a Comment