views:

424

answers:

10

Hello all,

I was wondering how people usually navigate through large projects with several source files in Linux environment. I primarily work with C and python and sometimes with C++, C# and Java.

I wanted to know specific editors, plugins etc. I used to program on windows so editors like vi and emacs are not really in my league, but if you think if it could be really helpful for me to learn one of these editors please suggest so and any specific plug-ins you use to make your life simpler with managing large projects with these programs.

Here are a couple of scenarios: Let's say I am working on a particular function A in file F, and all of a sudden I realize that this function needs to call function B in file G. I quickly need to navigate to that function to determine things like function parameters, take a quick look at the function etc. Another scenario would be working on two different locations at one time in a file and switching quickly between these two locations.

I am using eclipse to manage my project and do development (eclipse's auto completion is painfully slow) and geany to edit files individually, but seems like I can't really get to that level of efficiency.

Please share your code management and navigation techniques.

Thanks,

edit: languages

+2  A: 

Well, what kinda code are you talking about? C++/java/php/ruby/python I highly recommend netbeans, specially the latest dev builds, also KDevelop for kde 4.2 (from svn) is really nice, the php/C# support is very experimental but if you don't mind the random crash its really good. Netbeans is by far the most stable IDE for php/java/c++ on linux if you don't mind installing java to run it.

OneOfOne
sounds good, I will take a look. I primarily work with C and python. Occasionally with C++, C# and Java.
verma
netbeans have python support, and should be somewhat easy to use it for c instead of c++.
OneOfOne
netbeans is great, but it just didn't cut it. I don't know why but it looked awfully ugly (I am on Arch Linux x86_64 running Gnome). I couldn't configure it to use Monospace 10 as the editor font. Also the menus and all were drawn really badly, no borders or anything.
verma
thats weird, what version of the java jdk? try to start it with --laf GTK
OneOfOne
+6  A: 

Emacs with etags -- see eg EmacsWiki on Tags -- as Emacs' default modes work for all languages I care about: R, C++, C, shell, Perl, Python, SQL, ... and probably also the ones you are after. The Exuberant Ctags generalise this to more languages and editors, including the vi family.

Dirk Eddelbuettel
I will give emacs a shot. I will try to spend some time with it today and see where it takes me.
verma
I gave emacs another try, it's working well for me so far. The good thing is that its regarding most of the keystrokes I use when I edit files in other GUI based editors (like Visual Studio, Eclispe etc.). I totally love how well it indents my C code. I am going to mark your response as the answer. Thanks!
verma
A: 

You can use MonoDevelop for c++. It will be a very similar experience as you've had with Windows / VS.Net.

xanadont
A: 

I'm a big fan of IntelliJ. Its slogan says it all: "Develop with pleasure". Of course, this assumes you are using Java. Although it does have supported plugins for several other languages including Python.

joeslice
A: 

I often use Doxygen when I need to understand code from someone else. I use Vim with CTags while writing my own code.

Neil
A: 

Take a look at Kscope. It provides a right click menu to give you the definitions, references, calling function, called functions etc... for any set of source files written in C. It is reliable and fast when used on big project.

I use it for source navigation, but for the editing part, I feel more comfortable with geany. It is not limited to C, and provides a good auto-completion feature, that will provide the prototype of a function as you type it. Still has some rough edges, but the Kscope + Geany combo is my favourite combo for now, when it comes to writing C.

shodanex
Kscope doesn't look bad at all. I am not a KDE fan, but it does seem worth a try.
verma
+4  A: 

For vim lovers (like me): vim + ctags does great job. Also grep is your best friend.

Artyom
vim + cscope works well too.
Convict
To clarify for the OP, who seems reluctant to learn vim: navigating to the function if the cursor is on that functions name is: <ctrl>[If you want to go to the function foo and the cursor is not on the name 'foo': :ta foo Each jump is recorded on a stack, and navigating back through the stack is: <ctrl>t Advice to the OP: you do want to learn vim and/or emacs. Spend enough time to be moderately proficient with both, then select one and learn it well.
William Pursell
Thanks for the advice, I do want to learn one of these editors. Its just that starting up with these is such a hassle while I can go ahead and use a simpler editor which gets the job done. I am sure they would be great in the long run, just starting up is a pain. I will give them a shot though, I would say I know 10% of vi, but emacs is a whole new world for me.
verma
A: 

I use Eclipse and make heavy use of the search function (for C mostly text search).

I also have tooltips enabled, which can show the documentation or beginning of a function.

Mark occurrences is also helpful to find stuff within a file.

I typically mark places where I work with TODO comments. These are visible in the sidebar, so it is relatively easy to navigate there.

I also enable line numbers, for correlating with error messages and such.

I don't think it is possible to edit the same file in two different windows in Eclipse (but I would be happy to be proven wrong).

starblue
+1  A: 

For grepping in files, ack is better than actual grep.

For navigating between files, bash alias that runs kwrite on background together with bash completion for file names is enough for me.

che
A: 

I'm using gvim (Vim's GUI version) for most Perl and C/C++ programming. For navigation I find NERDTree, ctags, ack and possibly some custom scripts written in Perl or whatever. I have placed my Vim/gvim configuration on my site. As one can see there, I have "so $VIMRUNTIME/mswin.vim" there which makes Vim much more similar to Windows editor, and more familiar to people coming from it. Many hard-core vim experts don't recommend using it, but I still do.

There are many other plugins over at Vim's homepage which may prove useful.

Shlomi Fish