April 24th, 2008 mysurface
I have wrote a post regarding vim with ctags, introduces how ctags allows you to travel across source codes, searching for function, objects, variables definition. To jump from function call to function definition, I usually do ctrl+] in vim. It should works fine as it should have already configured by default from most of the linux distros.
Usually c/c++ projects may have multiple directories, for example, lets look at this project hierarchy:
project
`-----misccomp
| `...
`-----sysint
`-----client
| `-----hdrs
| `-----lib
| `-----src
| `-----test
`-----common
| `-----hdrs
| `-----lib
| `-----src
| `-----test
`-----server
`-----hdrs
`-----lib
`-----src
`-----test
I Copied it from Exuberant Ctags FAQ
Let say source code call handle.cc in sysint/client/src may make a function call where the function definition is in sysint/common/hdrs. The simplest way to make use of ctags, you have to station yourself in sysint folder, and do this:
ctags -R *
The command line above will generate a file name tags in sysint folder. To edit let say handles.cc in client/src, you will need to issue vim at sysint directory, like this:
vim client/src/handles.cc
So that if the function call definition is at common/hdrs, you may able to travel from there, because vim will always try to find the tags file in the base folder you issue vim. Therefore, if you change directory to client/src like this
cd client/src
vim handle.cc
And you try to do ctrl+], it will complain it can’t find the tags file and refused to work! Because inside sysctl/client/src folder doesn’t contain tags file. ctags -R * at sysctl folder does not generates tags in any of its subfolders.
Exuberant Ctags FAQ guiding through you on how to generates tags file on every single sub folders, so you can travel freely at any point. The steps some how - tedious! I don’t feel that I can remember the steps very well everytime I create a new c/c++ project. So I created a bash script to does all those tedious steps.
Read the rest of this entry »
vim with ctagsIf you are c/c++ programmer and vim user, maybe know ctags. Most of the time, source code are distributed to many folder...
How to increase your linux system loading speedLinux can be run on various run level, for run level 0 is shutdown, and run level 6 is restart and usually run level 1 i...
create screencast using xvidcapIf you heard of ubuntuvideo.com and you will discover a lots of ubuntu tutorial at there. There are a blog post that use...
Posted in Developer, Text Manipulation, ctags, vi, vim | Hits: 8379 | 4 Comments »