﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-2010，从头开始</title><link>http://www.cppblog.com/wangdx/</link><description /><language>zh-cn</language><lastBuildDate>Tue, 09 Jun 2026 21:29:36 GMT</lastBuildDate><pubDate>Tue, 09 Jun 2026 21:29:36 GMT</pubDate><ttl>60</ttl><item><title>[转载]vim插件使用 -- c.vim</title><link>http://www.cppblog.com/wangdx/archive/2010/08/09/122776.html</link><dc:creator>wangdx</dc:creator><author>wangdx</author><pubDate>Mon, 09 Aug 2010 06:48:00 GMT</pubDate><guid>http://www.cppblog.com/wangdx/archive/2010/08/09/122776.html</guid><wfw:comment>http://www.cppblog.com/wangdx/comments/122776.html</wfw:comment><comments>http://www.cppblog.com/wangdx/archive/2010/08/09/122776.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wangdx/comments/commentRss/122776.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wangdx/services/trackbacks/122776.html</trackback:ping><description><![CDATA[<h4> <p><a href="http://blog.chinaunix.net/u2/86325/showart_1886700.html"></a></p>尽管假期的时候浏览了一遍vimtutor, </h4> <p>但使用vim敲代码时还是不是很得心应手，  <p>一方面由于vim normal模式下快捷键颇多，  <p>一时半会还是难以完全的灵活掌握，  <p>另一方面发现我的vim插件少的可怜，  <p>需要好好打造一下。  <p>c.vim的功能就不介绍了，直接来<a href="http://vitaminj.blogbus.com/logs/%E8%BF%99%E9%87%8C">这里</a>可以看到并且提供下载地址。  <p>安装方法也很简单，  <p>直接解压到~/.vim/(for linux)或者/vimfiles/(for win)，并且plugin on一下就可以了，  <p>具体可以看插件附带的readme.  <p><a href="http://www.thegeekstuff.com/2009/01/tutorial-make-vim-as-your-cc-ide-using-cvim-plugin/">这里</a>提供使用方法,我做一下简单的总结。  <p>－－－－－－－－－－华丽分割－－－－－－－－－－－－  <p>1.在~/.vim/c-support/templates/Templates可以设置版权信息，如作者、信箱、版权归属等，新建.c或.cpp文件是可以看到，并且列出了使用模板文件位置，可以自己编辑  <p>2.\if&nbsp;&nbsp;&nbsp; 插入一般函数  <p>3.\im&nbsp;&nbsp;&nbsp; 插入主函数  <p>4.\cfu&nbsp;&nbsp;&nbsp; 插入函数头,即函数说明  <p>5.\cfr&nbsp;&nbsp;&nbsp; 插入一个frame comment,可以用来写变量说明  <p>6.\p&lt;&nbsp;&nbsp;&nbsp; 插入一个include , 并且把光标放在&lt;&gt;中  <p>7.\rc&nbsp;&nbsp;&nbsp; 保存并编译  <p>8.\rr&nbsp;&nbsp; 运行  <p>9.\nr&nbsp;&nbsp;&nbsp; 可以在~/.vim/c-support/codesnippets中编写一些预编译代码或者代码块,通过此命令使用  <p>---------------------------------------------  <p>总之c.vim是个不错的c/c++辅助代码插件 , 恩.  <p>---------------------附:详细的c.vim hotkey-------------------------<pre>-- Help ---------------------------------------------------------------<br><br>  \hm       show manual for word under the cursor (n,i)<br>  \hp       show plugin help                      (n,i)<br><br>  -- Comments -----------------------------------------------------------<br><br>  \cl       end-of-line comment                 (n,v,i)<br>  \cj       adjust end-of-line comment(s)       (n,v,i)<br>  \cs       set end-of-line comment column      (n)<br>  \c<strong>*<a name="       code -&gt; comment /">       code -&gt; comment /</a>*</strong> */               (n,v)<br>  \cc       code -&gt; comment //                  (n,v)<br>  \co       comment -&gt; code                     (n,v)<br>  \cfr      frame comment                       (n,i)<br>  \cfu      function comment                    (n,i)<br>  \cme      method description                  (n,i)<br>  \ccl      class description                   (n,i)<br>  \cd       date                                (n,v,i)<br>  \ct       date \&amp; time                        (n,v,i)<br><br>  -- Statements ---------------------------------------------------------<br><br>  \sd       do <code>{ }</code> while                        (n,v,i)<br>  \sf       for                                 (n,i)<br>  \sfo      for <code>{ }</code>                             (n,v,i)<br>  \si       if                                  (n,i)<br>  \sif      if <code>{ }</code>                              (n,v,i)<br>  \sie      if else                             (n,v,i)<br>  \sife     if <code>{ }</code> else <code>{ }</code>                     (n,v,i)<br>  \sw       while                               (n,i)<br>  \swh      while <code>{ }</code>                           (n,v,i)<br>  \ss       switch                              (n,v,i)<br>  \sc       case                                (n,i)<br>  \s<code>{       { }</code>                                 (n,v,i)<br><br>  -- Preprocessor -------------------------------------------------------<br><br>  \p<code>&lt;       #include &lt;&gt;</code>                         (n,i)<br>  \p"       #include ""                         (n,i)<br>  \pd       #define                             (n,i)<br>  \pu       #undef                              (n,i)<br>  \pie      #if  #else #endif                   (n,v,i)<br>  \pid      #ifdef #else #endif                 (n,v,i)<br>  \pin      #ifndef #else #endif                (n,v,i)<br>  \pind     #ifndef #def #endif                 (n,v,i)<br>  \pi0      #if 0 #endif                        (n,v,i)<br>  \pr0      remove #if 0 #endif                 (n,i)<br>  \pe       #error                              (n,i)<br>  \pl       #line                               (n,i)<br>  \pp       #pragma                             (n,i)<br><br>  -- Idioms -------------------------------------------------------------<br><br>  \if       function                            (n,v,i)<br>  \isf      static function                     (n,v,i)<br>  \im       main()                              (n,v,i)<br>  \i0       for( x=0; x&lt;n; x+=1 )               (n,v,i)<br>  \in       for( x=n-1; x&gt;=0; x-=1 )            (n,v,i)<br>  \ie       enum   + typedef                    (n,i)<br>  \is       struct + typedef                    (n,i)<br>  \iu       union  + typedef                    (n,i)<br>  \ip       printf()                            (n,i)<br>  \isc      scanf()                             (n,i)<br>  \ica      p=calloc()                          (n,i)<br>  \ima      p=malloc()                          (n,i)<br>  \isi      sizeof()                            (n,v,i)<br>  \ias      assert()                            (n,v)<br>  \ii       open input file                     (n,i)<br>  \io       open output file                    (n,i)<br><br>  -- Snippets -----------------------------------------------------------<br><br>  \nr       read code snippet                   (n,i)<br>  \nw       write code snippet                  (n,v,i)<br>  \ne       edit code snippet                   (n,i)<br>  \np       pick up prototype                   (n,v,i)<br>  \ni       insert prototype(s)                 (n,i)<br>  \nc       clear  prototype(s)                 (n,i)<br>  \ns       show   prototype(s)                 (n,i)<br>  \ntl      edit local templates                (n,i)<br>  \ntg      edit global templates               (n,i)<br>  \ntr      rebuild templates                   (n,i)<br><br>  -- C++ ----------------------------------------------------------------<br><br>  \+co      cout  &lt;&lt;  &lt;&lt; endl;                  (n,i)<br>  \+c       class                               (n,i)<br>  \+cn      class (using new)                   (n,i)<br>  \+ci      class implementation                (n,i)<br>  \+cni     class (using new) implementation    (n,i)<br>  \+mi      method implementation               (n,i)<br>  \+ai      accessor implementation             (n,i)<br><br>  \+tc      template class                      (n,i)<br>  \+tcn     template class (using new)          (n,i)<br>  \+tci     template class implementation       (n,i)<br>  \+tcni    template class (using new) impl.    (n,i)<br>  \+tmi     template method implementation      (n,i)<br>  \+tai     template accessor implementation    (n,i)<br><br>  \+tf      template function                   (n,i)<br>  \+ec      error class                         (n,i)<br>  \+tr      try ... catch                       (n,v,i)<br>  \+ca      catch                               (n,v,i)<br>  \+c.      catch(...)                          (n,v,i)<br><br>  -- Run ----------------------------------------------------------------<br><br>  \rc       save and compile                    (n,i)<br>  \rl       link                                (n,i)<br>  \rr       run                                 (n,i)<br>  \ra       set comand line arguments           (n,i)<br>  \rm       run make                            (n,i)<br>  \rg       cmd. line arg. for make             (n,i)<br>  \rp       run splint                          (n,i)<br>  \ri       cmd. line arg. for splint           (n,i)<br>  \rk       run CodeCheck (TM)                  (n,i)<br>  \re       cmd. line arg. for CodeCheck (TM)   (n,i)<br>  \rd       run indent                          (n,v,i)<br>  \rh       hardcopy buffer                     (n,v,i)<br>  \rs       show plugin settings                (n,i)<br>  \rx       set xterm size                      (n, only Linux/UNIX &amp; GUI)<br>  \ro       change output destination           (n,i)<br><br><br>注：<br>下载地址：http://www.vim.org/scripts/script.php?script_id=213<br></pre>
<p>package<br>script version<br>date<br>Vim version<br>user<br>release notes 
<p><a href="http://www.vim.org/scripts/download_script.php?src_id=9990">cvim.zip</a><br><b>5.5</b><br><i>2009-02-17</i><br>7.0<br><i><a href="http://www.vim.org/account/profile.php?user_id=169">Fritz Mehner</a></i><br>+ Additional plugin-tags (jump targets in templates): &lt;+text+&gt;, &lt;-text-&gt;. <br>+ Additional mapping Ctrl-j : jump to these new targets. <br>+ Template-file: additional macro |STYLE| and IF-ENDIF-construct to easily <br>&nbsp; choose between sets of templates. <br>+ Additional mapping: auto-complete classical C comment (also multi-line). <br>+ Additional mapping: auto-complete open block starting with {&lt;CR&gt; . <br>+ Visual mode for date and time insertion (menu 'Comments'). <br>+ Visual mode for tags (submenu 'Comments-&gt;tags (plugin)'). <br>+ Bugfix: hotkey \ica not working <br>+ Bugfix: hotkey Shift-F2 for the alternate-plugin disappeared. <pre><br></pre>
<p><b>原文地址</b> <a href="http://vitaminj.blogbus.com/logs/35851648.html">http://vitaminj.blogbus.com/logs/35851648.html</a></p><img src ="http://www.cppblog.com/wangdx/aggbug/122776.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wangdx/" target="_blank">wangdx</a> 2010-08-09 14:48 <a href="http://www.cppblog.com/wangdx/archive/2010/08/09/122776.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>