VIMSUPPORT

vimsupport.txt                 Vim Support                       Jul 23 2016

Vim Support                                         vim-support vimsupport

                             Plug-in version 2.4
                        for Vim version 7.0 and above
                   Wolfgang Mehner <wolfgang-mehner@web.de>
                      Fritz Mehner <mehner.fritz@web.de>

Vim Support implements a Vim-IDE for Vim/gVim. It is written to considerably
speed up writing Vim script code in a consistent style.  This is done by
inserting complete statements, comments, idioms, and code snippets.    There
are many additional hints and options which can improve speed and comfort when
writing Vim scripts.

 1.     Usage with GUI                      |vimsupport-usage-gvim|
 1.1     Menu 'Comments'                    |vimsupport-comments|
 1.1.1    Append aligned comments           |vimsupport-comm-aligned|
 1.1.2    Adjust end-of-line comments       |vimsupport-comm-realign|
 1.1.3    Comment / uncomment               |vimsupport-comm-uncomm|
 1.1.4    Frame comments, file header, ...  |vimsupport-comm-templates|
 1.1.5    Function description (auto)       |vimsupport-comm-auto|
 1.1.6    Keyword comment                   |vimsupport-comm-keywords|
 1.2     Menu 'Statements'                  |vimsupport-statements|
 1.2.1    Normal mode, insert mode          |vimsupport-stat-norm-ins|
 1.2.2    Visual mode                       |vimsupport-stat-visual|
 1.3     Menu 'Idioms'                      |vimsupport-idioms|
 1.4     Menu 'Regex'                       |vimsupport-regex|
 1.5     Menu 'Perl'                        |vimsupport-perl|
 1.6     Menu 'Documentation'               |vimsupport-documentation|
 1.7     Menu 'Snippets'                    |vimsupport-snippets|
 1.7.1    Code Snippets                     |vimsupport-snippets-menu|
 1.7.2    Code Templates                    |vimsupport-templates-menu|
 1.8     Menu 'Run'                         |vimsupport-run|
 1.8.1    Hardcopy                          |vimsupport-hardcopy|
 1.8.2    Settings                          |vimsupport-settings|
 1.9     Menu 'Help'                        |vimsupport-help|
 2.     Usage without GUI                   |vimsupport-usage-vim|
 3.     Customization and configuration     |vimsupport-customization|
 3.1     Files                              |vimsupport-custom-files|
 3.2     Global variables                   |vimsupport-custom-variables|
 3.3     The root menu                      |vimsupport-custom-root|
 3.4     System-wide installation           |vimsupport-system-wide|
 4.      Template files and tags            |vimsupport-templates|
 4.1      Template files                    |vimsupport-templates-files|
 4.2      Macros                            |vimsupport-templates-macros|
 4.2.1   Formats for date and time          |vimsupport-templates-date|
 4.3      Templates                         |vimsupport-templates-names|
 4.3.1    Template definition               |vimsupport-templates-definition|
 4.3.2    The macros <+text+> etc.          |vimsupport-templates-jumptags|
 4.3.3    Commands Ctrl-j and Ctrl-d        |vimsupport-Ctrl-j|
 5.     Windows particularities             |vimsupport-windows|
 6.     Troubleshooting                     |vimsupport-troubleshooting|
 7.     Release Notes                       |vimsupport-release-notes|

        How to add this help file to Vim's help  |add-local-help|



1.  USAGE with GUI  (gVim)                             vimsupport-usage-gvim

If the menus are not visible call them with the entry "Load Vim Support"
in the standard Tools-menu.


1.1  MENU 'Comments'                                     vimsupport-comments

1.1.1 APPEND ALIGNED COMMENTS TO CONSECUTIVE LINES   vimsupport-comm-aligned

In NORMAL MODE the menu entry 'end-of-line comments' will append a comment to
the current line.
In VISUAL MODE, this item will append aligned comments to all marked lines.
Marking the 4 lines
  let x = 33
  let y = 44

  let z = 55
and choosing 'end-of-line comments' will yield
  let x = 33                                      " |
  let y = 44                                      "

  let z = 55                                      "
The cursor position above is marked by '|'. Empty lines will be ignored.

The default starting column is 49 ( = (multiple of 2,4, or 8) + 1 ).  This can
be changed by setting a global variable in the file '.vimrc', e.g. :

  let g:Vim_LineEndCommColDefault    = 45

The starting column can also be set by the menu entry 'Comments->adjust
end-of-line com.' . Just position the cursor in an arbitrary column (normal
mode; column number is shown in the Vim status line) and choose this menu
item.  This setting is buffer related.
If the cursor was at the end of a line you will be asked for a column number
because this position is most likely not the desired starting column.  Your
choice will be confirmed.

1.1.2 ADJUST END-OF-LINE COMMENTS                    vimsupport-comm-realign

After some copy/paste/change actions comments may be misaligned:

 let x = 33                             " this is x
 let y = 44                                      " and y
 let z = 55                                         " and now z

Realignment can be achieved with the menu item 'adjust end-of-line com.' In
normal mode the comment (if any) in the current line will be aligned to the
end-of-line comment column (see above) if possible. In visual mode the
comments in the marked block will be aligned:

 let x = 33                                     " this is x
 let y = 44                                     " and y
 let z = 55                                     " and now z

Another way is to use the hotkey \cj. In normal and insert mode the current
line will be adjusted. To adjust n lines starting with the current one use
n\cj.

1.1.3  COMMENT/UNCOMMENT                              vimsupport-comm-uncomm

The comment sign " can be set or removed at the beginning of the current line
or for a marked block using the menu items 'comment' (or \cc) and 'uncomment'
(or \co). A single line needs not to be marked (normal mode, insert mode).

A marked block

 let x = 33                                     " this is x
 let y = 44                                     " and y
 let z = 55                                     " and now z

will be changed into (and vice versa)

 "let x = 33                                     " this is x
 "let y = 44                                     " and y
 "let z = 55                                     " and now z

1.1.4 FRAME COMMENTS, FILE HEADER, ...             vimsupport-comm-templates

Frame comments, function descriptions and file header comments are read as
templates from the appropriate files (see |vimsupport-templates|).

1.1.5 FUNCTION DESCRIPTION (AUTO)                       vimsupport-comm-auto

The menu item 'function description (auto)' generates a function description
from the function head in the current line. The line

 function! s:fct77 ( a, b, c )
   ...

will be augmented by the following comment

 "===  FUNCTION  =============================================================
 "          NAME:  s:fct77     {{{1
 "   DESCRIPTION:
 "    PARAMETERS:  a - {+DESCRIPTION+}
 "                 b - {+DESCRIPTION+}
 "                 c - {+DESCRIPTION+}
 "       RETURNS:
 "============================================================================
 function! s:fct77 ( a, b, c )
   ...

The template Comments.function will be used.

1.1.6 KEYWORD COMMENT                               vimsupport-comm-keywords

Preliminary end-of-line comments to document (and find again!) places where
work will be resumed shortly, like

 " :BUG:08.02.2012 12:29:: ... your comment

Usually these comments are not meant for the final documentation.


1.2  MENU 'Statements'                                 vimsupport-statements

1.2.1  NORMAL MODE, INSERT MODE                     vimsupport-stat-norm-ins

An empty statement will be inserted and properly indented. The entry 'if, end'
will insert an if-statement:

  if |
    <-IF_PART->
  endif

The statement will be indented.

1.2.2  VISUAL MODE                                    vimsupport-stat-visual

The highlighted area

  xxxxx
  xxxxx

can be surrounded by one of the following statements ( '|'
marks the cursor position after insertion):

  +--------------------------------------------------+
  |  for | in <+LIST+>                               |
  |    xxxxx                                         |
  |    xxxxx                                         |
  |  endfor                                          |
  +--------------------------------------------------+
  |  if |                                            |
  |    xxxxx                                         |
  |    xxxxx                                         |
  |  endif                                           |
  +--------------------------------------------------+
  |  if |                                            |
  |    xxxxx                                         |
  |    xxxxx                                         |
  |  else                                            |
  |    <+ELSE_PART+>                                 |
  |  endif                                           |
  +--------------------------------------------------+
  |  while                                           |
  |    xxxxx                                         |
  |    xxxxx                                         |
  |  endwhile                                        |
  +--------------------------------------------------+
  |  try                                             |
  |    xxxxx                                         |
  |    xxxxx                                         |
  |  catch //                                        |
  |  catch /.*/                                      |
  |    echo "Internal error (" . v:exception . ")"   |
  |    echo " - occurred at " . v:throwpoint         |
  |  finally                                         |
  |  endtry                                          |
  +--------------------------------------------------+

The whole statement will be indented after insertion.


1.3  MENU 'Idioms'                                         vimsupport-idioms

Often used programming idioms other than the basic language statements.


1.4  MENU 'Regex'                                           vimsupport-regex

This menu can be used to compose regular expressions with a few keystrokes.
In normal mode the entries insert the shown constructs after the cursor. Some
of them can enclose a marked text.  The marked text
  xxxxx
will be changed into
  \(xxxxx\|\)
by the menu item 'branch'.


1.5  MENU 'Perl'                                             vimsupport-perl

This submenu supplies support for the Perl interface of Vim.
For more information please see |if_perl|.


1.6  MENU 'Documentation'                           vimsupport-documentation

This submenu supplies support for writing Vim help-files in an easy an
consistent way. Example: insert a chapter header with 'chapter, text'.
You will be asked for number, name, and tag:

  ============================================================================
  3  DOCUMENTATION                                xxxx
  ============================================================================

Now generate a line for the table of content using 'chapter, ToC':
Example:

  3    Documentation                                   |xxxx|

The number, name, and tag is taken from the last chapter header inserted.

For using the maps while editing help-files set the variable
g:Vim_CreateMapsForHelp in ~/.vimrc to 'yes' (default 'no'):

  let g:Vim_CreateMapsForHelp = 'yes'


1.7  MENU 'SNIPPETS'                                     vimsupport-snippets

1.7.1  Code Snippets                                vimsupport-snippets-menu

Code snippets are pieces of code which are kept in separate files in a special
directory. File names are used to identify the snippets.  The default snippet
directory is  '$HOME/.vim/vim-support/codesnippets'.  Snippets are managed
with the 3 entries

   vim -> Snippets -> read  code snippet
   vim -> Snippets -> write code snippet
   vim -> Snippets -> edit  code snippet

from the Statements submenu.

Creating a new snippet:

When nothing is marked, 'write code snippet' will write the whole buffer
to a snippet file, otherwise the marked area will be written to a file.

Insert a snippet:

Select the appropriate file from the snippet directory ('read  code snippet').
The inserted lines will be indented.

Indentation / no indentation

Code snippets are normally indented after insertion. To suppress indentation
add the file extension "ni" or "noindent" to the snippet file name, e.g.

  parameter_handling.vim.noindent

Snippet browser

Under a GUI a file requester will be put up. Without GUI the filename will be
read from the command line. You can change this behavior by setting a global
variable in your $HOME/.vimrc :

 let g:Vim_GuiSnippetBrowser = 'commandline'

The default value is 'gui'.

1.7.2  Code Templates                              vimsupport-templates-menu

Nearly all menu entries insert code snippets or comments. All of these are
contained within template files and can be changed by the user to meet their
requirements (see|vimsupport-templates|on how to use the template system).

The menu items 'edit ... templates' open various template files. The stock
templates are usually located in the "local" template file:
  ~/.vim/perl-support/templates/Templates
The template files named "custom" and "personal" can be used for
customization, which avoids editing the stock templates.
There may be dependent files loaded from the main files. Change whatever file
you want, save it, and click on the menu item 'reread templates' to read in
the file(s) and to rebuild the internal representation of the templates.


1.8  MENU 'Run'                                               vimsupport-run

1.8.1 Hardcopy                                           vimsupport-hardcopy

Generates a PostScript file from the whole buffer or from a marked region.
The hardcopy goes to the current working directory.  If the buffer contains
documentation or other material from non-writable directories the hardcopy
goes to the HOME directory. The output destination will be shown in a message.

The print header contains date and time according the current locale. The
definition used is

  let s:Vim_Printheader = "%<%f%h%m%<  %=%{strftime('%x %X')}     Page %N"

The current locale can be overwritten by changing the language, e.g.

  :language C

or by setting a global variable in the file '.vimrc', e.g. :

  let g:Vim_Printheader = "%<%f%h%m%<  %=%{strftime('%x %X')}     SEITE %N"

See :h printheader and :h strftime()  for more details.

1.8.2 Settings                                           vimsupport-settings

Displays some Vim Support plugin settings.


1.9  MENU 'Help'                                             vimsupport-help

This submenu offers convenient access to various documentations.

The entry 'keyword' looks up Vim help for the word (function name, keyword)
under the cursor. If there is no word under the cursor the functions list
will be displayed.

The entry 'English' opens an online dictionary for the word under the cursor.


The browser for opening the online documentation, or the English dictionary,
can be configured by setting a global variable in your ~/.vimrc (see
|g:Templates_InternetBrowserExec| and |g:Templates_InternetBrowserFlags|):

  let g:Templates_InternetBrowserExec = 'firefox'


2.  USAGE without GUI  (Vim)                            vimsupport-usage-vim

The frequently used constructs can be inserted via key mappings.  The mappings
are also described in the document 'vim-hotkeys.pdf' (reference card, part of
this package).

All mappings are filetype specific: they are only defined for buffers with
filetype 'vim' to minimize conflicts with mappings from other plugins.

Hint: Typing speed matters. The combination of a leader ('\') and the
following character(s) will only be recognized for a short time.

Some mappings can be used with range (of lines). In normal mode
  \cl
appends a end-of-line comment to the current line,  whereas
  4\cl
appends end-of-line comments to the 4 lines starting with the current line.

Legend:  (i) insert mode, (n) normal mode, (v) visual mode
         [n] range

  -- Help ----------------------------------------------

     \he     open an English dictionary for the   (n, i)
             word under the cursor
     \hk     displays help for the function name  (n, i)
             under the cursor (Vim help)
     \hp     displays plugin help                 (n, i)

  -- Comments ------------------------------------------

  [n]\cl     end-of-line comment             (n, i, v)
  [n]\cj     adjust end-of-line comments     (n, i, v)
     \cs     set end-of-line comment column  (n)
  [n]\cc     comment code                    (n, i, v)
  [n]\co     uncomment code                  (n, i, v)
     \ca     function description (auto)     (n, i, v)
     \cfr    frame comment                   (n, i)
     \cfu    function description            (n, i)
     \ch     file header                     (n, i)
     \cd     date                            (n, i)
     \ct     date & time                     (n, i)
     \ck     keyword comments                (n, i)
     \cma    plugin macros                   (n, i)

  -- Statements -----------------------------------------

     \sv     let variable                    (n, i)
     \sl     let list                        (n, i)
     \sd     let dictionary                  (n, i)
     \sf     for                             (n, i, v)
     \sif    if ... endif                    (n, i, v)
     \sie    if ... else ... endif           (n, i, v)
     \sei    elseif                          (n, i)
     \sel    else                            (n, i)
     \sw     while                           (n, i, v)
     \st     try ... catch                   (n, i, v)

  -- Idioms ----------------------------------------------

     \ii     iterators                       (n, i, v )
     \if     function                        (n, i, v )

  -- Regular Expression ----------------------------------

     \xc     capture                         (n, i, v )
     \xbc    branch                          (n, i, v )
     \xbn    branch, no capture              (n, i, v )
     \xw     word                            (n, i )
     \xpc    POSIX character classes         (n, i )
     \xs     switches                        (n, i )

  -- Perl ------------------------------------------------

     \ps     Perl snippet                    (n, i)
     \pd     Vim::DoCommand()                (n, i)
     \pe     Vim::Eval()                     (n, i)
     \pm     Vim::Msg( "" )                  (n, i)
     \pmc    Vim::Msg( "", "Comment" )       (n, i)
     \pme    Vim::Msg( "", "Warning" )       (n, i)
     \pmw    Vim::Msg( "", "ErrorMsg" )      (n, i)

  -- Documentation ---------------------------------------

     \dcc    chapter, contents               (n, i)
     \dcs    section, contents               (n, i)
     \dcu    subsection, contents            (n, i)
     \dtc    chapter, text                   (n, i)
     \dts    section, text                   (n, i)
     \dtu    subsection, text                (n, i)
     \df     function description            (n, i)
     \de     example                         (n, i, v)
     \dl     list item                       (n, i)

  -- Snippets --------------------------------------------

     \nr     read code snippet                (n, i)
     \nw     write code snippet               (n, i, v)
     \ne     edit code snippet                (n, i)

     \ntg    edit global template file        (n, i)
     \ntl    edit local template file         (n, i)
     \ntc    edit custom template file        (n, i)
     \ntp    edit personal template file      (n, i)
     \ntr    reread template file             (n, i)
     \ntw    template setup wizard            (n, i)
     \nts    choose template style            (n, i)

  -- Run -------------------------------------------------

     \rh     hardcopy buffer to FILENAME.ps   (n, i)
     \rs     settings and hot keys            (n, i)

File 'vim-hotkeys.pdf' contains a reference card for these key mappings.
Multiline inserts and code snippets will be indented after insertion.

Changing the default map leader '\'

The map leader can be changed by the user by setting a global variable in the
file .vimrc

 let g:Vim_MapLeader  = ','

The map leader is now a comma. The 'end-of-line comment' command is now
defined as ',cl'. This setting will be used as a so called local leader and
influences only files with filetype 'vim'.


3.0  CUSTOMIZATION                                  vimsupport-customization


3.1  FILES (after installation)                      vimsupport-custom-files

vim-support/README.md              Release notes, installation description.

ftplugin/help.vim                  Filetype plugin to extend Vim help.

plugin/vim-support.vim             The vim plugin for Vim/gVim.

doc/vimsupport.txt                 The help file for the local online help.

vim-support/codesnippets/*         Some code snippets as a starting point.

vim-support/templates/*            Vim template files
                                   (see |vimsupport-comm-templates|).

autoload/mmtemplates/*             The template engine.

The following files and extensions are for convenience only.  vim-support.vim
will work without them.

vim-support/doc/*                   Hotkey reference card (PDF), changelog.

vim-support/rc/customization.vimrc  Additional settings I use in '.vimrc':
                                    incremental search, tabstop, hot keys,
                                    font, use of dictionaries, ...  The file
                                    is commented. Append it to your '.vimrc'
                                    if you like.

vim-support/rc/customization.gvimrc Additional settings I use in '.gvimrc':
                                    hot keys, mouse settings, ...  The file is
                                    commented.  Append it to your '.gvimrc' if
                                    you like.


3.2  GLOBAL VARIABLES                            vimsupport-custom-variables

Several global variables are checked by the plugin to customize it:


Global Variable             Default Value

g:Vim_CreateMapsForHelp     'no'
g:Vim_GlobalTemplateFile    $VIM.'/vimfiles/vim-support/templates/Templates'
g:Vim_LocalTemplateFile     $HOME.'/.vim/vim-support/templates/Templates'
g:Vim_CustomTemplateFile    $HOME.'/.vim/templates/vim.templates'
g:Vim_CodeSnippets          $HOME.'/.vim/vim-support/codesnippets' (Linux/U**X)
                            $VIM.'\vimfiles\vim-support/codesnippets/'(Windows)
g:Vim_LoadMenus             'yes'
g:Vim_CreateMenusDelayed    'no'
g:Vim_RootMenu              '&Vim'
g:Vim_GuiSnippetBrowser     'gui'
g:Vim_LineEndCommColDefault 49
g:Vim_Printheader           '%<%f%h%m%<  %=%{strftime('%x %X')}     Page %N'
                             'vim.exe'     (Windows)
g:Vim_MapLeader             '\'


Global Variable             Description

g:Vim_CreateMapsForHelp     Create maps for modifiable help buffers ("yes", "no").
g:Vim_GlobalTemplateFile    sets the global template file (see|vimsupport-templates|)
g:Vim_LocalTemplateFile     sets the local template file (see|vimsupport-templates|)
g:Vim_CustomTemplateFile    sets the custom template file (see|vimsupport-templates|)
g:Vim_CodeSnippets          set the personal code snippet directory
g:Vim_LoadMenus             Load menus and mappings ("yes", "no") at start up.
g:Vim_CreateMenusDelayed    Load menus only with filetype 'vim'
g:Vim_RootMenu              The name of the root menu entry of this plugin
                             (see |vimsupport-custom-root|).
g:Vim_GuiSnippetBrowser     code snippet browser: 'gui', 'commandline'

g:Vim_LineEndCommColDefault default starting column for line end comments
g:Vim_Printheader           hardcopy header format
g:Vim_MapLeader             the map leader for hotkeys (see|vimsupport-usage-vim|)

To override the defaults add appropriate assignments in '.vimrc', e.g.
 let g:Vim_MapLeader  = ','


3.3  THE ROOT MENU                                    vimsupport-custom-root

The variable g:Vim_RootMenu, if set (in '.vimrc' or in '.gvimrc'), sets the
name of the single gVim root menu item in which the Vim submenus will be
appear.  The default is

                  '&Vim'

If you want to set the plugin root menu into another menu, e.g. 'Plugin',
this is done by the following line in '.vimrc'

  let g:Vim_RootMenu = "&Plugin"


3.4  System-wide installation                         vimsupport-system-wide

A system-wide installation (one installation for all users) is done as
follows.

As ****** SUPERUSER ****** :

(1) Find the Vim installation directory.
The Vim ex command ':echo $VIM' gives '/usr/local/share/vim' or something like
that. Beyond this directory you will find the Vim installation,  e.g. in
'/usr/local/share/vim/vim73' if Vim version 7.3 has been installed.

(2) Create a new subdirectory 'vimfiles', e.g. '/usr/local/share/vim/vimfiles'.

(3) Install Vim Support
Copy the archive 'vim-support.zip' to this new directory and unpack it:
  unzip vim-support.zip

(4) Generate the help tags:
  :helptags $VIM/vimfiles/doc

SPECIAL CASES. Some Linux distributions use non-standard names for Vim
directories. SUSE has a directory '/usr/share/vim/site' to put plugins in.
These directories will not be found automatically.  After installing the
plugin below '/usr/share/vim/site' the use of the templates will be enabled by
the following line in '$HOME/.vimrc':

  let g:Vim_GlobalTemplateFile = '/usr/share/vim/site/vim-support/templates/Templates'


As ****** USER ****** :

Use the template setup wizard:
  Vim -> Snippets -> template setup wizard
to create a personalization file and/or a custom template file.

The personalization file will be read by all plug-ins supporting this feature,
and should contain only information relevant for all template libraries. You
can set some macros in this file with your personal information in order to
obtain personalized comments, e.g. something like this:

 SetMacro( 'AUTHOR',      'Dr. Fritz Mehner' )
 SetMacro( 'AUTHORREF',   'fgm' )
 SetMacro( 'EMAIL',       'mehner.fritz@web.de' )
 SetMacro( 'COPYRIGHT',   'Copyright (c) |YEAR|, |AUTHOR|' )

Use the custom template file for Vim templates which override the global
templates or to add new ones.

The old system (before version 2.4), using a "local" template file,
  ~/.vim/vim-support/templates
is still supported for backwards compatibility.

Create your private snippet directory:
  mkdir --parents  $HOME/.vim/vim-support/codesnippets
You may want to copy the snippets coming with this plugin (in
$VIM/vimfiles/vim-support/codesnippets) into the new directory or to set a
link to the global directory.


4.  TEMPLATE FILES AND TAGS                            vimsupport-templates

Nearly all menu items insert code snippets or comments. All of these are
contained within template files and can be changed by the user to meet their
requirements. The menu shortcuts (e.g. 'c' for the Comments menu) and the
menu item hotkeys (e.g. '\ct' insert date and time) are also defined in the
templates.
The template engine comes as a separate plugin contributed by Wolfgang Mehner.
This section is a short introduction to this template system. Please see
|templatesupport| for more information.

The master template file can be edited itself to adapt the templates/menus to
the users need.  Alternatively, a custom template file can be added (see
g:Vim_CustomTemplateFile), which eliminates the need to edit stock templates.
The personalization (name, email, ..., date and time format) can be done in a
special personalization template file. It will be read by all plug-ins which
support this feature, so it should only contain basic information not
pertaining to a specific programming language. It can be set up using a
wizard, which is run by the map \ntw or the menu entry:
  Vim -> Snippets -> template setup wizard

Further template files can be added using the call:
  call mmtemplates#config#Add ( 'vim', '<PATH>/some.templates', 'example', 'nte' )
The first parameter adds the file to your VimL templates, the second is the
path. The remaining two optional parameters specify the symbolic name for
these templates and the map to edit them. The map is '\nte' in this example,
if the standard mapleader is set.


4.1  TEMPLATE FILES                               vimsupport-templates-files

The master template file starts with various settings followed by templates
for single menu items or better by including other template files grouping the
templates according to the menu structure of this plugin. The master file
usually looks like this:

  § =============================================================
  §  Settings
  § =============================================================

  SetMacro( 'AUTHOR',       'YOUR NAME' )
  SetMacro( 'AUTHORREF',    '' )
  SetMacro( 'EMAIL',        '' )
  SetMacro( 'ORGANIZATION', '' )
  SetMacro( 'COMPANY',      '' )
  SetMacro( 'COPYRIGHT',    'Copyright (c) |YEAR|, |AUTHOR|' )
  SetMacro( 'LICENSE',      'GNU General Public License' )

  SetStyle( 'default' )

  § =============================================================
  §  File Includes and Shortcuts
  § =============================================================

  MenuShortcut( 'Comments',      'c' )
  MenuShortcut( 'Statements',    's' )
  MenuShortcut( 'Idioms',        'i' )
  MenuShortcut( 'Regex',         'x' )
  MenuShortcut( 'Perl',          'p' )
  MenuShortcut( 'Documentation', 'd' )

  IncludeFile( 'comments.templates' )
  IncludeFile( 'statements.templates' )
  IncludeFile( 'idioms.templates' )
  IncludeFile( 'regex.templates' )
  IncludeFile( 'perl.templates' )
  IncludeFile( 'docu.templates' )

Lines starting with a paragraph sign are comments. The section starting with

  SetMacro( 'AUTHOR',       'YOUR NAME' )

assigns values to predefined tags (macros). Arbitrary user-defined macros are
possible. The macro name must follows the rules for a C language identifier:
first character letter or underscore; case matters; digits are allowed
beginning with the second character.
Some of the macros assigned here are placeholders, they will be overwritten by
template files read later on, which contain the user's configuration.

The statement

  IncludeFile( 'comments.templates' )

includes the templates from the file 'comments.templates' (in the same
directory). An absolute path would also be possible. The statement

  MenuShortcut( 'Comments',      'c' )

sets 'c' as the shortcut for the Comments menu.


4.2  MACROS                                      vimsupport-templates-macros

The following macro names are predefined. The first group is used to
personalize templates.

 ----------------------------------------------------------------------------
 PREDEFINED MACROS  DEFAULT VALUE
 ----------------------------------------------------------------------------

|BASENAME|        filename without path and suffix
|DATE|            the preferred date representation for the current locale
                    without the time
|FILENAME|        filename without path
|PATH|            path without filename
|SUFFIX|          filename suffix
|TIME|            the preferred time representation for the current locale
                    without the date and the time zone or name or abbreviation
|YEAR|            the year as a decimal number including the century

 ----------------------------------------------------------------------------
 PREDEFINED TAGS USED IN TEMPLATES
 ----------------------------------------------------------------------------
 <CURSOR>           The cursor position after insertion of a template.
 <+text+>,<-text->  See |vimsupport-templates-jumptags|.
 {+text+},{-text-}
 [+text+],[-text-]

 <SPLIT>            The split point when inserting in visual mode
                    (see|vimsupport-templates|)

A dependent template file can start with its own command section. There is no
need to have all user defined macros in the master file.

4.2.1 User Defined Formats for Date and Time       vimsupport-templates-date

The format for |DATE| ,|TIME| , and|YEAR| can be set by the user. The
defaults are
    |DATE|        '%x'
    |TIME|        '%X'
    |YEAR|        '%Y'
See the manual page of the C function strftime() for the format.  The accepted
format depends on your system, thus this is not portable!  The maximum length
of the result is 80 characters.

User defined formats can be set using the following function calls in the
master template file is '$HOME/.vim/vim-support/templates/Templates',  e.g.

  SetFormat( 'DATE', '%D'      )
  SetFormat( 'TIME', '%H:%M'   )
  SetFormat( 'YEAR', 'year %Y' )


4.3  TEMPLATES                                    vimsupport-templates-names

4.3.1 Template definition                    vimsupport-templates-definition

The template behind a menu entry is identified by a given name. The first part
of the name identifies the menu name, the second part identifies the item.
A template definition starts with a template header with the following syntax:

  == menu_name.template_name == options ==

The options are described here: |template-support-options|.

4.3.2  The jump tags <+text+> etc.             vimsupport-templates-jumptags

There are four jump tag types which can be used as jump targets in templates:

 <+text+>   Can be jumped to by hitting Ctrl-j.
 {+text+}   Same as <+text+>. Used in cases where indentation gives unwanted
            results with the first one.

 <-text->   Same as the two above. Will be removed if the template is used
 {-text-}   in visual mode.

 [+text+]   The "optional" tag. Serves as a jump tag, but can be deleted using
            Ctrl-d.
 [-text-]   Same as above, removed in visual mode.

The text inside the brackets is userdefined and can be empty. The text can be
composed from letters (uppercase and lowercase), digits, and underscores.
After the insertion of an template these jump targets will be highlighted.

4.3.3  Commands Ctrl-j and Ctrl-d                          vimsupport-Ctrl-j

Use the command Ctrl-j to jump to the next target. The target will be removed
and the mode will switched to insertion. Ctrl-j works in normal and in insert
mode.  The template for an if-else-statement can be written as follows:

  == Statements.if, else == map:sie, sc:i ==
  if <CURSOR>
    <SPLIT><-IF_PART->
  else
    <+ELSE_PART+>
  endif

The cursor will be set as shown. When the condition is specified a Ctrl-j let
you jump to the target <-IF PART-> and deletes it.  When the block is written
a Ctrl-j leads you to the else-part.  The target <+ELSE_PART+> disappears and
you can type on.

Use <CTRL-D> to delete optional tags on the same line, for example:
	strpart ( <+src+>, <+start+>, [+len+] )
The optional argument "len" can be written down after jumping to the tag using
<CTRL-J> or deleted together with the comma using <CTRL-D>.


5.  WINDOWS PARTICULARITIES                               vimsupport-windows

For a user installation the plugin should go into the directory structure
below
  $HOME/vimfiles/
for a system installation below
  $VIM/vimfiles/

The values of the two variables can be found from inside Vim:
   :echo $VIM
or
   :echo $HOME

The configuration files for a user are

  $HOME/_vimrc   and  $HOME/_gvimrc

for the system

  $VIM/_vimrc   and  $VIM/_gvimrc


6.  TROUBLESHOOTING                               vimsupport-troubleshooting

* I do not see any new main menu item.
  - Was the archive extracted into the right directory?

* How can I see what was loaded?
  - Use ':scriptnames' from the Vim command line.

* No main menu item.
  - Loading of plugin files must be enabled. If not use
      :filetype plugin on
    This is the minimal content of the file '$HOME/.vimrc'. Create one if
    there is none, or better use customization.vimrc.

* Some hotkeys do not work.
  - The hotkeys might be in use by your graphical desktop environment. The key
    settings can usually be redefined.


7.  Release Notes                                   vimsupport-release-notes

See file 'README.md'.


vim:tw=78:expandtab:ts=2:ft=help:norl:

Generated by vim2html (modified) on So 7. Aug 16:09:57 CEST 2016