citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

csupport.txt (72022B)


      1 *csupport.txt*                  C/C++ Support                   March 05 2008
      2 
      3 C/C++ Support                                           *c-support* *csupport*
      4                               Plugin version 5.1
      5                         for Vim version 6.0 and above
      6                        Fritz Mehner  <mehner@fh-swf.de>
      7 
      8 C/C++-IDE for Vim/gVim. It is written to considerably speed up writing code in
      9 a consistent style.  This is done by inserting complete statements,idioms, code
     10 snippets, templates, and comments.  Syntax checking, compiling,  running a
     11 program, running a code checker or indent can be done with a keystroke.  
     12 
     13 
     14  1.    Usage                                    |csupport-usage-gvim|        
     15  1.1    Menu 'Comments'                         |csupport-comm|
     16  1.1.1   Append aligned comments                |csupport-comm-aligned|
     17  1.1.2   Adjust end-of-line comments            |csupport-comm-realign|
     18  1.1.3   Code to comment                        |csupport-code-to-comm|
     19  1.1.4   Comment to code                        |csupport-comm-to-code|
     20  1.1.5   Frame comments, file header, ...       |csupport-comm-frame|
     21  1.1.6   KEYWORD + comment                      |csupport-comm-keywords|
     22  1.1.7   C to C++ comments and vice versa       |csupport-comm-c-cpp|
     23  1.1.8   Date and date+time                     |csupport-comm-date|
     24  1.2    Menu 'Statements'                       |csupport-stat|
     25  1.2.1   Normal mode, insert mode.              |csupport-stat-normal-mode|
     26  1.2.2   Visual mode.                           |csupport-stat-visual-mode|
     27  1.3    Menu 'Preprocessor'                     |csupport-prep|
     28  1.3.1   Normal mode, insert mode.              |csupport-prep-normal-mode|
     29  1.3.2   Visual mode.                           |csupport-prep-visual-mode|
     30  1.3.3   Block out code with #if 0 .. #endif    |csupport-prep-if0|
     31  1.4    Menu 'Idioms'                           |csupport-idioms|
     32  1.5    Menu 'Snippets'                         |csupport-snippets|
     33  1.5.1   Code snippets                          |csupport-snippets|
     34  1.5.2   Picking up prototypes                  |csupport-proto|
     35  1.6    Menu 'C++'                              |csupport-c++|
     36  1.6.1   Normal mode, insert mode.              |csupport-c++-normal-mode|
     37  1.6.2   Visual mode.                           |csupport-c++-visual-mode|
     38  1.6.3   Method implementation                  |csupport-c++-method-impl|
     39  1.7    Menu 'Run'                              |csupport-run|
     40  1.7.1   Minimal make functionality             |csupport-run-buffer|
     41  1.7.2   Command line arguments                 |csupport-run-cmdline-args|
     42  1.7.3   Run make                               |csupport-run-make|
     43  1.7.4   Command line arguments for make        |csupport-run-make-args|
     44  1.7.5   Splint                                 |csupport-run-splint|
     45  1.7.6   CodeCheck                              |csupport-run-codecheck|
     46  1.7.7   Indent                                 |csupport-run-indent|
     47  1.7.8   Hardcopy                               |csupport-run-hardcopy|
     48  1.7.9   Rebuild templates                      |csupport-run-templates|
     49  1.7.10  Xterm size                             |csupport-run-xterm|
     50  1.7.11  Output redirection                     |csupport-run-output|
     51  1.8    Help                                    |csupport-help|
     52 
     53  2.    Usage without GUI                        |csupport-usage-vim|
     54  3.    Hotkeys                                  |csupport-hotkeys|           
     55  4.    Customization and configuration          |csupport-custom|     
     56  4.1    Global variables                        |csupport-custom-glob-vars|
     57  4.2    The root menu                           |csupport-custom-root-menu|
     58  4.3     System-wide installation               |csupport-system-wide|
     59  5.    Template files and tags                  |csupport-templates|    
     60  5.1    Template files                          |csupport-templates-files|    
     61  5.2    Macros                                  |csupport-templates-macros|
     62  5.3    Templates                               |csupport-templates-names|
     63  5.3.1  Template names                          |csupport-templates-names|
     64  5.3.2  Template definition                     |csupport-templates-definition|
     65  5.3.3  Template expansion                      |csupport-templates-expansion|
     66  6.    C/C++ Dictionaries                       |csupport-dictionary|        
     67  7.    Extend taglist.vim for make and qmake    |csupport-taglist|     
     68  8.    Syntax based folding                     |csupport-folding|     
     69  9.    Windows particularities                  |csupport-windows|
     70 10.    Troubleshooting                          |csupport-troubleshooting|
     71 11.    Release Notes /Change Log                |csupport-release-notes|     
     72 
     73        How to add this help file to Vim's help  |add-local-help|             
     74 
     75 
     76 ==============================================================================
     77 1.  USAGE WITH GUI  (gVim)                               *csupport-usage-gvim*
     78 ==============================================================================
     79 
     80 If the root menu 'C/C++' is not visible call it with the item "Load C Support" 
     81 from the standard Tools-menu.
     82 The item "Load C Support" can also be used to unload the C/C++-root menu.
     83 
     84 Nearly all menu entries insert code snippets or comments. All these stuff is
     85 taken from template files and can be changed by the user to meet his
     86 requirements (see|csupport-templates|).
     87 
     88 ------------------------------------------------------------------------------
     89 1.1  MENU 'Comments'                                           *csupport-comm*
     90 ------------------------------------------------------------------------------
     91 
     92 1.1.1  APPEND ALIGNED COMMENTS TO CONSECUTIVE LINES    *csupport-comm-aligned*
     93 
     94 In NORMAL MODE the menu items 'end-of-line comment' will append an comment to
     95 the current line. 
     96 In VISUAL MODE these item will append aligned comments to all marked lines.
     97 Marking the first 4 lines
     98 
     99   print_double_array ( double array[],
    100                        int    n,
    101                        int    columns,
    102                        char*  arrayname
    103                        )
    104 
    105 and choosing 'end-of-line com. /**/' will yield.
    106 
    107   print_double_array ( double array[],          /*  */
    108                        int    n,                /*  */
    109                        int    columns,          /*  */
    110                        char*  arrayname         /*  */
    111                        )                        /*  */
    112 
    113 If one ore more lines go beyond the starting column (s.below) the comments
    114 will start at the 2. column after the longest line.  The cursor will be
    115 positioned inside the first comment.
    116 
    117 The default starting column is 49 ( = (multiple of 2,4, or 8) + 1 ).  This can
    118 be changed by setting a global variable in the file ~/.vimrc , e.g. :
    119 
    120   let g:C_LineEndCommColDefault    = 45
    121 
    122 The starting column can also be set by the menu item 
    123 'Comments->set end-of-line com. col' . Just position the cursor in an
    124 arbitrary column (column number is shown in the Vim status line) and choose
    125 this menu item.  This setting is buffer related.
    126 
    127 If the cursor was at the end of a line you will be asked for a column number
    128 because this position is most likely not the desired starting column.
    129 Your choice will be confirmed.
    130 
    131 ------------------------------------------------------------------------------
    132 
    133 1.1.2  ADJUST END-OF-LINE COMMENTS                    *csupport-comm-realign*
    134 
    135 After some changes end-of-line comments may be no longer aligned:
    136 
    137   print_double_array ( double       array[],          /*  */
    138                        long int     n,                     /*  */
    139                        unsigned int columns,          /*  */
    140                        char*        a_name         /*  */
    141                        )                        /*  */
    142 
    143 Realignment can be achieved with the menu item 'adjust end-of-line com.' In
    144 normal mode the comment (if any) in the current line will be aligned to the
    145 end-of-line comment column (see above) if possible. In visual mode the
    146 comments in the marked block will be aligned:
    147 
    148   print_double_array ( double       array[],    /*  */
    149                        long int     n,          /*  */
    150                        unsigned int columns,    /*  */
    151                        char*        a_name      /*  */
    152                        )                        /*  */
    153 
    154 ------------------------------------------------------------------------------
    155 
    156 1.1.3  CODE TO COMMENT                                 *csupport-code-to-comm*
    157 
    158 The marked block
    159 
    160 xxxxxxxx
    161 xxxxxxxx
    162 xxxxxxxx
    163 
    164 will be changed by the menu item 'code->comment /**/' into the multiline
    165 comment (all (partially) marked lines):
    166 
    167 /* xxxxxxxx
    168  * xxxxxxxx
    169  * xxxxxxxx
    170  */
    171 
    172 The marked block will be changed  by the menu item 'code->comment //' into the
    173 multiline comment
    174 
    175 //xxxxxxxx
    176 //xxxxxxxx
    177 //xxxxxxxx
    178 
    179 The menu items works also for a single line. A single line needs not to be
    180 marked. 
    181 
    182 ------------------------------------------------------------------------------
    183 
    184 1.1.4  COMMENT TO CODE                                 *csupport-comm-to-code*
    185 
    186 If one (or more) complete comment (i.e. all lines belonging to the comment) is
    187 marked the item 'comment->code' will uncomment it.  If the following lines
    188 are marked
    189 
    190    * printf ("\n");
    191    */
    192 
    193   printf ("\n");
    194 
    195   //  printf ("\n");
    196   //
    197 
    198   /* 
    199    *  printf ("\n");
    200    */
    201 
    202 uncommenting will yield
    203 
    204    * printf ("\n");
    205    */
    206 
    207   printf ("\n");
    208 
    209   printf ("\n");
    210 
    211 
    212 
    213   printf ("\n");
    214 
    215 The first 2 lines are only a part of a C-comment and remain unchanged.
    216 A C-comment can start with /* , /** or /*! .
    217 
    218 The menu item works also for a single line with a leading // . A single line
    219 needs not to be marked. 
    220 
    221 ------------------------------------------------------------------------------
    222 
    223 1.1.5  FRAME COMMENTS, FILE HEADER, ...                  *csupport-comm-frame*
    224 
    225 Frame comments, file header comments and function, methods, class descriptions 
    226 are read as templates from the appropriate files (see |csupport-templates|).
    227 
    228 ------------------------------------------------------------------------------
    229 
    230 1.1.6  KEYWORD+comment                                *csupport-comm-keywords*
    231 
    232 Preliminary comments to document (and find again) places where works will be
    233 resumed shortly. Usually not meant for the final documentation.
    234 
    235 ------------------------------------------------------------------------------
    236 
    237 1.1.7  C TO C++ COMMENTS AND VICE VERSA                  *csupport-comm-c-cpp*
    238 
    239 The menu item '// xxx -> /* xxx */' changes a C++ comment into an C comment.
    240 This is done for the current line in normal or insert mode and for a marked
    241 area of lines in visual mode.
    242 If there are multiple C comments only the first one will be changed:
    243   printf ("\n");                     /* one */ /* two */ /* three */
    244 will be changed into
    245   printf ("\n");                     // one  /* two */ /* three */
    246 
    247 The menu item '/* xxx */ -> // xxx' changes a C comment into an C++ comment.
    248 
    249 ------------------------------------------------------------------------------
    250 
    251 1.1.8  DATE AND DATE+TIME                                 *csupport-comm-date*
    252 
    253 The format for 'date' and 'date time' can be defined by the user (see
    254 |csupport-templates-date|).
    255 
    256 ------------------------------------------------------------------------------
    257 1.2  MENU 'Statements'                                         *csupport-stat*
    258 ------------------------------------------------------------------------------
    259 
    260 1.2.1  NORMAL MODE, INSERT MODE.                   *csupport-stat-normal-mode*
    261 
    262 An empty statement will be inserted and properly indented. The item 'if{}'
    263 will insert an if-statement:
    264 
    265 if (  )
    266 {
    267 }
    268 
    269 
    270 1.2.2  VISUAL MODE.                                *csupport-stat-visual-mode*
    271 
    272 STATEMENTS WITH BLOCKS AND CASE LABEL.  
    273 --------------------------------------
    274 The highlighted area 
    275 
    276 xxxxx
    277 xxxxx
    278 
    279 can be surrounded by one of the following statements:
    280 
    281   +----------------------------+-----------------------------+
    282   |     if (  )                |     if (  )                 |
    283   |     {                      |     {                       |
    284   |       xxxxx                |       xxxxx                 |
    285   |       xxxxx                |       xxxxx                 |
    286   |     }                      |     }                       |
    287   |                            |     else                    |
    288   |                            |     {                       |
    289   |                            |     }                       |
    290   +----------------------------+-----------------------------+
    291   |     for ( ; ;  )           |     while (  )              |
    292   |     {                      |     {                       |
    293   |       xxxxx                |       xxxxx                 |
    294   |       xxxxx                |       xxxxx                 |
    295   |     }                      |     }                       |
    296   +----------------------------+-----------------------------+
    297   |     do                     |                             |
    298   |     {                      |     {                       |
    299   |       xxxxx                |       xxxxx                 |
    300   |       xxxxx                |       xxxxx                 |
    301   |     }                      |     }                       |
    302   |     while (  );            |                             |
    303   +----------------------------+-----------------------------+
    304   |      switch (  ) {                                       |
    305   |      case :                                              |
    306   |       break;                                             |
    307   |                                                          |
    308   |      case :                                              |
    309   |       break;                                             |
    310   |                                                          |
    311   |      case :                                              |
    312   |       break;                                             |
    313   |                                                          |
    314   |      case :                                              |
    315   |       break;                                             |
    316   |                                                          |
    317   |      default:                                            |
    318   |       break;                                             |
    319   |      }                                                   |
    320   +----------------------------+-----------------------------+
    321 
    322 For 'switch' and 'case' see |csupport-stat-switch| and |csupport-stat-case|.
    323 
    324 The whole statement will be indented after insertion.
    325 
    326 
    327 STATEMENTS WITHOUT BLOCKS.  
    328 --------------------------
    329 One of the following statements can be inserted:
    330 
    331   +-------------------------------+--------------------------+
    332   |    if (  )                    |    for ( ; ;  )          |
    333   +-------------------------------+--------------------------+
    334   |    if (  )                    |    while (  )            |
    335   |    else                       |                          |
    336   +-------------------------------+--------------------------+
    337   |    case :                     |                          |
    338   |      break;                   |                          |
    339   +-------------------------------+--------------------------+
    340 
    341 
    342 ------------------------------------------------------------------------------
    343 1.3  MENU 'Preprocessor'                                       *csupport-prep*
    344 ------------------------------------------------------------------------------
    345 
    346 1.3.1  NORMAL MODE, INSERT MODE.                   *csupport-prep-normal-mode*
    347 
    348 The preprocessor statements will be inserted and properly indented. 
    349 
    350 1.3.2  VISUAL MODE.                                *csupport-prep-visual-mode*
    351 
    352 STATEMENTS WITH BLOCKS
    353 ----------------------
    354 The highlighted area 
    355 
    356 xxxxx
    357 xxxxx
    358 
    359 can be surrounded by one of the following statements:
    360 
    361   +----------------------------+-----------------------------+
    362   |    #if  CONDITION                                        |
    363   |    xxxxx                                                 |
    364   |    xxxxx                                                 |
    365   |    #else      /* ----- #if CONDITION  ----- */           |
    366   |                                                          |
    367   |    #endif     /* ----- #if CONDITION  ----- */           |
    368   +----------------------------------------------------------+
    369   |    #ifdef  CONDITION                                     |
    370   |    xxxxx                                                 |
    371   |    xxxxx                                                 |
    372   |    #else      /* ----- #ifdef CONDITION  ----- */        |
    373   |                                                          |
    374   |    #endif     /* ----- #ifdef CONDITION  ----- */        |
    375   +----------------------------------------------------------+
    376   |    #ifndef  CONDITION                                    |
    377   |    xxxxx                                                 |
    378   |    xxxxx                                                 |
    379   |    #else      /* ----- #ifndef CONDITION  ----- */       |
    380   |                                                          |
    381   |    #endif     /* ----- #ifndef CONDITION  ----- */       |
    382   +----------------------------------------------------------+
    383   |    #ifndef  INC_TEST                                     |
    384   |    #define  INC_TEST                                     |
    385   |    xxxxx                                                 |
    386   |    xxxxx                                                 |
    387   |    #endif   /* ----- #ifndef INC_TEST  ----- */          |
    388   +----------------------------------------------------------+
    389   |    #if  0     /* ----- #if 0 : If0Label_1 ----- */       |
    390   |                                                          |
    391   |    #endif     /* ----- #if 0 : If0Label_1 ----- */       |
    392   +----------------------------------------------------------+
    393 
    394 The macro name for an include guard (e.g. INC_TEST above) will be derived as a
    395 suggestion from the file name.  
    396 
    397 1.3.3  BLOCK OUT CODE WITH #if 0 ... #endif                *csupport-prep-if0*
    398 
    399 The menu item #if 0 #endif  inserts the lines
    400 
    401   #if  0     /* ----- #if 0 : If0Label_1 ----- */
    402 
    403   #endif     /* ----- #if 0 : If0Label_1 ----- */
    404 
    405 In visual mode the marked block of lines will be surrounded by these lines.
    406 
    407 This is usually done to temporarily block out some code.  The label names like
    408 If0Label_1 are automatically inserted into the comments.  The trailing numbers
    409 are automatically incremented.  These numbers can be changed by the user.  The
    410 next number will be one above the highest number found in the current buffer.
    411 
    412 A corresponding label can be found by searching with the vim star command (*).
    413 All labels can be found with a global search like :g/If0Label_/ or
    414 :g/If0Label_\d\+/. All corresponding lines can be deleted with :g/If0Label_/d .
    415 
    416 
    417 REMOVE THE ENCLOSING #if 0 ... #endif -CONSTRUCT.
    418 
    419 The menu item 'remove #if #endif' removes such a construct if the cursor is
    420 in the middle of such a section or on one of the two enclosing lines. Nested
    421 constructs will be untouched.
    422 
    423 ------------------------------------------------------------------------------
    424 1.4  MENU 'Idioms'                                           *csupport-idioms*
    425 ------------------------------------------------------------------------------
    426 
    427 1.4.1  ENTRY 'function'
    428 
    429 NORMAL MODE, INSERT MODE: 
    430 The name of the function is asked for and the following lines (for function
    431 name "f") will be inserted:
    432 
    433   void
    434   f (  )
    435   {
    436     return ;
    437   }        /* ----------  end of function f  ---------- */
    438 
    439 VISUAL MODE: 
    440 Main or [static] function: the highlighted lines will go inside the new
    441 function or main. 
    442 for-loops: the highlighted lines will be set in braces.
    443 
    444 1.4.2  ENTRY 'open input file'
    445 
    446 The item 'open input file' will create the statements to open and close an
    447 input file (e.g. with the file pointer 'infile'). 
    448 
    449 1.4.3  ENTRY 'open output file'
    450 
    451 The item 'open output file' will create the statements to open and close an
    452 output file (e.g. with the file pointer 'outfile'). 
    453 
    454 ------------------------------------------------------------------------------
    455 1.5  MENU 'Snippets'                                       *csupport-snippets*
    456 ------------------------------------------------------------------------------
    457 
    458 1.5.1  CODE SNIPPETS                                    
    459 
    460 Code snippets are pieces of code which are kept in separate files in a special
    461 directory (e.g. a few lines of code or a complete template for a Makefile).
    462 File names are used to identify the snippets.  The snippet directory will be
    463 created during the installation  ( $HOME/.vim/codesnippets-c is the default).
    464 Snippets are managed with the 3 items 
    465 
    466    C/C++ -> Snippets -> read  code snippet
    467    C/C++ -> Snippets -> write code snippet
    468    C/C++ -> Snippets -> edit  code snippet
    469 
    470 from the Snippets submenu.
    471 
    472 CREATING A NEW SNIPPET  
    473 When nothing is marked, "write code snippet" will write the whole buffer 
    474 to a snippet file, otherwise the marked area will be written to a file.
    475 
    476 INSERT A SNIPPET
    477 Select the appropriate file from the snippet directory ("read  code snippet").
    478 The inserted lines will be indented.
    479 
    480 EDIT A SNIPPET
    481 This is a normal edit.
    482 
    483 INDENTATION / NO INDENTATION
    484 Code snippets are normally indented after insertion. To suppress indentation
    485 add the file extension "ni" or "noindent" to the snippet file name, e.g.
    486 
    487   parameter_handling.c.noindent
    488 
    489 
    490 1.5.2   PICKING UP PROTOTYPES                                 *csupport-proto*
    491 
    492 PICK UP PROTOTYPES.  
    493 To make a prototype from a function head mark the function head and choose
    494 'Snippets -> pick up prototype'. From the first six lines of
    495 
    496    void
    497   print_double_array (  double array[],  /* array to print                */
    498                         int    n,        /* number of elements to print   */
    499                         int    columns,  /* number of elements per column */
    500                         char*  arrayname /* array name                    */
    501                         )
    502   {
    503     ...
    504   }       /* ----------  end of function print_double_array  ---------- */
    505 
    506 the prototype
    507 
    508   void print_double_array ( double array[], int n, int columns, char* arrayname );
    509 
    510 is produced and put in an internal buffer. 
    511 - Leading and trailing whitespaces are removed. 
    512 - All inner whitespaces are squeezed. 
    513 - All comments will be discarded.
    514 - Trailing parts of the function body (e.g a '{' ) will also be removed.
    515 - The class name and the scope resolution operator will be removed (C++ method
    516   implementations).
    517 Further prototypes can be picked up and gathered in the buffer.
    518 
    519 For C++ methods namespace names and class names will be removed
    520 (exception: 'std::' ). The first two lines of
    521 
    522   std::string
    523   ROBOT::Robot::get_name  ( void )
    524   {
    525     return type_name;
    526   }   /* -----  end of method Robot::get_name  ----- */
    527 
    528 result in the prototype
    529 
    530   std::string get_name ( void );
    531 
    532 Folding may help picking up prototypes (see |csupport-folding|).
    533 
    534 
    535 INSERT PROTOTYPES  
    536 With 'Snippets -> insert prototype(s)' all picked up prototypes currently in
    537 the buffer will be inserted below the cursor.
    538 The prototype buffer will be cleared after insertion.
    539 
    540 
    541 DISCARD PROTOTYPES  
    542 The prototype buffer can be cleared with 'Snippets -> clear prototype(s)' .
    543 
    544 
    545 SHOW PROTOTYPES  
    546 The list of gathered prototypes can be shown with 
    547 'Snippets -> show prototype(s)'. The number and the filename are shown, e.g. 
    548 
    549   (1) matrix.c #  double** calloc_double_matrix ( int rows, int columns );
    550   (2) matrix.c #  void free_double_matrix ( double **m );
    551   (3) foomain.c #  void foo ( );
    552 
    553 
    554 REMARK. Generating prototypes this way is nice in a small project. You may
    555 want to use an extractor like cextract or something else. 
    556 
    557 
    558 ------------------------------------------------------------------------------
    559 1.6  MENU 'C++'                                                 *csupport-c++*
    560 ------------------------------------------------------------------------------
    561 
    562 1.6.1  NORMAL MODE, INSERT MODE.                    *csupport-c++-normal-mode*
    563 
    564 An empty statement will be inserted and in some cases properly indented. The
    565 item 'try .. catch' will insert the following lines:
    566 
    567   try {
    568   }
    569   catch ( const &ExceptObj ) {    // handle exception:
    570   }
    571   catch (...) {   // handle exception: unspezified
    572   }
    573 
    574 The cursor will go into the try block.
    575 
    576 1.6.2  VISUAL MODE.                                 *csupport-c++-visual-mode*
    577 
    578 The highlighted area can be surrounded by one of the following statements:
    579 
    580   try - catch
    581   catch
    582   catch(...)
    583   namespace { }
    584   extern "C" { }
    585 
    586 The whole statement will be indented after insertion.
    587 
    588 1.6.3   METHOD IMPLEMENTATION                       *csupport-c++-method-impl*
    589 
    590 The menu item 'method implement.' asks for a method name. If this item is
    591 called the first time you will see just an scope resolution operator.  If you
    592 specify the scope this is used the next time you call this item.  If you use
    593 one of the menu items to generate a class (see |csupport-templates|) the
    594 scope will be extracted and used for the next method.  
    595 
    596 ------------------------------------------------------------------------------
    597 1.7  MENU 'Run'                                                 *csupport-run*
    598 ------------------------------------------------------------------------------
    599 
    600 1.7.1  MINIMAL MAKE FUNCTIONALITY                        *csupport-run-buffer*
    601 
    602 The 'Run' menu provides a minimal make functionality for single file projects
    603 (e.g. in education) :
    604 
    605 SAVE AND COMPILE
    606 'save and compile' saves the buffer and run the compiler with the given
    607 options (see |csupport-custom-glob-vars|).
    608 
    609 An error window will be opened if the compiler reports errors and/or warnings.
    610 Quickfix commands can now be used to jump to an error location.
    611 
    612 Consider using maps like 
    613   map  <silent> <F7>    <Esc>:cp<CR>
    614   map  <silent> <F8>    <Esc>:cn<CR>
    615 in your ~/.vimrc file to jump over the error locations and make navigation
    616 easier.  The error list and the error locations in your source buffer will be
    617 synchronized.
    618 
    619 
    620 LINK
    621 'link' makes an executable from the current buffer. If the buffer is not
    622 saved, or no object is available or the object is older then the source step
    623 'save and compile' is executed first.
    624 
    625 The behavior of the compiler / linker is determined by the options assigned to
    626 the variables described in |csupport-custom-glob-vars| (4.group).
    627 
    628 RUN
    629 'run' runs the executable with the same name (extension .e) as the current
    630 buffer. If the buffer is not saved, or no executable is available or the
    631 executable is older then the source steps 'save and compile' and 'link' are
    632 executed first.
    633 
    634 
    635 1.7.2  COMMAND LINE ARGUMENTS                      *csupport-run-cmdline-args*
    636 
    637 The item 'command line arguments' calls an input dialog which asks for command
    638 line arguments. These arguments are forwarded to the program which is run by
    639 the 'run' item. The arguments are kept until you change them.
    640 
    641 The arguments belong to the current buffer (that is, each buffer can have its 
    642 own arguments).
    643 If the buffer gets a new name with "save as" the arguments will now belong to
    644 the buffer with the new name.
    645 
    646 The command line arguments can be followed by pipes and redirections:
    647 
    648   11 22 | sort -rn | head -10 > out
    649 
    650 Caveat: If you look for the current arguments by calling this menu item again
    651 be sure to leave it with a CR (not Esc !). Due to a limitation of an internal
    652 Vim function CR will keep the arguments, Esc with discard them.
    653 
    654 
    655 1.7.3  RUN make                                            *csupport-run-make*
    656 
    657 The item 'make' runs the external make program.
    658 
    659 
    660 1.7.4  COMMAND LINE ARGUMENTS FOR make                *csupport-run-make-args*
    661 
    662 The item 'command line arguments for make' calls an input dialog which asks
    663 for command line arguments for make. These arguments are forwarded to make
    664 when called by the item 'make'.
    665 
    666 
    667 1.7.5  SPLINT                                            *csupport-run-splint*
    668 
    669 Splint is a tool for statically checking C programs (see http://www.splint.org).
    670 Of course it has to be installed in order to be used within Vim.  The menu
    671 item 'Run->splint' will run the current buffer through splint.
    672 
    673 An error window will be opened if splint has something to complain about.
    674 Quickfix commands can now be used to jump to an error location.  For easier
    675 navigation see tip under 'SAVE AND COMPILE' |csupport-run-buffer|.
    676 
    677 Splint has many options. Presumably the best way is to keep the options in an
    678 option file (~/.splintrc). For a quick try you can use the menu item
    679 'Run->cmd. line arg. for splint' to specify some buffer related options.  
    680 
    681 When vim is started this plugin will check whether splint is executable. If
    682 not, the menu item will *NOT' be visible.
    683 
    684 
    685 1.7.6  CODECHECK                                      *csupport-run-codecheck*
    686 
    687 CodeCheck (TM) is a commercial code analyzing tool produced by Abraxas
    688 Software, Inc.  (www.abraxas-software.com).
    689 Of course it has to be installed in order to be used within Vim.  The menu
    690 item 'Run->CodeCheck' will run the current buffer through CodeCheck.
    691 
    692 An error window will be opened if CodeCheck has something to complain about.
    693 Quickfix commands can now be used to jump to an error location.  For easier
    694 navigation see tip under 'SAVE AND COMPILE' |csupport-run-buffer|.
    695 
    696 CodeCheck has many options.  For a quick try you can use the menu item
    697 'Run->cmd. line arg. for CodeCheck' to specify some buffer related options.  
    698 
    699 CodeCheck will be run with default options (see |csupport-custom-glob-vars|).
    700 The default options can be overwritten by  placing a global variable in
    701 ~/.vimrc , e.g.
    702 
    703   let  g:C_CodeCheckOptions = "-K13 -Rmeyers"
    704 
    705 The default name for the executable is 'check'.  There are other names in use
    706 on different platforms.  The name can be changed by placing a global variable
    707 in ~/.vimrc , e.g.
    708 
    709   let  g:C_CodeCheckExeName = "chknt.exe"
    710 
    711 When vim is started this plugin will check whether CodeCheck is executable. If
    712 not, the menu item will *NOT' be visible.
    713 
    714 
    715 1.7.7  INDENT                                            *csupport-run-indent*
    716 
    717 The formatter 'indent' can be run over the whole buffer or a marked region.
    718 Before formatting the whole buffer this buffer will be saved to disk and you
    719 will be asked for a confirmation.
    720 
    721 Indent has many options. These are kept in the file '.indent.pro' in your home
    722 directory. See the indent manual for more information.
    723 
    724 
    725 1.7.8  HARDCOPY                                        *csupport-run-hardcopy*
    726 
    727 Generates a PostScript file from the whole buffer or from a marked region.
    728 On a Windows system a printer dialog is displayed.
    729 
    730 The print header contains date and time for the current locale. The definition
    731 used is
    732  
    733   let s:C_Printheader = "%<%f%h%m%<  %=%{strftime('%x %X')}     Page %N"
    734 
    735 The current locale can be overwritten by changing the language, e.g. 
    736 
    737   :language C
    738 
    739 or by setting a global variable in the file ~/.vimrc , e.g. :
    740 
    741   let g:C_Printheader = "%<%f%h%m%<  %=%{strftime('%x %X')}     SEITE %N"
    742 
    743 See :h printheader and :h strftime()  for more details. 
    744 
    745 
    746 1.7.9  REBUILD TEMPLATES                              *csupport-run-templates*
    747 
    748 After editing one or more template files  a click on this item rereads the
    749 template files and rebuilds all templates.
    750 
    751 
    752 1.7.10  XTERM SIZE                                        *csupport-run-xterm*
    753 
    754 The size of the xterm used for  running a program (below) can be set by this
    755 menu item. The default is 80 columns with 24 lines.  
    756 This feature is not available under Windows.
    757 
    758 
    759 1.7.11  OUTPUT REDIRECTION                               *csupport-run-output*
    760 
    761 Running a program can be done in one of three ways:
    762 (1) Run the program from the gVim command line.
    763     This is for interactive programs with little input and output.
    764 (2) Run the program and direct the output into a window with name "C-Output".
    765     The buffer and its content will disappear when the window is closed and 
    766     reused otherwise.
    767     This is for non-interactive programs with little to very much output.
    768     You have unlimited line length, regex search, navigation, ...
    769     The tabstop value will be set to 8  for "C-Output".
    770 (3) Run the program in an xterm.
    771 
    772 The output method can be chosen from the menu item 'Run->output: ...'.
    773 This menu has three states:
    774  
    775   output: VIM->buffer->xterm
    776   output: BUFFER->xterm->vim
    777   output: XTERM->vim->buffer
    778 
    779 The first (uppercase) item shows the current method.  The default is 'vim'.
    780 This can be changed by setting the variable g:C_OutputGvim to another value.
    781 Possible values are 'vim', 'buffer' and 'xterm' .
    782 
    783 The xterm defaults can be set in ~/.vimrc by the variable g:C_XtermDefaults .
    784 The default is "-fa courier -fs 12 -geometry 80x24" :
    785   font name     : -fa courier
    786   font size     : -fs 12
    787   terminal size : -geometry 80x24
    788 See 'xterm -help' for more options. Xterms are not available under Windows.
    789 
    790 ------------------------------------------------------------------------------
    791 1.8  'help'                                                    *csupport-help*
    792 ------------------------------------------------------------------------------
    793 
    794 The root menu item 'help' shows this plugin help in a help window.  The help
    795 tags must have been generated with
    796   :helptags ~/.vim/doc
    797 
    798 ==============================================================================
    799 2.  USAGE WITHOUT GUI  (Vim)                              *csupport-usage-vim*
    800 ==============================================================================
    801 
    802 The frequently used constructs can be inserted with key mappings.  The
    803 mappings are also described in the document c-hot-keys.pdf (reference card,
    804 part of this package).
    805 Hint: Typing speed matters. The combination of a leader ('\') and the
    806 following character(s) will only be recognized for a short time.
    807 The insert mode mappings start with ` (backtick).  
    808 
    809 Legend:  (i) insert mode, (n) normal mode, (v) visual mode
    810 
    811   -- Load / Unload C/C++ Support ----------------------------------------
    812 
    813   \lcs      Load C/C++ Support Menus            (n, GUI only)
    814   \ucs      Unload C/C++ Support Menus          (n, GUI only)
    815 
    816   -- Comments -----------------------------------------------------------
    817 
    818   \cl       end-of-line comment                 (n,v,i)
    819   \cj       adjust end-of-line comment(s)       (n,v,i)
    820   \cs       set end-of-line comment column      (n)
    821   \c*       code -> comment /* */               (n,v)
    822   \c/       code -> comment //                  (n,v)
    823   \cc       code -> comment //                  (n,v)
    824   \co       comment -> code                     (n,v)
    825   \cfr      frame comment                       (n,i)
    826   \cfu      function comment                    (n,i)
    827   \cme      method description                  (n,i)
    828   \ccl      class description                   (n,i)
    829   \cd       date                                (n,i)
    830   \ct       date \& time                        (n,i)
    831 
    832   -- Statements ---------------------------------------------------------
    833 
    834   \sd       do { } while                        (n,v,i)
    835   \sf       for                                 (n,i)
    836   \sfo      for { }                             (n,v,i)
    837   \si       if                                  (n,i)
    838   \sif      if { }                              (n,v,i)
    839   \sie      if else                             (n,v,i)
    840   \sife     if { } else { }                     (n,v,i)
    841   \sw       while                               (n,i)
    842   \swh      while { }                           (n,v,i)
    843   \ss       switch                              (n,v,i)
    844   \sc       case                                (n,i)
    845   \s{       { }                                 (n,v,i)
    846 
    847   -- Preprocessor -------------------------------------------------------
    848 
    849   \p<       #include <>                         (n,i)
    850   \p"       #include ""                         (n,i)
    851   \pd       #define                             (n,i)
    852   \pu       #undef                              (n,i)
    853   \pie      #if  #else #endif                   (n,v,i)
    854   \pid      #ifdef #else #endif                 (n,v,i)
    855   \pin      #ifndef #else #endif                (n,v,i)
    856   \pind     #ifndef #def #endif                 (n,v,i)
    857   \pi0      #if 0 #endif                        (n,v,i)
    858   \pr0      remove #if 0 #endif                 (n) 
    859   -- Idioms -------------------------------------------------------------
    860 
    861   \if       function                            (n,v,i)
    862   \isf      static function                     (n,v,i)
    863   \im       main()                              (n,v,i)
    864   \i0       for( x=0; x<n; x+=1 )               (n,v,i)
    865   \in       for( x=n-1; x>=0; x-=1 )            (n,v,i)
    866   \ie       enum   + typedef                    (n,i)
    867   \is       struct + typedef                    (n,i)
    868   \iu       union  + typedef                    (n,i)
    869   \ip       printf()                            (n,i)
    870   \isc      scanf()                             (n,i)
    871   \ica      p=calloc()                          (n,i)
    872   \ima      p=malloc()                          (n,i)
    873   \isi      sizeof()                            (n,v,i)
    874   \ias      assert()                            (n,v)
    875   \ii       open input file                     (n,i)
    876   \io       open output file                    (n,i)
    877 
    878   -- Snippets -----------------------------------------------------------
    879 
    880   \nr       read code snippet                   (n)
    881   \nw       write code snippet                  (n,v)
    882   \ne       edit code snippet                   (n)
    883   \np       pick up prototype                   (n,v)
    884   \ni       insert prototype(s)                 (n)
    885   \nc       clear  prototype(s)                 (n)
    886   \ns       show   prototype(s)                 (n)
    887 
    888   -- C++ ----------------------------------------------------------------
    889 
    890   \+c       class                               (n,i)
    891   \+cn      class (using new)                   (n,i)
    892   \+ci      class implementation                (n,i)
    893   \+cni     class (using new) implementation    (n,i)
    894   \+mi      method implementation               (n,i)
    895   \+ai      accessor implementation             (n,i)
    896 
    897   \+tc      template class                      (n,i)
    898   \+tcn     template class (using new)          (n,i)
    899   \+tci     template class implementation       (n,i)
    900   \+tcni    template class (using new) impl.    (n,i)
    901   \+tmi     template method implementation      (n,i)
    902   \+tai     template accessor implementation    (n,i)
    903 
    904   \+tf      template function                   (n,i)
    905   \+ec      error class                         (n,i)
    906   \+tr      try ... catch                       (n,v,i)
    907   \+ca      catch                               (n,v,i)
    908   \+c.      catch(...)                          (n,v,i)
    909 
    910   -- Run ----------------------------------------------------------------
    911 
    912   \rc       save and compile                    (n)
    913   \rl       link                                (n)
    914   \rr       run                                 (n)
    915   \ra       set comand line arguments           (n)
    916   \rm       run make                            (n)
    917   \rg       cmd. line arg. for make             (n)
    918   \rp       run splint                          (n)
    919   \ri       cmd. line arg. for splint           (n)
    920   \rk       run CodeCheck (TM)                  (n)
    921   \re       cmd. line arg. for CodeCheck (TM)   (n)
    922   \rd       run indent                          (n,v)
    923   \rh       hardcopy buffer                     (n,v)
    924   \rs       show plugin settings                (n)
    925   \rx       set xterm size                      (n, only Linux/UNIX & GUI)
    926   \ro       change output destination           (n)
    927   \rt       rebuild templates                   (n)
    928 
    929 The hotkeys are defined in the file type plugin c.vim (part of this csupport
    930 plugin package) and described in the document c-hot-keys.pdf
    931 
    932 ==============================================================================
    933 3.  HOTKEYS                                                 *csupport-hotkeys*
    934 ==============================================================================
    935 
    936 The following hotkeys are defined in normal, visual and insert mode: 
    937 
    938        F9   compile and link
    939    Alt-F9   write buffer and compile
    940   Ctrl-F9   run executable
    941  Shift-F9   set command line arguments
    942 
    943  Shift-F2   switch between source files and header files
    944 
    945 Shift-F2 can be used to switch between source files and header files if the
    946 plugin a.vim is present.  To suppress the creation of a new header file when
    947 switching from a source file the file ~/.vimrc should contain a line  
    948 
    949   let g:alternateNoDefaultAlternate = 1
    950 
    951 A header file will only be opened if it already exists.
    952 
    953 The hotkeys are defined in the file type plugin  c.vim .
    954 
    955 All hotkeys from the non-GUI mode also work for gVim (see |csupport-usage-vim|).
    956 
    957 ==============================================================================
    958 4.  CUSTOMIZATION                                            *csupport-custom*
    959 ==============================================================================
    960 
    961 ------------------------------------------------------------------------------
    962 4.1  GLOBAL VARIABLES                              *csupport-custom-glob-vars*
    963 ------------------------------------------------------------------------------
    964 
    965 Several global variables are checked by the script to customize it:
    966 
    967   ----------------------------------------------------------------------------
    968   GLOBAL VARIABLE           DEFAULT VALUE                    TAG (see below)
    969   ----------------------------------------------------------------------------
    970   g:C_GlobalTemplateFile     plugin_dir.'c-support/templates/Templates'
    971   g:C_LocalTemplateFile      $HOME.'/.vim/c-support/templates/Templates'
    972   g:C_TemplateOverwrittenMsg 'yes'
    973 
    974   g:C_CodeSnippets          plugin_dir."/c-support/codesnippets/"
    975   g:C_Dictionary_File       ""
    976   g:C_LoadMenus             "yes"
    977   g:C_MenuHeader            "yes"
    978   g:C_OutputGvim            "vim"
    979   g:C_XtermDefaults         "-fa courier -fs 12 -geometry 80x24"
    980   g:C_Printheader           "%<%f%h%m%<  %=%{strftime('%x %X')}     Page %N"
    981 
    982   Linux/UNIX: 
    983    g:C_ObjExtension         ".o"
    984    g:C_ExeExtension         ""
    985    g:C_CCompiler            "gcc"            
    986    g:C_CplusCompiler        "g++"            
    987   Windows:
    988    g:C_ObjExtension         ".obj"
    989    g:C_ExeExtension         ".exe"
    990    g:C_CCompiler            "gcc.exe"            
    991    g:C_CplusCompiler        "g++.exe"            
    992   g:C_CFlags                "-Wall -g -O0 -c"
    993   g:C_LFlags                "-Wall -g -O0"   
    994   g:C_Libs                  "-lm"            
    995   g:C_LineEndCommColDefault 49
    996   g:C_CExtension            "c"              
    997   g:C_TypeOfH               "cpp"
    998 
    999   g:C_CodeCheckExeName      "check"
   1000   g:C_CodeCheckOptions      "-K13"
   1001 
   1002 The variable plugin_dir will automatically be set to one of the following values:
   1003   $HOME.'/.vim/'        for Linux/Unix
   1004   $VIM.'/vimfiles/'     for Windows
   1005 
   1006   ----------------------------------------------------------------------------
   1007 
   1008 1. group: g:C_GlobalTemplateFile : Sets the master template file (see|csupport-templates|)
   1009           g:C_LocalTemplateFile  : Sets the local template file  (see|csupport-templates|)
   1010           g:C_TemplateOverwrittenMsg : message if template is overwritten
   1011 
   1012 2. group: g:C_CodeSnippets       : The name of the code snippet directory 
   1013                                    (see |csupport-snippets|).
   1014           g:C_Dictionary_File    : The name(s) of the dictionary file(s) used for 
   1015                                    word completion (see also |csupport-dictionary|)
   1016           g:C_Root               : the name of the root menu of this plugin
   1017           g:C_LoadMenus          : Load menus and mappings ("yes", "no") at startup.
   1018           g:C_MenuHeader         : Switch the submenu header on/off.
   1019           g:C_OutputGvim         : when program is running output goes to the vim 
   1020                                    command line ("vim"), to a buffer ("buffer") or to
   1021                                    an xterm ("xterm").
   1022           g:C_XtermDefaults      : the xterm defaults
   1023           g:C_Printheader        : hardcopy: definition of the page header 
   1024 
   1025 3. group: g:C_CExtension             : Extension of C files. Everything else is C++.
   1026           g:C_TypeOfH                : filetype of header files with extension 'h' (c,cpp)
   1027                                        (see |csupport-comm-style|)
   1028           g:C_CCompiler              : The name of the C compiler.
   1029           g:C_CplusCompiler          : The name of the C++ compiler.
   1030           g:C_CFlags                 : Compiler flags used for a compilation.
   1031           g:C_LFlags                 : Compiler flags used for linkage.
   1032           g:C_Libs                   : Libraries to link with.
   1033           g:C_ObjExtension           : C/C+ file extension for objects
   1034                                        (leading point required if not empty)
   1035           g:C_ExeExtension           : C/C+ file extension for executables 
   1036                                        (leading point required if not empty)
   1037           g:C_LineEndCommColDefault  : Default starting column for end-of-line comments.
   1038           g:C_CodeCheckExeName       : The name of the CodeCheck (TM) executable
   1039                                        (the default is 'check')
   1040           g:C_CodeCheckOptions       : Default options for CodeCheck (TM) 
   1041                                        (see |csupport-run-codecheck|).
   1042 
   1043 To override the default add appropriate assignments to ~/.vimrc .
   1044 
   1045 ------------------------------------------------------------------------------
   1046 4.2  THE ROOT MENU                                 *csupport-custom-root-menu*
   1047 ------------------------------------------------------------------------------
   1048 
   1049 The variable g:C_Root, if set (in ~/.vimrc or in ~/.gvimrc), gives the name of
   1050 the single Vim root menu item in which the C/C++ submenus will be put.  The
   1051 default is 
   1052                   '&C\/C\+\+.'
   1053 Note the terminating dot. A single root menu can be used if the screen is
   1054 limited or several plugins are used in parallel.
   1055 
   1056 If set to "", this single root menu item will not appear.  Now all submenus
   1057 are put into the Vim root menu. This is nice for beginners in a lab
   1058 installation or for C-only programmers.
   1059 
   1060 ------------------------------------------------------------------------------
   1061 4.3  SYSTEM-WIDE INSTALLATION                           *csupport-system-wide*
   1062 ------------------------------------------------------------------------------
   1063 
   1064 A system-wide installation (one installation for all users) is done as
   1065 follows.
   1066 
   1067 As *** SUPERUSER *** :
   1068 
   1069 (1) Find the Vim installation directory.
   1070 The Vim ex command ':echo $VIM' gives '/usr/local/share/vim' or something like
   1071 that. Beyond this directory you will find the Vim installation,  e.g. in
   1072 '/usr/local/share/vim/vim71' if Vim version 7.1 has been installed.
   1073 
   1074 (2) Create a new subdirectory 'vimfiles', e.g. '/usr/local/share/vim/vimfiles'.
   1075 
   1076 (3) Install C/C++ Support
   1077 Copy the archive cvim.zip to this new directory and unpack it:
   1078   unzip cvim.zip
   1079 
   1080 (4) Generate the help tags:
   1081   :helptags $VIM/vimfiles/doc
   1082 
   1083 
   1084 As *** USER *** :
   1085 
   1086 Create your private snippet directory:
   1087 
   1088   mkdir --parents  ~/.vim/c-support/codesnippets 
   1089 
   1090 You may want to copy the snippets comming with this plugin (in
   1091 $VIM/vimfiles/c-support/codesnippets) into the new directory or to set a
   1092 link to the global directory.
   1093 
   1094 Create your private template directory:
   1095 
   1096   mkdir --parents  ~/.vim/c-support/template 
   1097 
   1098 Create a private template file 'Templates' in this directory to overwrite some
   1099 macros, e.g.
   1100 
   1101  *|AUTHOR|*    = your name
   1102  *|AUTHORREF|* = ...
   1103  *|EMAIL|*     = ...
   1104  *|COMPANY|*   = ...
   1105  *|COPYRIGHT|* = ...
   1106 
   1107 You can also have local templates which overwrite the global ones. To suppress
   1108 the messages in this case set a global variable in '~/.vimrc' :
   1109 
   1110   let g:C_TemplateOverwrittenMsg= 'no'
   1111 
   1112 The default is 'yes'.
   1113 
   1114 ==============================================================================
   1115 5.  TEMPLATE FILES AND TAGS                               *csupport-templates*
   1116 ==============================================================================
   1117 
   1118 ------------------------------------------------------------------------------
   1119 5.1  TEMPLATE FILES                                 *csupport-templates-files*
   1120 ------------------------------------------------------------------------------
   1121 
   1122 Nearly all menu entries insert code snippets or comments. All these stuff is
   1123 taken from template files and can be changed by the user to meet his
   1124 requirements.
   1125 
   1126 The master template file is '$HOME/.vim/c-support/templates/Templates' for a
   1127 user installation and  '$VIM/vimfiles/c-support/templates/Templates' for a
   1128 system-wide installation (see|csupport-system-wide|).
   1129 
   1130 The master template file starts with a macro section followed by templates for
   1131 single menu items or better by including other template files grouping the
   1132 templates according to the menu structure of this plugin. The master file
   1133 could look like this:
   1134 
   1135   $
   1136   $ =============================================================
   1137   $ ========== USER MACROS ======================================
   1138   $ =============================================================
   1139   $
   1140  *|AUTHOR|*    = Dr. Fritz Mehner 
   1141  *|AUTHORREF|* = mn
   1142  *|EMAIL|*     = mehner@fh-swf.de
   1143  *|COMPANY|*   = FH Südwestfalen, Iserlohn
   1144  *|COPYRIGHT|* = Copyright (c)*|YEAR|,|AUTHOR|*
   1145   $
   1146   $ =============================================================
   1147   $ ========== FILE INCLUDES ====================================
   1148   $ =============================================================
   1149   $
   1150  *|includefile|* = c.comments.template
   1151  *|includefile|* = c.cpp.template
   1152  *|includefile|* = c.idioms.template
   1153  *|includefile|* = c.preprocessor.template
   1154  *|includefile|* = c.statements.template
   1155 
   1156 Lines starting with a dollar sign are comments. The section starting
   1157 with *|AUTHOR|* assigns values to predefined tags
   1158 (see|csupport-templates-macros|) to personalize some templates. Other
   1159 predefined tags with given default values can be used (e.g. *|YEAR|* ).
   1160 
   1161 User defined tags are possible. They have the following syntax:
   1162 
   1163  *|macroname|* = replacement
   1164 
   1165 A macroname starts with a letter (uppercase or lowercase) followed by zero or
   1166 more letters, digits or underscores.
   1167 
   1168 ------------------------------------------------------------------------------
   1169 5.2  MACROS                                        *csupport-templates-macros*
   1170 ------------------------------------------------------------------------------
   1171 
   1172 The following macro names are predefined. The first group is used to
   1173 personalize templates.
   1174 
   1175  ----------------------------------------------------------------------------
   1176  PREDEFINED MACROS  DEFAULT VALUE
   1177  ----------------------------------------------------------------------------
   1178 *|AUTHOR|*          ""
   1179 *|AUTHORREF|*       ""
   1180 *|EMAIL|*           ""
   1181 *|COMPANY|*         ""
   1182 *|PROJECT|*         ""
   1183 *|COPYRIGHTHOLDER|* ""
   1184 *|includefile|*     "" 
   1185                    
   1186 *|BASENAME|*        filename without path and suffix
   1187 *|DATE|*            the preferred date representation for the current locale
   1188                     without the time
   1189 *|FILENAME|*        filename without path
   1190 *|PATH|*            path without filename
   1191 *|SUFFIX|*          filename suffix
   1192 *|TIME|*            the preferred time representation for the current locale
   1193                     without the date and the time zone or name or abbreviation
   1194 *|YEAR|*            the year as a decimal number including the century
   1195 
   1196 *|includefile|* can  be used to include an additional template file. A file
   1197 will be included only once. Commenting and uncommenting include macros is a
   1198 simple way to switch between several sets of templates (see also
   1199 |csupport-run-templates|). Overwriting existing macros and templates is
   1200 possible.
   1201 
   1202  ----------------------------------------------------------------------------
   1203  PREDEFINED TAGS
   1204  ----------------------------------------------------------------------------
   1205  <CURSOR>           The cursor position after insertion of a template
   1206  <SPLIT>            The split point when inserting in visual mode
   1207                     (see|csupport-templates-definition|)
   1208 
   1209 A dependent template file can start with its own macro section. There is no
   1210 need to have all user defined macros in the master file.
   1211 When the first template definition is found (see below) macro definitions are
   1212 no longer recognized.
   1213 
   1214  ----------------------------------------------------------------------------
   1215  USER DEFINED FORMATS FOR DATE AND TIME            *csupport-templates-date*
   1216  ----------------------------------------------------------------------------
   1217 The format for *|DATE|* ,*|TIME|* , and*|YEAR|* can be set by the user. The
   1218 defaults are
   1219     *|DATE|*        '%x'    
   1220     *|TIME|*        '%X'    
   1221     *|YEAR|*        '%Y'        
   1222 See the manual page of the C function strftime() for the format.  The accepted
   1223 format depends on your system, thus this is not portable!  The maximum length
   1224 of the result is 80 characters.
   1225 
   1226 User defined formats can be set using the following global variables in
   1227 ~/.vimrc ,  e.g.
   1228     let g:C_FormatDate            = '%D'
   1229     let g:C_FormatTime            = '%H:%M'
   1230     let g:C_FormatYear            = 'year %Y'
   1231 
   1232 ------------------------------------------------------------------------------
   1233 5.3  TEMPLATES                                      *csupport-templates-names*
   1234 ------------------------------------------------------------------------------
   1235 
   1236 5.3.1  Template names
   1237 
   1238 The template behind a menu entry is identified by a given name. The first part
   1239 of the name identifies the menu, the second part identifies the item. The
   1240 modes are also hard coded (see|csupport-templates-definition|for the use of
   1241 <SPLIT>).
   1242 
   1243   TEMPLATE NAME                                              MODES
   1244  --------------------------------------------------------------------------
   1245 
   1246   comment.class                                              normal
   1247   comment.end-of-line-comment                                normal
   1248   comment.file-description                                   normal
   1249   comment.file-section-cpp-class-defs                        normal
   1250   comment.file-section-cpp-class-implementations-exported    normal
   1251   comment.file-section-cpp-class-implementations-local       normal
   1252   comment.file-section-cpp-data-types                        normal
   1253   comment.file-section-cpp-function-defs-exported            normal
   1254   comment.file-section-cpp-function-defs-local               normal
   1255   comment.file-section-cpp-header-includes                   normal
   1256   comment.file-section-cpp-local-variables                   normal
   1257   comment.file-section-cpp-macros                            normal
   1258   comment.file-section-cpp-prototypes                        normal
   1259   comment.file-section-cpp-typedefs                          normal
   1260   comment.file-section-hpp-exported-class-defs               normal
   1261   comment.file-section-hpp-exported-data-types               normal
   1262   comment.file-section-hpp-exported-function-declarations    normal
   1263   comment.file-section-hpp-exported-typedefs                 normal
   1264   comment.file-section-hpp-exported-variables                normal
   1265   comment.file-section-hpp-header-includes                   normal
   1266   comment.file-section-hpp-macros                            normal
   1267   comment.frame                                              normal
   1268   comment.function                                           normal
   1269   comment.keyword-bug                                        normal
   1270   comment.keyword-compiler                                   normal
   1271   comment.keyword-keyword                                    normal
   1272   comment.keyword-todo                                       normal
   1273   comment.keyword-tricky                                     normal
   1274   comment.keyword-warning                                    normal
   1275   comment.keyword-workaround                                 normal
   1276   comment.method                                             normal
   1277   comment.special-constant-type-is-long                      normal
   1278   comment.special-constant-type-is-unsigned-long             normal
   1279   comment.special-constant-type-is-unsigned                  normal
   1280   comment.special-empty                                      normal
   1281   comment.special-fall-through                               normal
   1282   comment.special-implicit-type-conversion                   normal
   1283   comment.special-no-return                                  normal
   1284   comment.special-not-reached                                normal
   1285   comment.special-remains-to-be-implemented                  normal
   1286 
   1287   cpp.accessor-implementation                                normal
   1288   cpp.catch                                                  normal, visual
   1289   cpp.catch-points                                           normal, visual
   1290   cpp.cin                                                    normal
   1291   cpp.class-definition                                       normal
   1292   cpp.class-implementation                                   normal
   1293   cpp.class-using-new-definition                             normal
   1294   cpp.class-using-new-implementation                         normal
   1295   cpp.cout-operator                                          normal
   1296   cpp.cout-string                                            normal
   1297   cpp.cout-variabe                                           normal
   1298   cpp.error-class                                            normal
   1299   cpp.extern                                                 normal, visual
   1300   cpp.method-implementation                                  normal
   1301   cpp.namespace-block                                        normal, visual
   1302   cpp.namespace                                              normal
   1303   cpp.namespace-std                                          normal
   1304   cpp.open-input-file                                        normal
   1305   cpp.open-output-file                                       normal
   1306   cpp.operator-in                                            normal
   1307   cpp.operator-out                                           normal
   1308   cpp.output-manipulator-boolalpha                           normal
   1309   cpp.output-manipulator-dec                                 normal
   1310   cpp.output-manipulator-endl                                normal
   1311   cpp.output-manipulator-fixed                               normal
   1312   cpp.output-manipulator-flush                               normal
   1313   cpp.output-manipulator-hex                                 normal
   1314   cpp.output-manipulator-internal                            normal
   1315   cpp.output-manipulator-left                                normal
   1316   cpp.output-manipulator-oct                                 normal
   1317   cpp.output-manipulator-right                               normal
   1318   cpp.output-manipulator-scientific                          normal
   1319   cpp.output-manipulator-setbase                             normal
   1320   cpp.output-manipulator-setfill                             normal
   1321   cpp.output-manipulator-setiosflag                          normal
   1322   cpp.output-manipulator-setprecision                        normal
   1323   cpp.output-manipulator-setw                                normal
   1324   cpp.output-manipulator-showbase                            normal
   1325   cpp.output-manipulator-showpoint                           normal
   1326   cpp.output-manipulator-showpos                             normal
   1327   cpp.output-manipulator-uppercase                           normal
   1328   cpp.rtti-const-cast                                        normal
   1329   cpp.rtti-dynamic-cast                                      normal
   1330   cpp.rtti-reinterpret-cast                                  normal
   1331   cpp.rtti-static-cast                                       normal
   1332   cpp.rtti-typeid                                            normal
   1333   cpp.template-accessor-implementation                       normal
   1334   cpp.template-class-definition                              normal
   1335   cpp.template-class-implementation                          normal
   1336   cpp.template-class-using-new-definition                    normal
   1337   cpp.template-class-using-new-implementation                normal
   1338   cpp.template-function                                      normal
   1339   cpp.template-method-implementation                         normal
   1340   cpp.try-catch                                              normal, visual
   1341 
   1342   idioms.assert                                              normal
   1343   idioms.calloc                                              normal
   1344   idioms.enum                                                normal, visual
   1345   idioms.fprintf                                             normal
   1346   idioms.fscanf                                              normal
   1347   idioms.function                                            normal, visual
   1348   idioms.function-static                                     normal, visual
   1349   idioms.main                                                normal, visual
   1350   idioms.malloc                                              normal
   1351   idioms.open-input-file                                     normal
   1352   idioms.open-output-file                                    normal
   1353   idioms.printf                                              normal
   1354   idioms.scanf                                               normal
   1355   idioms.sizeof                                              normal
   1356   idioms.struct                                              normal, visual
   1357   idioms.union                                               normal, visual
   1358 
   1359   preprocessor.define                                        normal
   1360   preprocessor.ifdef-else-endif                              normal, visual
   1361   preprocessor.if-else-endif                                 normal, visual
   1362   preprocessor.ifndef-def-endif                              normal, visual
   1363   preprocessor.ifndef-else-endif                             normal, visual
   1364   preprocessor.include-global                                normal
   1365   preprocessor.include-local                                 normal
   1366   preprocessor.undefine                                      normal
   1367 
   1368   statements.block                                           normal, visual
   1369   statements.case                                            normal
   1370   statements.do-while                                        normal, visual
   1371   statements.for-block                                       normal
   1372   statements.for                                             normal
   1373   statements.if-block-else                                   normal, visual
   1374   statements.if-block                                        normal, visual
   1375   statements.if-else                                         normal, visual
   1376   statements.if                                              normal
   1377   statements.switch                                          normal, visual
   1378   statements.while-block                                     normal, visual
   1379   statements.while                                           normal
   1380 
   1381 
   1382 5.3.2  Template definition                     *csupport-templates-definition*
   1383 
   1384 A template definition starts with a template head line with the following
   1385 syntax:
   1386 
   1387   == templatename == [ position == ]
   1388 
   1389 The templatename is one of the above template identifiers. The position
   1390 attribute is optional. Possible attribute values are:
   1391 
   1392   above     insert the template before the current line
   1393   append    append the template to the current line 
   1394   below     insert the template below the current line
   1395   insert    insert the template at the cursor position
   1396   start     insert the template before the first line of the buffer
   1397 
   1398 An example:
   1399 
   1400   == comment.function ==
   1401   /* 
   1402    * ===  FUNCTION  =======================================================
   1403    *         Name:  <CURSOR>
   1404    *  Description:  
   1405    * ======================================================================
   1406    */
   1407 
   1408 The definition of a template ends at the next head line or at the end of the
   1409 file.
   1410 
   1411 Templates for the visual mode can use <SPLIT>. The text before <SPLIT> will
   1412 than be inserted above the marked area, the text after <SPLIT> will be
   1413 inserted behind the marked area. An example:
   1414 
   1415   == statements.if-block-else ==
   1416   if ( <CURSOR> ) {
   1417   <SPLIT>} else {
   1418   }
   1419 
   1420 If applied to the marked block
   1421 
   1422   xxxxxxxxxxx
   1423   xxxxxxxxxxx
   1424 
   1425 this template yields
   1426 
   1427   if (  ) {
   1428     xxxxxxxxxxx
   1429     xxxxxxxxxxx
   1430   } else {
   1431   }
   1432 
   1433 The templates with a visual mode are shown in the table under
   1434 |csupport-templates-names|.
   1435 
   1436 5.3.3  Template expansion                       *csupport-templates-expansion*
   1437 
   1438 There are additional ways to control the expansion of a template.
   1439 
   1440 USER INPUT
   1441 ----------
   1442 If the usage of a yet undefined user macro starts with a question mark the
   1443 user will be asked for the replacement first, e.g. with the following template
   1444 
   1445   == idioms.function ==
   1446   void<CURSOR>
   1447  *|?FUNCTION_NAME|* (  )
   1448   {
   1449   <SPLIT> return ;
   1450   }   /* -----  end of function*|FUNCTION_NAME|* ----- */
   1451 
   1452 The user can specify the function name which then will be applied twice. If
   1453 the macro was already in use the old value will be suggested as default.
   1454 
   1455 MACRO MANIPULATION
   1456 ------------------
   1457 
   1458 A macro expansion can be controlled by the following attributes
   1459 
   1460   :l    change macro text to lowercase
   1461   :u    change macro text to uppercase
   1462   :c    capitalize macro text
   1463   :L    legalize name
   1464 
   1465 The include guard template is an example for the use of ':L' :
   1466 
   1467   == preprocessor.ifndef-def-endif ==
   1468  #ifndef *|?BASENAME:L|_INC*
   1469  #define *|BASENAME|_INC*
   1470  <CURSOR><SPLIT>
   1471  #endif   // ----- #ifndef*|BASENAME|_INC* -----
   1472 
   1473 The base name of the file shall be used as part of the include guard name.
   1474 The predefined macro*|BASENAME|* is used to ask for this part because this
   1475 macro has already a defined value. That value can accepted or replaced by the
   1476 user. For the filename 'test test++test.h' the legalized base name
   1477 'TEST_TEST_TEST' will be suggested.
   1478 
   1479 Legalization means:
   1480  - replace all whitespaces by underscores
   1481  - replace all non-word characters by underscores
   1482  - replace '+' and '-' by underscore
   1483 
   1484 
   1485 ==============================================================================
   1486 6.  C/C++ DICTIONARY                                     *csupport-dictionary*
   1487 ==============================================================================
   1488 
   1489 The files  
   1490 
   1491  c-c++-keywords.list 
   1492  k+r.list  
   1493  stl_index.list  
   1494 
   1495 are a part of this plugin and can be used (together with your own lists) as
   1496 dictionaries for automatic word completion.  This feature is enabled by
   1497 default. The default word lists are
   1498 
   1499   plugin_dir/c-support/wordlists/c-c++-keywords.list
   1500   plugin_dir/c-support/wordlists/k+r.list
   1501   plugin_dir/c-support/wordlists/stl_index.list
   1502 
   1503 The variable plugin_dir will automatically be set by the plugin to one of the
   1504 following values:
   1505   $HOME.'/.vim/'        for Linux/Unix
   1506   $VIM.'/vimfiles/'     for Windows
   1507 If you want to use an additional list MyC.list put the following lines into
   1508  ~/.vimrc :
   1509 
   1510   let g:C_Dictionary_File = PLUGIN_DIR.'/c-support/wordlists/c-c++-keywords.list,'.
   1511         \                   PLUGIN_DIR.'/c-support/wordlists/k+r.list,'.
   1512         \                   PLUGIN_DIR.'/c-support/wordlists/stl_index.list,'.
   1513         \                   PLUGIN_DIR.'/c-support/wordlists/MyC.list'
   1514   
   1515 When in file ~/.vimrc the name PLUGIN_DIR has to be replaced by $HOME or 
   1516 $VIM (see above). Whitespaces in the pathnames have to be escaped with a
   1517 backslash.
   1518 The right side is a comma separated list of files. Note the point at the end
   1519 of the first line (string concatenation) and the backslash in front of the 
   1520 second line (continuation line). 
   1521 You can use Vim's dictionary feature CTRL-X, CTRL-K (and CTRL-P, CTRL-N).
   1522 
   1523 
   1524 ==============================================================================
   1525 7.  EXTEND taglist.vim FOR make AND qmake                   *csupport-taglist*     
   1526 ==============================================================================
   1527 
   1528 The use of the Vim plugin taglist.vim (Author: Yegappan Lakshmanan) is highly
   1529 recommended. It uses the program ctags which generates tag files for 3 dozen 
   1530 languages (Exuberant Ctags, Darren Hiebert, http://ctags.sourceforge.net).
   1531 With the following extensions the list of targets in a makefile can be shown 
   1532 in the taglist window.
   1533 
   1534 1) Append the file customization.ctags to the file $HOME/.ctags .  
   1535 
   1536 2) Add the following lines (from customization.vimrc) to $HOME/.vimrc :
   1537 
   1538   "
   1539   "-------------------------------------------------------------------
   1540   " taglist.vim : toggle the taglist window
   1541   " taglist.vim : define the title texts for make
   1542   " taglist.vim : define the title texts for qmake
   1543   "-------------------------------------------------------------------
   1544    noremap <silent> <F11>  <Esc><Esc>:Tlist<CR>
   1545   inoremap <silent> <F11>  <Esc><Esc>:Tlist<CR>
   1546   
   1547   let tlist_make_settings  = 'make;m:makros;t:targets'
   1548   let tlist_qmake_settings = 'qmake;t:SystemVariables'
   1549   
   1550   if has("autocmd")
   1551     " ----------  qmake : set file type for *.pro  ----------
   1552     autocmd BufNewFile,BufRead *.pro  set filetype=qmake
   1553   endif " has("autocmd")
   1554 
   1555 3) restart vim/gvim
   1556 
   1557 The two maps will toggle the taglist window (hotkey F11) in all editing modes.
   1558 The two assignments define the headings for the (q)make sections in the
   1559 taglist window.  The autocmd set the file type 'qmake' for the filename
   1560 extension 'pro' (ctags needs this). 
   1561 
   1562 ==============================================================================
   1563 8.  SYNTAX BASED FOLDING                                    *csupport-folding*
   1564 ==============================================================================
   1565 
   1566 Syntax based folding can be enabled by adding the following lines to the file
   1567 '~/.vim/syntax/c.vim':
   1568 
   1569   syn region cBlock start="{" end="}" transparent fold
   1570   set foldmethod=syntax
   1571   " initially all folds open:
   1572   set foldlevel=999
   1573 
   1574 You may have to create this file first. See |folding| for more information.
   1575 
   1576 ==============================================================================
   1577 9.  WINDOWS PARTICULARITIES                                 *csupport-windows*
   1578 ==============================================================================
   1579 
   1580 The plugin should go into the directory structure below the local
   1581 installation directory $HOME/.vim/ for LINUX/UNIX and $VIM/vimfiles/ for
   1582 Windows.
   1583 The values of the two variables can be found from inside Vim:
   1584    :echo $VIM 
   1585 or
   1586    :echo $HOME
   1587 
   1588 Configuration files:
   1589 
   1590   LINUX/UNIX :   $HOME/.vimrc  and  $HOME/.gvimrc 
   1591   Windows    :   $VIM/_vimrc   and  $VIM/_gvimrc
   1592 
   1593 Compiler settings:
   1594 
   1595 It could be necessary to add further settings for your compiler.  To compile
   1596 C++-programs using a Dev-C++ installation (http://www.bloodshed.net) the
   1597 following item in $VIM/_vimrc is needed (depends on the Dev-C++ install
   1598 directory):
   1599 
   1600   let g:C_CFlags  = '-Wall -g -o0 -c -I c:\programs\dev-c++\include\g++'
   1601 
   1602 ==============================================================================
   1603 10.  TROUBLESHOOTING                                *csupport-troubleshooting*
   1604 ==============================================================================
   1605 
   1606 * I do not see any new main menu item.
   1607   - Was the archive extracted into the right directory?
   1608 
   1609 * How can I see what was loaded?
   1610   - Use ':scriptnames' from the Vim command line. 
   1611 
   1612 * No main menu item.
   1613   - Loading of plugin files must be enabled. If not use
   1614       :filetype plugin on
   1615     This is the minimal content of the file '$HOME/.vimrc'. Create one if there
   1616     is none, or better use customization.vimrc.
   1617 
   1618 * Most key mappings do not work.
   1619   - They are defined in a filetype plugin in '$HOME/.vim/ftplugin/'. Use ':filetype'
   1620     to check if filetype plugins are enabled. If not, add the line 
   1621       filetype plugin on
   1622     to the file '~/.vimrc'.
   1623 
   1624 * Some hotkeys do not work.
   1625   - The hotkeys might be in use by your graphical desktop environment.
   1626     Under KDE Ctrl-F9 is the hotkey which let you switch to the 9. desktop.
   1627     The key settings can usually be redefined.
   1628 
   1629 * Splint and/or CodeCheck menu item not visible. 
   1630   - The program is not installed or not found (path not set) or not executable.
   1631 
   1632 ==============================================================================
   1633 11.  RELEASE NOTES                                    *csupport-release-notes*
   1634 ==============================================================================
   1635 See file c-support/doc/ChangeLog .
   1636 
   1637 ==============================================================================
   1638 vim:tw=78:noet:ts=2:ft=help:norl: