Setting up vim as C++ IDE
Solution 1
"Jump to definition" is already there, it's <C-]>
with the cursor on a keyword or :tag foo
on the command line.
For these to work, you need a tags
file generated by exuberant-ctags and to tell Vim where to find it. See :help tags
and :help ctags
.
Without a tags
file, gd
goes to the definition of the keyword under your cursor if it's in the same file. But it's not as generally useful as <C-]>
.
Solution 2
First, to jump to definitions, you might try this:
I haven't tested it, so I can't tell you if it works.
Now, to build multiple file projects, it might be better for you to learn how to use makefiles and automake. These links might help you:
Good luck.
Edit: A similar question was answered on this link: https://stackoverflow.com/a/563992/1820837
Solution 3
For "Jump to definition" I can recommend the YouCompleteMe, plugin which is really easy to setup with vundle.
Otherwise there is also ctags, but I find it less useful.
To use vim as a IDE, I find this post useful.
RedSparrow
Updated on June 14, 2022Comments
-
RedSparrow almost 2 years
I wish to setup vim as C++ IDE so I can do all work from it.
I'm using these plugins for vim:
- Clang complete - accurate completion
- nerdtree - browse files
- snipmate - insert snippets
- AutoComplPop - omni-completion
- buffergator - buffer management
- vim-powerline - nice statusbar
- vundle - to manage plugins
But I lack things like Jump to definition and compiling multiple files in one executable, project view...
I'm using
nmap <F8> :w % <bar> :!g++ -W -Wall -Wextra -pedantic -std=c++11 % -o %:t:r<CR> <bar> :!./%:t:r<CR>
to compile current file, but it won't work if there are multiple file that create one executable.
I know I could just use eclipse, netbeans, code::blocks and such, but I really like vim... If such thing as vim ide isn't possible do I have to learn GNU build system or some other method?
Any advice is welcome.
-
Dmitry Frank over 11 yearsEverything is correct, but, as usually, I would add the same suggestion: I recommend not to deal with ctags manually, but use plugin Indexer instead ( goo.gl/Q744m ), it does all the painful work automatically: it silently generates your tags, tells Vim where to look for it, and keeps tags up-to-date. All the work is done in background, so, you don't need to wait for it.