Friday, April 22, 2011

Vim + ctags

I am on my Ubuntu Linux box. I have started using vim and ctags to traverse my source code.

Installation:


  • Installed vim and ctags. "sudo apt-get install vim" and "sudo apt-get install ctags".

Source Tagging:

  • In source directory "ctags -R *" and edit source file with "vim sourcefile.c"
  • If it throws error messages like "ctags: skipping asm: it is not a regular file." , it means  you're not running Exuberant Ctags, you're running GNU Emacs etags, which also provides a ctags executable. Run ctags --version and you'll see something like this:   
    • ctags (GNU Emacs 23.1)
      Copyright (C) 2009 Free Software Foundation, Inc.
      This program is distributed under the terms in ETAGS.README
      
      
       In this case, install ctags with this command "sudo apt-get install ctags" command
    Important Commands:

    1. Find some symbol: use "/symbolname" e.g. I wanted to search disassembly I gave command "/disassembly".
    2. Go to definition:  Ctrl + ]
    3. Go Forward: Ctrl + i
    4. Go Backward: ctrl + o

    No comments:

    Post a Comment