£¨×ª£©ÓÃVIM±àдC/C++³ÌÐò
ÓÃVIM±àдC/C++³ÌÐò£¨×ªÔØ£©
ÓÃVIM±àдC/C++³ÌÐò
ViÊÇUnixÏÂ×î³£ÓõÄÎı¾±à¼Æ÷¡£VIM£¨Vi IMproved£©ÔòÊÇËüµÄÔöÇ¿°æ¡£ÓÐÈ˳£³£ÄÃVIMºÍemacs±È½Ï£¬VIM¾¡¹Ü²»ÏóemacsÄÇÑùÓÐÄÇô¶àµÄ¹¦ÄÜ£¬µ«ÊDZÈemacs¸ü·½±ã¡¢ºÃÓá£ÓùýemacsµÄÈ˿϶¨»áΪemacsµÄһЩ¿ì½Ý¼ü¸Ðµ½·³ÄÕ£¬ÓÐʱºòÓÃÕæÏ£Íû×Ô¼ºÓаËÖ»ÊÖ¡£VIMµÄѧϰÇúÏßÒ²²»ÏóemacsÄÇô³¤£¬Ö»Òª¿´¿´VIM×Ô´øµÄvitutor£¬´óÔ¼Ö»Òª20·ÖÖÓ¾ÍÄÜÕÆÎÕVIMµÄÓ÷¨¡£¶ÔÓÚUnixϵÄC/C++µÄ³ÌÐòÔ±£¬ÎÒÍƼöÄãÃÇʹÓÃVIM+CtagsµÄ×éºÏÀ´Ð´³ÌÐò¡£ÆäÖÐÔÒòÌýÎÒÂýÂýµÀÀ´¡££¨ÏÂÃæ¶ÔVIMµÄ½éÉÜÖ÷ÒªÊÇÕë¶Ô5.6ÒÔºóµÄ°æ±¾£©
VIMÖ§³ÖÓï·¨ÖƵ¼ºÍ×Ô¶¯Ëõ½ø
VIM»á¸ù¾ÝÎļþµÄºó׺Ãû£¬È磺*.c¡¢*.cpp¡¢*.cc£¬µÈ£¬×Ô¶¯ÉèÖÃÓï·¨ÖƵ¼£¨Syntax Highlighting£©¡£C/C++ÖеÄһЩ±£Áô×Ö£¬È磺if¡¢for¡¢include£¬µÈµÈ£¬¾Í»áÓв»Í¬µÄÑÕÉ«£¬ÕâÑù¾Í»á¼õÉÙ³ÌÐòÔ±·¸´íµÄ¿ÉÄÜ£¬ÔĶÁ³ÌÐòµÄʱºòÏà¶ÔÀ´ËµÒ²ÇáËɺܶࡣÓÃÏÂÃæÕâЩÃüÁîÔÚVIMÖв鿴ÓйØÓï·¨ÖƵ¼µÄ°ïÖú£º“:h syntax”¡¢“:h syn-qstart”¡¢“:h syntax-printing”¡£
VIMÒ²Ö§³Ö¸ù¾ÝGNUµÄ·ç¸ñ×Ô¶¯Ëõ½ø£¬ÕâÑù³ÌÐòÔ±±àд³öÀ´µÄ´úÂë¾Í¸üÒ×ÔĶÁ£¬¶øÇÒÒ²ÓÐÀûÓÚÅàÑøºÃµÄ±à³Ì·ç¸ñ¡£ÓÃÏÂÃæÕâЩÃüÁîÔÚVIMÖв鿴ÓйØ×Ô¶¯Ëõ½øµÄ°ïÖú£º“:h cindent”¡¢“:h cinoptions”¡¢“:h cinoptions-values”¡¢“:h cinkeys”¡¢“:h cinwords”¡£
ʹÓÃCtags
VIMÖÐÒѾ´øÁËCtagsÕâ¸ö³ÌÐò¡£¾¡¹ÜctagsÒ²¿ÉÒÔÖ§³ÖÆäËü±à¼Æ÷£¬µ«ÊÇËüÕýʽ֧³ÖµÄÖ»ÓÐVIM¡£Ctags¿ÉÒÔ°ïÖú³ÌÐòÔ±ºÜÈÝÒ×µØä¯ÀÀÔ´´úÂë¡£ÓÃÏÂÃæµÄÃüÁî¿ÉÒÔÔÚÔ´´úÂëµÄ¸ùĿ¼Ï´´½¨“tags”Îļþ£º
[/home/brimmer/src]$ ctags -R
“-R”±íʾµÝ¹é´´½¨£¬Ò²¾Í°üÀ¨Ô´´úÂë¸ùĿ¼ÏµÄËùÓÐ×ÓĿ¼ÏµÄÔ´³ÌÐò¡£“tags”ÎļþÖаüÀ¨ÕâЩ¶ÔÏóµÄÁÐ±í£º
l ÓÃ#define¶¨ÒåµÄºê
l ö¾ÙÐͱäÁ¿µÄÖµ
l º¯ÊýµÄ¶¨Òå¡¢ÔÐͺÍÉùÃ÷
l Ãû×ֿռ䣨namespace£©
l ÀàÐͶ¨Ò壨typedefs£©
l ±äÁ¿£¨°üÀ¨¶¨ÒåºÍÉùÃ÷£©
l Àࣨclas
Ïà¹ØÎĵµ£º
ÓÃÊéÉϵĴúÂëÆ´´ÕµÄ£¬»¹ÊǺÜÓгɾ͸еĹþ
Ö§³ÖµÄÔËËã·ûºÅÓÐ"+","-","*","/","(",")","#"¡£
Ö§³Ö20λÒÔÄÚÎÞ·ûºÅÕûÊý£¬µ±È»¿ÉÒÔºÜÈÝÒ׵ĸijÉÓзûºÅ»òÕßÊÇʵÐÍÊý
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define OPSETSIZE 7
//º¯Êý½á¹û״̬´úÂë
#define TRUE 1
#define FALSE 0 ......
Ò»¡¢¼ò½é
µ÷ÊÔÆ÷(±ÈÈçÏóGDB)ÄÜÈÃÄã¹Û²ìÁíÒ»¸ö³ÌÐòÔÚÖ´ÐÐʱµÄÄÚ²¿»î¶¯£¬»ò³ÌÐò³ö´íʱ·¢ÉúÁËʲô¡£GDBÖ÷ÒªÄÜΪÄã×öËļþÊÂ(°üÀ¨ÎªÁËÍê³ÉÕâЩʶø¸½¼ÓµÄ¹¦ÄÜ)£¬°ïÖúÄãÕÒ³ö³ÌÐòÖеĴíÎó¡£
* ÔËÐÐÄãµÄ³ÌÐò£¬ÉèÖÃËùÓеÄÄÜÓ°Ïì³ÌÐòÔËÐеĶ«Î÷¡ ......
±¾ÎÄ´Ó½éÉÜ»ù´¡¸ÅÄîÈëÊÖ£¬Ì½ÌÖÁËÔÚC/C++ÖжÔÈÕÆÚºÍʱ¼ä²Ù×÷ËùÓõ½µÄÊý¾Ý½á¹¹ºÍº¯Êý£¬²¢¶Ô¼Æʱ¡¢Ê±¼äµÄ»ñÈ¡¡¢Ê±¼äµÄ¼ÆËãºÍÏÔʾ¸ñʽµÈ·½Ãæ½øÐÐÁ˲ûÊö¡£±¾ÎÄ»¹Í¨¹ý´óÁ¿µÄʵÀýÏòÄãչʾÁËtime.hÍ·ÎļþÖÐÉùÃ÷µÄ¸÷ÖÖº¯ÊýºÍÊý¾Ý½á¹¹µÄÏêϸʹÓ÷½·¨¡£
¹Ø¼ü×Ö£ºUTC£¨ÊÀ½ç±ê׼ʱ¼ä£©£¬Calendar Time£¨ÈÕÀúʱ¼ä£©£¬epoch£¨Ê±¼äµã ......
CÓïÑԵıê×¼¿âº¯Êý°üÀ¨Ò»ÏµÁÐÈÕÆÚºÍʱ¼ä´¦Àíº¯Êý£¬ËüÃǶ¼ÔÚÍ·ÎļþÖÐ˵Ã÷¡£ÏÂÃæÁгöÁËÕâЩº¯Êý¡£ÔÚÍ·ÎļþÖж¨ÒåÁËÈýÖÖÀàÐÍ£ºtime_t£¬struct tmºÍclock_t¡£
ÔÚÖÐ˵Ã÷µÄCÓïÑÔʱ¼äº¯Êý & ......
C/C++ÊDz»¼ì²éÊý×éϱêÊÇ·ñÔ½½çµÄ¡£
²»¼ì²éϱêÊÇ·ñÔ½½ç¿ÉÒÔÓÐЧÌá¸ß³ÌÐòÔËÐеÄЧÂÊ£¬ÒòΪÈç¹ûÄã¼ì²é£¬ÄÇô±àÒëÆ÷±ØÐëÔÚÉú³ÉµÄÄ¿±ê´úÂëÖмÓÈë¶îÍâµÄ´úÂëÓÃÓÚ³ÌÐòÔËÐÐʱ¼ì²âϱêÊÇ·ñÔ½½ç£¬Õâ¾Í»áµ¼Ö³ÌÐòµÄÔËÐÐËÙ¶ÈϽµ£¬ËùÒÔΪÁ˳ÌÐòµÄÔËÐÐЧÂÊ£¬C/C++²Å²»¼ì²éϱêÊÇ·ñÔ½½ç¡£
  ......