You are not logged in.

#1 2009-06-03 06:26:31

LonelyStar
Member
Registered: 2007-12-09
Posts: 123

vim and C++ programming assistance

Hello,

I would like to use vim for C++ programming. I know it is not an IDE, but I wonder what coding assistant vim could provide.
I have omnicompletion installed via pacman and as described here:
http://vim.wikia.com/wiki/VimTip1608

kind of works, but if I have this:

int main()
{
   std::

Completion is started, and i.E. vector is suggested. But I have no #include <vector> ...
Can vim be made aware of this?

Also, I am looking through the web for vim C++ code assistance. I find a lot. There is ctags, csope. There are things which seem to work for C, but not for C++ ... I just do not know how to filter all this info.
What are the state-of-the-art packages for:

- Finding the decleration of a symbol
- Finding the implementation of a function
- Displaying the function prototype (arguments) while typing the arguments

Thanks!
Nathan

Offline

#2 2009-06-05 00:46:31

darthaxul
Member
Registered: 2008-09-24
Posts: 156

Re: vim and C++ programming assistance

If your gonna be programming you must grab a better app such as medit, way easier config with mouse support also.

Offline

#3 2009-06-05 06:33:20

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: vim and C++ programming assistance

There are several approaches out there to use vim as a full fledged c/c++ ide. Best browse the scripts database on the vim home page to find a solution which suits you best.


To know or not to know ...
... the questions remain forever.

Offline

#4 2009-06-05 09:38:30

davvil
Member
Registered: 2008-05-06
Posts: 165

Re: vim and C++ programming assistance

darthaxul wrote:

If your gonna be programming you must grab a better app such as medit, way easier config with mouse support also.

Well, I couldn't disagree more with this comment wink If you want to be productive, try to forget about the mouse and learn to use the keyboard and the powerful editing capabilities of vim efficiently. I tried some IDEs (eclipse, kdevelop, netbeans) which had some nice features, but the editors were always lacking and they are too mouse oriented for my taste. Therefore I always kept coming back to vim.

W.r.t. plugins, I do not really use many. Omnicompletion and ctags (and I have a background script running wich updates the tag file every minute) which I use regularly. With ctags you can find the declaration and implementation of symbols. And I think omnicomplete has some options for displaying the function prototype, like you want (I know I deactivated it, because for me it was too intrusive most of the time). I also have taglist installed, but I do not use it often.

From the standard editing capabilities, what you should definitely look at is:

- Define the indentation as you like it
- Toggle highlighting of search terms on demand (I have this mapped on \s)
- Use the "." command
- Compile and jump to errors from within vim
- Visual rectangle mode

There are probably more, but these are the first that come to mind. If you really learn to use the extensive editing capabilities of vim, you probably will be equally efficient (or more) than with en IDE. After all, most of the time you are only editing.

And to go to the "lacking aspects": what I really miss are refactoring tools, e.g. for changing the name of a class or a method of a class. This would be quite a useful addition and something where (some of) the IDEs have a clear advantage.

Last edited by davvil (2009-06-05 09:38:52)

Offline

#5 2009-06-05 11:49:19

dispanser
Member
Registered: 2009-04-10
Posts: 20

Re: vim and C++ programming assistance

I tried some IDEs (eclipse, kdevelop, netbeans) which had some nice features, but the editors were always lacking and they are too mouse oriented for my taste.

For netbeans, there is a vi plugin (http://jvi.sourceforge.net). Since this is implemented in java, it does not cover all of vim's features, but the most important stuff is there (except for the ctrl-t / ctrl-o jump back to last tag, but you're getting used to it).

Depending on the size of the project, and how good you are in remembering APIs of rarely used frameworks / packages, I for one would never want to miss my IDE features.

Offline

#6 2009-06-05 12:01:33

davvil
Member
Registered: 2008-05-06
Posts: 165

Re: vim and C++ programming assistance

dispanser wrote:

I tried some IDEs (eclipse, kdevelop, netbeans) which had some nice features, but the editors were always lacking and they are too mouse oriented for my taste.

For netbeans, there is a vi plugin (http://jvi.sourceforge.net). Since this is implemented in java, it does not cover all of vim's features, but the most important stuff is there (except for the ctrl-t / ctrl-o jump back to last tag, but you're getting used to it).

True, I remember testing it. But it did not catch with me. I do not remember the reason, it was long ago. What actually looks quite good is eclim (http://eclim.sourceforge.net/), but they do not support c++ yet sad

Edit: I'm now browsing through the eclim webpage and it seems they added support for C/C++... Now I have something to try over the weekend.

Last edited by davvil (2009-06-05 12:09:18)

Offline

#7 2009-06-05 13:26:29

scio
Member
From: Buffalo, NY
Registered: 2008-08-05
Posts: 366

Re: vim and C++ programming assistance

QtCreator, Eclipse, and MonoDevelop all have vi modes/plugins.  As davvil noted, eclim is one of the eclipse plugins, http://www.vimplugin.org/ is another.

I have been loving QtCreator personally, but often I find myself just dropping back to vim with my tags, plugins and scripts.

Offline

Board footer

Powered by FluxBB