Vim Large Combat C + + simple Integrated compilation environment (Windows chapter)

Source: Internet
Author: User

Everything has to start with this article.

Vim It was a little bit like a sister of Lin. But who would like to have a sister at home, the light of her own girl as illustrated dress is not good, must start from scratch to form a. And even if it really can raise a "heaven fell down" general of the lovely son, the housekeeper's position is still not her share.

--" Chai dai Double: If you also with vim difficult to give up, but also see the love of emacs"

At that time, just work soon, once went to an embedded colleague station to discuss a bug, saw him operate a simple interface text editor, but this compiler seems not simple, there is text highlighting, there is automatic completion, but also can be nested sub-window, more exaggerated, this colleague to type the speed of tapping the keyboard, Along with the interface, the cursor brush jump. When I didn't understand what was going on, the colleague suddenly stopped and pointed to the screen and told me that he had figured out the cause of the bug ...

This is the first impression that Vim gave me, the naked force lattice.

Needless to say, the following is what I would like to share with you vim more interesting things, but also to give it.

vim and gvim

This is a good introduction to the Vim article:

http://km.oa.com/group/16841/articles/show/199187

children's shoes with Linux are not unfamiliar to VI or vim, as this is standard. Edit the code, and the configuration file depends on it. And in Windows Vim does appear to be some non-mainstream, because the choice of more than the vim of the start curve of the wonderful.

There are two main types of vim, one is vim at the command line or console , and the other is a gvim with a graphical interface . The two actually experience similar operation, because vim under the mouse is almost useless ..., but under Windows gvim use is still comfortable.

What to do

In a word, the use of VC compilation environment integrated into vim, so that you can edit in vim, modify, run a simple CPP program. Go straight.

The biggest benefit is lightweight, which is much lighter and faster than vs. Especially when writing a test code, or experimenting with an unfamiliar API.

I don't know how many classmates have done the same thing with me:

    • First Gvim main.cpp, write well, save;
    • Open the command prompt console for vs;
    • Cl.exe main.cpp;
    • Run exe;
    • If compiling, or running a problem, open main.cpp, the above steps again.

Now this is just the past style,F5, compile and run a button to get it done. If a compilation error is made, the error message is also called out.

Here to provide you with a way of thinking, according to their own needs, to play their own imagination, to integrate some of the daily work to vim, or use vim to do, of course, the premise is to improve efficiency (to increase the force lattice also line).

PS:Vim has a very powerful script, plugin support, enough for you to toss.

Plug-in Installation installationGvim

The latest version of Vim can be downloaded on the vim website ;

DownloadCppbuild.zip (annex)

1) Unzip cppbuild.zip to local

2) Modify vim configuration file _vimrc, add filetype plugin indenton, function is to open vim plugin function. path to _VIMRC:[gvim installation directory ]\_VIMRC

3) Copy cppbuild.vim to [gvim installation directory ]\ vimfiles\plugin\

4) According to the current system, modify the Cppbuild.vim, two places need to be modified, one is the working directory, the other is the VC and Windows SDK path

5) Copy the remaining files to the working directory set in step 4

6) Close all gvim, reopen any new Gvim (for cppbuild.vim changes to take effect), shortcut [ctrl-k][ctrl-p], the Gvim will open a new tab page

7) under the tab that opens in step 6, the shortcut key [Ctrl-k][ctrl-i] Opens the precompiled header file (you can modify it according to your needs), shortcut key [F5], compile the precompiled header file and CPPBuild.exe

8) Go back to step 6 to open the tab page,[F5] Compile the run, finish the call.

Note: Step 7 is actually compiling a precompiled header file, which can improve the efficiency of later compilation. You only need to do it once, and you can skip this step later.

Cppbuild

the composition of the Vim plugin Cppbuild:

L Cppbuild.vim: Plugin script, which is responsible for binding shortcut keys in Vim to realize the main logic of CPP compiling;

L CPPBuild.cpp: will be compiled into CPPBuild.exe, the implementation of windowless Cl.exe, the compilation of CPP file (direct call will bring up a console black box);

L vim_pch.h: Precompiled header file, responsible for generating . pch files;

L vim_pch.cpp: Pre-compiled CPP file;

L template.cpp: template cpp file, including the main entry function, copy the contents of this file to generate temporary main.cpp;

Cppbuild's work flow chart is as follows:

Code Download: Http://pan.baidu.com/s/1sj7BXd7

Vim Large Combat C + + simple Integrated compilation environment (Windows chapter)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.