免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1841 | 回复: 0
打印 上一主题 下一主题

vim插件使用 -- c.vim [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-03-31 23:04 |只看该作者 |倒序浏览

                尽管假期的时候浏览了一遍vimtutor,
但使用vim敲代码时还是不是很得心应手,
一方面由于vim normal模式下快捷键颇多,
一时半会还是难以完全的灵活掌握,
另一方面发现我的vim插件少的可怜,
需要好好打造一下。

c.vim的功能就不介绍了,直接来
这里
可以看到并且提供下载地址。
安装方法也很简单,
直接解压到~/.vim/(for linux)或者/vimfiles/(for win),并且plugin on一下就可以了,
具体可以看插件附带的readme.
这里
提供使用方法,我做一下简单的总结。
----------华丽分割------------
1.在~/.vim/c-support/templates/Templates可以设置版权信息,如作者、信箱、版权归属等,新建.c或.cpp文件是可以看到,并且列出了使用模板文件位置,可以自己编辑
2.\if    插入一般函数
3.\im    插入主函数
4.\cfu    插入函数头,即函数说明
5.\cfr    插入一个frame comment,可以用来写变量说明
6.\p中
7.\rc    保存并编译
8.\rr   运行
9.\nr    可以在~/.vim/c-support/codesnippets中编写一些预编译代码或者代码块,通过此命令使用
---------------------------------------------
总之c.vim是个不错的c/c++辅助代码插件 , 恩.
---------------------附:详细的c.vim hotkey-------------------------
-- Help ---------------------------------------------------------------
  \hm       show manual for word under the cursor (n,i)
  \hp       show plugin help                      (n,i)
  -- Comments -----------------------------------------------------------
  \cl       end-of-line comment                 (n,v,i)
  \cj       adjust end-of-line comment(s)       (n,v,i)
  \cs       set end-of-line comment column      (n)
  \c* comment /">       code -> comment /* */               (n,v)
  \cc       code -> comment //                  (n,v)
  \co       comment -> code                     (n,v)
  \cfr      frame comment                       (n,i)
  \cfu      function comment                    (n,i)
  \cme      method description                  (n,i)
  \ccl      class description                   (n,i)
  \cd       date                                (n,v,i)
  \ct       date \& time                        (n,v,i)
  -- Statements ---------------------------------------------------------
  \sd       do { } while                        (n,v,i)
  \sf       for                                 (n,i)
  \sfo      for { }                             (n,v,i)
  \si       if                                  (n,i)
  \sif      if { }                              (n,v,i)
  \sie      if else                             (n,v,i)
  \sife     if { } else { }                     (n,v,i)
  \sw       while                               (n,i)
  \swh      while { }                           (n,v,i)
  \ss       switch                              (n,v,i)
  \sc       case                                (n,i)
  \s{       { }                                 (n,v,i)
  -- Preprocessor -------------------------------------------------------
  \p                         (n,i)
  \p"       #include ""                         (n,i)
  \pd       #define                             (n,i)
  \pu       #undef                              (n,i)
  \pie      #if  #else #endif                   (n,v,i)
  \pid      #ifdef #else #endif                 (n,v,i)
  \pin      #ifndef #else #endif                (n,v,i)
  \pind     #ifndef #def #endif                 (n,v,i)
  \pi0      #if 0 #endif                        (n,v,i)
  \pr0      remove #if 0 #endif                 (n,i)
  \pe       #error                              (n,i)
  \pl       #line                               (n,i)
  \pp       #pragma                             (n,i)
  -- Idioms -------------------------------------------------------------
  \if       function                            (n,v,i)
  \isf      static function                     (n,v,i)
  \im       main()                              (n,v,i)
  \i0       for( x=0; x=0; x-=1 )            (n,v,i)
  \ie       enum   + typedef                    (n,i)
  \is       struct + typedef                    (n,i)
  \iu       union  + typedef                    (n,i)
  \ip       printf()                            (n,i)
  \isc      scanf()                             (n,i)
  \ica      p=calloc()                          (n,i)
  \ima      p=malloc()                          (n,i)
  \isi      sizeof()                            (n,v,i)
  \ias      assert()                            (n,v)
  \ii       open input file                     (n,i)
  \io       open output file                    (n,i)
  -- Snippets -----------------------------------------------------------
  \nr       read code snippet                   (n,i)
  \nw       write code snippet                  (n,v,i)
  \ne       edit code snippet                   (n,i)
  \np       pick up prototype                   (n,v,i)
  \ni       insert prototype(s)                 (n,i)
  \nc       clear  prototype(s)                 (n,i)
  \ns       show   prototype(s)                 (n,i)
  \ntl      edit local templates                (n,i)
  \ntg      edit global templates               (n,i)
  \ntr      rebuild templates                   (n,i)
  -- C++ ----------------------------------------------------------------
  \+co      cout  package
    script version
    date
    Vim version
    user
    release notes
        
cvim.zip
    5.5
    2009-02-17
    7.0
   
Fritz Mehner

    + Additional plugin-tags (jump targets in templates): , .
+ Additional mapping Ctrl-j : jump to these new targets.
+ Template-file: additional macro |STYLE| and IF-ENDIF-construct to easily
  choose between sets of templates.
+ Additional mapping: auto-complete classical C comment (also multi-line).
+ Additional mapping: auto-complete open block starting with { .
+ Visual mode for date and time insertion (menu 'Comments').
+ Visual mode for tags (submenu 'Comments->tags (plugin)').
+ Bugfix: hotkey \ica not working
+ Bugfix: hotkey Shift-F2 for the alternate-plugin disappeared.
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/86325/showart_1886700.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP