乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      VIM開發(fā)C/C++插件cvim的安裝及使用

       Rainboy913 2013-12-04

      利用c.vim插件,你可以實(shí)現(xiàn)

      • 添加文件頭
      • 添加注釋
      • 插入一些代碼片段
      • 語(yǔ)法檢查
      • 讀函數(shù)文檔
      • 注釋代碼塊

      這一插件的作者是 Fritz Mehner, 目標(biāo)就是打造程序員流暢的編輯環(huán)境。

      這一插件還能完成:

      • 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


      接下來(lái)我們對(duì)這一插件詳細(xì)介紹.

      3 安裝插件

      Step 1: 下載c.vim

      $ cd /usr/src
      $ wget http://www./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

      當(dāng)你新建一個(gè)擴(kuò)展名.c的文件時(shí)候,自動(dòng)在文件頭部增加頭部注釋

      $ 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
      * 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


      現(xiàn)在編輯一個(gè)新文件,看看你的作者和公司名稱改變了沒(méi)有。

      $ 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
      *
      * =================================================
      */

      Feature 2: 用/if 添加c函數(shù)

      鍵入/if 加函數(shù)名稱 (as shown in Fig1 below) 就會(huì)在文件中自動(dòng)完成函數(shù)的定義,就像圖二那樣。

      Vim C/C++ IDE - Adding C Function - 1

      Fig1:Insert C Function Automatically

      Vim C/C++ IDE - Adding C Function - 2

      Fig 2:Insert C Function Automatically

      Feature 3: 用/im 添加main函數(shù)

      添加的效果如下:

      Fig 3: Insert C main function automatically

      Feature 4: 用 /cfu 添加函數(shù)注釋

      Vim C/C++ IDE - Insert C Function Header - 1

      Fig 4: Insert C Function Header Automatically

      Vim C/C++ IDE - Insert C Function Header - 1

      Fig 5: Insert C Function Header Automatically

      Feature 5: 用/cfr添加注釋框架

      Vim C/C++ IDE - Insert Frame Comment

      Fig 6: Insert a Frame Comment Automatically

      Feature 6: 用/p<包含頭文件

      Type /p< in the normal mode, which will include the text “#include <>”, and places the cursor in the < symbol in Insert mode where you can type the header file name.

      Feature 7: 保存編譯文件.

      保存并編譯文件 /rc.

      運(yùn)行 /rr.

      Feature 8: 用/nr 插入預(yù)定義的代碼片段

      The plugin comes with few pre-defined code snippets that you can insert into your code. Following are the default code snippets that comes with the plugin.

      $ ls ~/.vim/c-support/codesnippets
      Makefile calloc_double_matrix.c main.c print_double_array.c.noindent
      Makefile.multi-target.template calloc_int_matrix.c main.cc print_int_array.c.noindent

      For example, if you want to create a function that will Allocate a dynamic int-matrix of size rows*columns; return a pointer, you can re-use it from the existing code snippets. Following is the content of the calloc_int_matrix.c pre-defined code snippets.

      /*
      * === FUNCTION ======================================================================
      * Name: calloc_int_matrix
      * Description: Allocate a dynamic int-matrix of size rows*columns; return a pointer.
      * =====================================================================================
      */
      int**
      calloc_int_matrix ( int rows, int columns )
      {
      int i;
      int **m;
      m = calloc ( rows, sizeof(int*) ); /* allocate pointer array */
      assert( m != NULL ); /* abort if allocation failed */
      *m = calloc ( rows*columns, sizeof(int) ); /* allocate data array */
      assert(*m != NULL ); /* abort if allocation failed */
      for ( i=1; i
      m[i] = m[i-1] + columns;
      return m;
      } /* ———- end of function calloc_int_matrix ———- */


      如果要插入這段代碼,可以鍵入/nr 文件名稱,代碼就會(huì)自動(dòng)插入

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多