开发者

How to use Vim as Python, C, C++, C# IDE

I am finding it very difficult to use VIM as IDE for programming开发者_开发百科. Help me get a solution.


generally you can go this path

http://cream.sourceforge.net/

but i would suggest you use more personalized experience and learn some vim commands for your advantage.

For instance you can get few enchancements setting directly in .vimrc

set nocompatible        
set backspace=2         
set textwidth=75        
set viminfo='20,\"50    
set history=50          
set mouse=a
set nocp
set ruler
set visualbell
set wildmenu
set noerrorbells
set ignorecase
set incsearch
set vi=%,'50
set vi+=\"100,:100
set vi+=n~/.viminfo

set joinspaces
set showmatch
filetype plugin indent on

filetype on
colorscheme desert
syn on
" source /usr/local/share/vim/vim63/indent.vim

if you plan on using python i would recommend set expandtab also.

Then you should head to http://www.vim.org/scripts/index.php and get few scripts for you language.

Also you can do keybindings for vim i.e. set nmap <C-m> :make all<CR>. (sets ctrl-m to execute command make all)


To answer just the aspects you mentioned:

  • 'Building' normally implies, that you have a build system (such as make, scons, cmake, 'solutions', ant, waf, etc.). These build systems are normally started by some command (such as make, scons, cmake + to whatever, devenv, ant, waf). You can launch the build system by setting the makeprg option in vim:

    Program to use for the ":make" command.
    

    Set that to whatever your build system needs. You then just use :make to trigger the buildsystem. Errors are reported to the buffer containing the list of 'errors'.

    :help copen
    
  • 'Running' is just :!yourbinary.exe


Vim or neovim both provide async job feature, so you can compile and run c code. To use Vim as c/c++ ide, you can use language server. Just need to install coc.nvim. most of the ide feature has been implemented.

I am author of SpaceVim, which is something like spacemacs but for vim and neovim, if you do not want to config vim/neovim yourself. you can have a try with SpaceVim.

It provide a lang#c layer which support c/c++. and it also has lang#python layer. for all the available layers, you can checkout https://spacevim.org/layers/

Here are posts about using SpaceVim as c/c++ ide or python ide:

  1. Use vim as C/C++ IDE
  2. Use vim as python IDE


There is a tons of shortcuts already defined in c.vim to make your vim as IDE. Refer this file PDF : ~/.vim/c-support/doc/c-hotkeys.pdf in that plugin. Also refer this Tutorial: Make Vim as Your C/C++ IDE Using c.vim Plugin for more detail.


You could also use eclim to intagrate Eclipse with vim and run it as a headless server so you can get some of Eclipse functionality.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜