如果你用 vi 來 trace 程式, 建議你可以用 "ctags"
To create ctags for hw3 source codes ---
1. In top-level Makefile, add the following at the end
ctags:
@rm -f src/tags
@for lib in $(LIBPKGS); \
do \
echo "Tagging $$lib..."; \
cd src; ctags -a $$lib/*.cpp $$lib/*.h; cd ..; \
done
@echo "Tagging $(MAIN)..."
@cd src; ctags -a $(MAIN)/*.cpp
Be noted to type "Tab" instead of "spaces".
2. In top-level directory (i.e. hw3/), type "make ctags".
3. In your home directory (e.g. ~ric), edit the file ".vimrc".
Add or modify the line ---
set tags=./tags,../tags
Now you are ready to use ctags in "vi" to trace up and down on the source code.
1. Use "vi" to edit a source code. Move the keyboard cursor to a function or
class name. Press "Ctrl-]", and you will go to the definition of that
function or class.
2. To go back to the previous level, press "Ctrl-t" anywhere in the code.
Enjoy it!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.21.240