Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have recently moved to a VIM environment for Python development. I learned the setup from John Anderson's outstanding web page on the subject. I am about to try and set up another VIM environment for C++. Is this even possible to do effectively? Or should I really have two accounts on my Linux box, one for Python, one for C++ development?

If anyone could outline their setup, either way, I would appreciate it greatly.

To further clarify the question, I am not asking "what is best way?" which is unanswerable. I am asking those VIM users who program both C++ and Python if they use one VIM environment, or two (perhaps on different accounts), and how they accomplish it either way.

(For Java, I am sticking with NetBeans and am pretty sure that is the right decision due to how well the build and Swing development tools are built into it, but am open to the idea of a VIM environment for all 3 languages if anyone has had success with it.)

Thanks much

share|improve this question
    
How is Java or Netbeans related to this question at all? –  Billy ONeal Jun 17 '11 at 22:28
add comment

3 Answers

up vote 5 down vote accepted

If you need different settings for C and python, you can have them:

autocmd FileType python setlocal expandtab
autocmd FileType c setlocal noexpandtab
share|improve this answer
add comment

Stock Vim is pretty well suited to C++ already. Just enable OmniCPPComplete and install ctags-exuberant or cscope (and optionally a tab-complete script), and you'll get all of the completion features you'll need. As a C++ programmer, that's all I ever actually need. (Though I do have a rather long indentexpr.)

share|improve this answer
add comment

I use same vim setting for coding C, C++ and Python (and other stuff too like bash, make ..). You can change settings based on file type. I have a blog post explaining how to change indentation settings for Python and C code automatically in vim.

The gist is

autocmd BufNewFile,BufEnter *.{py} call set_python_settings()
autocmd BufLeave *.{py} call unset_python_settings()

Write your own set_python_setting to change setting to python style and the defaults for vim is good enough for C/C++.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.