LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-18-2005, 06:12 PM   #1
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Rep: Reputation: 30
Question Ctags setup in vim


I'll be learning Java in a college class next semester, and I'm going to try to use Vim instead of one of the big IDEs, just because it makes it so much easier to move around.

I'm going through some steps found online to set things up to make working with Java easier, and I have a quick question about ctags.

A site suggested recursively generating tags for your source and the Java source (in the installation src directory) with "ctags -f ~/.tags -R ~/src $JAVA_HOME/src". Two problems with this... first, is there a way to automatically add tags as you code aside from making a cron job to run every so often? Second, ctags seems to regenerate the entire list every time it's run, so is there a way to make it ignore a directory that it already has complete tags for (i.e. keep generating for ~/src but only do the Java tags once)?

Thanks.
 
Old 12-19-2005, 06:08 AM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
Moved to Programming at posters request.
 
Old 12-19-2005, 07:20 AM   #3
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
the man page should tell you all you need to know,
or Google
 
Old 12-19-2005, 09:55 AM   #4
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Original Poster
Rep: Reputation: 30
All I've been able to find while reading through the entire man page (and the reason why I'm posting here) is the exclusion of directories, which would eliminate it altogether instead of just not updating it more than once. My first question still stands as well: what is the common/recommended way to update tags as you code?
 
Old 12-19-2005, 10:22 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
Quote:
Originally Posted by jrdioko
first, is there a way to automatically add tags as you code aside from making a cron job to run every so often?

Second, ctags seems to regenerate the entire list every time it's run, so is there a way to make it ignore a directory that it already has complete tags for (i.e. keep generating for ~/src but only do the Java tags once)?

Thanks.

1. Of course, you can run it whenever you like. I usually set up a vi keymap.

2. Well if you don't regenerate, then the java tags won't exist; as ctags creates a new file each time.

I would suggest going at it from another angle. First can VI use multiple tag files?
If so no probs. Do a static tag file and a dynamic.
If not maybe you can do as above and cat the two together into a new tag file.
 
Old 12-19-2005, 12:38 PM   #6
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Original Poster
Rep: Reputation: 30
The multiple tag files idea works perfectly, and I'll look into the mapping. Thanks!
 
Old 12-20-2005, 04:50 AM   #7
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
some versions of gvim have a menu "tools->build tags"
It seems to call ctags. Maybe you can override the command
or if not make an alias or shell wrapper to override.

In the vim help it mentions other tag progs.
exuberant C tags and jtags, both for java.

map is quite easy. I usually map ctrl-P to do stuff.

something like
:map ^P ! ctags blah blah<return>

you need to do a ctrl-V to insert literal keys like a control-P or return
 
Old 12-20-2005, 05:14 PM   #8
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Original Poster
Rep: Reputation: 30
Works fine, thanks again.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ctags doubt dileepkk Linux - Newbie 0 12-30-2004 04:30 AM
Handling Conflicting tags using ctags in vi / vim dileepkk Linux - General 0 12-29-2004 08:05 AM
ctags 5.5.4 not working in kdevelop 3.0.4 tcma Linux - Software 0 08-12-2004 01:42 PM
VIM Setup- No 'insert' mode uveraser Linux - Software 1 05-25-2004 10:44 AM
cronjob help ./ctags.1.bz2 meeh Mandriva 0 03-26-2004 11:19 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration