VIM¿ª·¢C£¯C£«£«²å¼þcvimµÄ°²×°¼°Ê¹ÓÃ
ÀûÓÃc.vim²å¼þ£¬Äã¿ÉÒÔʵÏÖ
Ìí¼ÓÎļþÍ·
Ìí¼Ó×¢ÊÍ
²åÈëһЩ´úÂëÆ¬¶Î
Óï·¨¼ì²é
¶Áº¯ÊýÎĵµ
×¢ÊÍ´úÂë¿é
ÕâÒ»²å¼þµÄ×÷ÕßÊÇ Fritz Mehner, Ä¿±ê¾ÍÊÇ´òÔì³ÌÐòÔ±Á÷³©µÄ±à¼»·¾³¡£
ÕâÒ»²å¼þ»¹ÄÜÍê³É:
Statement oriented editing of C / C++ programs
Speed up writing new code considerably.
Write code and comments with a professional appearance from the beginning.
Use code snippets
½ÓÏÂÀ´ÎÒÃǶÔÕâÒ»²å¼þÏêϸ½éÉÜ.
3 °²×°²å¼þ
Step 1: ÏÂÔØc.vim
$ cd /usr/src
$ wget http://www.vim.org/scripts/download_script.php?src_id=9679
Step 2: °²×°
$ mkdir ~/.vim
$ cd ~/.vim
$ unzip /usr/src/cvim.zip
Step 3: ÆôÓÃÕâÒ»²å¼þ
$ vim ~/.vimrc
filetype plugin on
8 c.vimµÄʹÓÃ
Feature 1: Add Automatic Header to *.c file
µ±Äãн¨Ò»¸öÀ©Õ¹Ãû.cµÄÎļþʱºò£¬×Ô¶¯ÔÚÎļþÍ·²¿Ôö¼ÓÍ·²¿×¢ÊÍ
$ vim myprogram.c
/*
* =================================================
* Filename: myprogram.c
*
* Description:
*
* Version: 1.0
* Created: 01/19/09 20:23:25
* Revision: none
* Compiler: gcc
*
* Author: Dr. Fritz Mehner (mn),
mehner@fh-swf.de
Ϊ·À±¸µç×ÓÓʼþµØÖ·ÊÕ¼¯Æ÷£¬Õâ¸ö E-mail µØÖ·±»Òþ²Ø£¬ÄãµÄä¯ÀÀÆ÷±ØÐëÖ§³Ö Javascript ²Å¿É¿´µ½Õâ¸öÓʼþµØÖ·
* Company: FH Südwestfalen, Iserlohn
*
* =================================================
*/
ÆäÖÐÈç¹ûÄãÒª¸Ä±ä AUTHOR ºÍ COMPANYµÄÖµ, ÒªÐÞ¸ÄÄ£°åÎļþ ~/.vim/c-support/templates/Templates
$ vim ~/.vim/c-support/templates/Templates
|AUTHOR| = geekstuff
|AUTHORREF| = gk
|EMAIL| = subscribe@geekstuff
|COMPANY| = thegeekstuff.com
ÏÖÔÚ±à¼Ò»¸öÐÂÎļþ£¬¿´¿´ÄãµÄ×÷Õߺ͹«Ë¾Ãû³Æ¸Ä±äÁËûÓС£
$ vim myprogram.c
/*
* =================================================
*
* Filename: myprogram.c
*
* Description:
*
* Version: 1.0
* Created: 01/19/09 20:26:43
* Revision: none
* Compiler: gcc
*
* Author: geekstuff (gk), subscribe@geekstuff
* Company: thegeekstuff.com
*
* =========================================
Ïà¹ØÎĵµ£º
CºÍÖ¸Õë
ÔÚCÖÐÓÐÒ»¸öºÜÖØÒªµÄ¸ÅÄ»òÐí´ó¼Ò¶¼ÖªµÀ£¬ÄǾÍÊÇÖ¸Õë¡£Ôںܶà³õѧÕ߸սӴ¥CµÄʱºò¶¼ÈÏΪÕâÊÇ×îÄѵÄ֪ʶµãÁË¡£Ã»´í£¬ÎÒ¸Õ¿ªÊ¼Ñ§µÄʱºòÒ²ÊÇÕâôÏëµÄ£¬ÉÏÁ˵ÚÒ»½Ú¿Îºó£¬µÚÒ»¸ÐÊܾÍÊÇ£ºÌì°¡£¬Õâ¼òÖ±¾ÍÊÇÌìÊ飡ÓÉÓÚ¸öÈ˶ÔÓÚCµÄ°®ºÃ£¬¾¹ýÒ»¶Îʱ¼äµÄѧϰºÍÑо¿Ö®ºó£¬·¢ÏÖÕâÒ»¿éÊÇÎÒ×îϲ»¶µÄ£¬²¢ÇÒÖð²½·¢ÏÖÕâÒ²ÊDZ¾È赀 ......
×î½üÔÚ¿´¡¶c³ÌÐòÉè¼ÆÓïÑÔ¡·£¬¾ÍÊÇÄDZ¾±»ÓþΪCÓïÑÔÊ¥¾µÄÊé¼®¡£¼¸Ìì¿´ÁËÒ»Õ£¬¸Ð´¥ºÜ´ó£¬¿ªÆª¾ÍÉæ¼°µ½ºÜ¶àʵÓóÌÐò£¬²»ÏñÌ·ºÆÇ¿ÄÇÑùÈÃÈËÉîÏÝÓ﷨ϸ½ÚÖ®ÖУ¬¶øÇÒѧÍêÌ·µÄÊé¸Ð¾õʲô¶¼²»ÄÜ×ö¡£ºÜ¶àÎÊÌâÌ·¶¼»Ø±ÜÁË¡£Ëùνרҵ¿´¿´c³ÌÐòÉè¼ÆÓïÑԵĴúÂëµÄ·ç¸ñ¾ÍÄܸÐÊܵ½£¬Ò»ÖÖ¾«Ðĵñ×ÁµÄÒÕÊõÆ·¡£µÚÒ»ÕÂÓÐ ......
ǰÑÔ ²»¶ÏÓÐÍøÓѽ«±àÒëÆ÷ GCC ÎóÈÏΪ IDE£¨¼¯³É¿ª·¢»·¾³£©
ÆÚÍûÍÑÀëÃüÁîÐÐ
ÆÚÍûÄÜÔڲ˵¥Öз¢ÏÖÆäÉíÓ°
ÆÚÍûÆäÄÜÓÐÒ»¸ö¼¯±à¼±àÒëÁ´½Óµ÷ÊÔÔËÐÐÓÚÒ»ÌåµÄ½çÃæ
¹Ê±¾Îĸø´ó¼Ò¼òµ¥ÂÞÁÐһЩ C/C++ ±à³ÌÖпÉÓÃµÄ IDE£¬»òÐíÄã´ÓÖпÉÒÔÕÒÒ»¸öÄãϲ»¶µÄ¡£
Ϊ±ÜÃâÒÔÏÂij¸öÈí¼þ°²×°Ê±²»×Ô¶¯°²×° ......
CºÍC++»¥Ïàµ÷Óú¯Êýʱ£¬Ê¹ÓÃextern "C"¡£
ÔÒò£º
C²»Ö§³Öº¯ÊýÖØÔØ£¬¶øC++Ö§³Öº¯ÊýÖØÔØ¡£º¯Êý±»C++±àÒëºó»áÃû×ÖÓëCÓïÑÔ²»Í¬¡£¼ÙÉèijº¯ÊýÔÐÍΪfoo(ing x, int y)£¬±»C++±àÒëºóÃû×ÖΪ_foo_int_int£¬¶øC±àÒëÆ÷±àÒëºóÃû×ÖΪ_foo¡£ ......
/*
*Ëã·¨ÔÀí£º½«Í¼G Öеı߰´È¨Êý´ÓСµ½´óÖðÌõ¿¼²ì,
* °´²»¹¹³ÉȦµÄÔÔò¼ÓÈëµ½TÖÐ(ÈôÓÐÑ¡Ôñʱ, ²»Í¬µÄÑ¡
* Ôñ¿ÉÄܻᵼÖÂ×îºóÉú³ÉÊ÷µÄȨÊý²»Í¬), Ö±µ½
* q(T) = p(G)-1Ϊֹ, ¼´ T µÄ±ßÊý = G µÄ¶¥µã1 Ϊֹ.
*Ëã·¨ÖÐÎÞȦÐÔµÄÅж¨±È½ÏÂé·³£¬Ó¦¸ÃÓñê¼Ç·¨×îºÃ£¬
*¶Ô¸÷¸ö·ÖÖ§µÄ¶¥µã±êºÅ¡£
*ÎÒû×Ðϸ¿ ......