drcstubs.txt  DrChip's C Stubs                   Apr 03, 2013

Author:  Charles E. Campbell  <NdrOchip@ScampbellPfamily.AbizM>
      (remove NOSPAM from Campbell's email first)
Copyright: (c) 2004-2013 by Charles E. Campbell     drcstubs-copyright
           The VIM LICENSE applies to drcstubs.vim and drcstubs.txt
           (see copyright) except use "drcstubs" instead of "Vim"
       No warranty, express or implied.  Use At-Your-Own-Risk.

==============================================================================
1. Contents              drcstubs drcstubs-contents

   1. Contents.............................: drcstubs-contents
   2. Usage................................: drcstubs-usage
      C Language Support...................: drcstubs-c
      LaTeX Language Support...............: drcstubs-tex
      Vim Language Support.................: drcstubs-vim
   3. Installation.........................: drcstubs-install
   4. History..............................: drcstubs-history


==============================================================================
2. Usage                   drcstubs-usage

   All of the DrCStubs ftplugin scripts provide maps which work during insert
   mode.  One may use either the shorthand or longhand maps to invoke the
   corresponding imap.  They are invoked whenever a string is followed by
   a backquote.

   One major advantage of these imaps is that they, in turn, take advantage of
   the user's cindent settings and/or indentation scripts.  Thus the result
   should be as if the user had typed them him/herself.

   These imaps will not operate if "set paste:" is on.

   In the maps below:

    An "X" is where the cursor will end up after the map is invoked.
    An "Y" is where the cursor will end up after an <esc> is pressed.
    An "Z" is where the cursor will end up after an <esc> is pressed twice.
    A  "|" means a newline.

   Another form of help is available by typing

    :Drcstubs


   ------------------
   C LANGUAGE SUPPORT                          drcstubs-c
   ------------------

       Shorthand    Longhand     Expands
       Map          Map          To
       ---------    --------     -------
     i`           if`          if(X) {Y}
       e`           els[e]`      else {X}
       ei`          eli[f]`      else if(X) {Y}
       er`                       if(xmerror)(*xmerror)(XTDIO_WARNING,"(X) Y\n");
       f`           for\=`       for(X;;) {Y}
       w`           wh[ile]`     while(X) {Y}
       s`           sw[itch]`    switch(X) {Y}
       c`           ca[se]`      case X: Y break;
       d`           defa[ult]`   default: Y break;
       `            do`          do {X} while(Y);
       E`           Ed[bg]`      Edbg((\"func(X)\"Y));
       R`           Rd[bg]`      Rdbg((\"funcX\"Y));
       D`           Dp[rintf]`   Dprintf((1,\"X\"Y));
                    in[clude]`   #include X
                    de[fine]`    #define X
                    #`           #ifdef X ... #endif

   -------------
   LATEX SUPPORT             drcstubs-tex drcstubs-latex
   -------------

         Environments And Abbreviations
       Shorthand    Longhand     Expands
       Map          Map          To
     ---------    --------     -------
       align`                    \begin{align}X\end{align}
       arr`         array`       \left[\begin{array}{ccc}X\end{array}\right]
       ctr`         center`      \begin{center}X\end{center}
       desc`        description` \begin{description}\item[X]\end{sdescription}
       enum`        enumerate`   \begin{enumerate}|\item X|\end{enumerate}
       eps`         epsf`        \begin{figure}[H]\centering\framebox{\epsfbox{X.eps}}\end{figure}
       eqn`         equation`    \begin{equation}X\end{equation}
       eqn*`        equation*`   \begin{equation*}X\end{equation*}
       eqna`        eqnarray`    \begin{eqnarray}|X&=& Y \\|\end{eqnarray}
       eqna*`       eqnarray*`   \begin{eqnarray*}|X&=& Y \\|\end{eqnarray*}
       fig`         figure`      \begin{figure}[H]\centering \framebox{X} \caption{CAPTION HERE} \end{figure}
       flalign`     fla`         \begin{flalign}X\end{flalign}
       flalign*`    fla*`        \begin{flalign*}X\end{flalign*}
       frac`                     \frac{X}{Y}
       gat`         gather`      \begin{gather}X\end{gather}
       i`                        \item X
       i`                        \item[X] Y        (if vim v7, and in a description block)
       item`        itemize`     \begin{itemize}|\item X|\end{itemize}
       mat`         matrix`      \left[\begin{array}{cc} X &   & \\|&   & \end{array}\right]
       mini`        minipage`    \begin{minipage}[H]{4in}X\end{minipage}
       multc`       multicol`    \multicolumn{1}{X}{MultiColumn}
       multl`       multline`    \begin{multline}X\end{multline}
       split`                    \begin{equation}\begin{split}X\end{split}\end{equation}
       tab`         tabular`     (too long for here)
       ptab`        ptabular`    \begin{center}\begin{tabular}{X}\end{tabular}\end{center}
       v`                        \verb`X`
       verb`        verbatim`    \begin{verbatim}X\end{verbatim}

          Script Style Support
       Shorthand    Longhand     Expands
       Map          Map          To
     ---------    --------     -------
       bf`                       \textbf{}
       it`                       \textit{}
       rm`                       \textrm{}
       sc`                       \textsc{}
       sf`                       \textsf{}
       sl`                       \textsl{}
       tt`                       \texttt{}
       mtt`                      \mathtt{}
       mrm`                      \mathrm{}
       mbf`                      \mathbf{}
       msf`                      \mathsf{}
       mtt`                      \mathtt{}
       mit`                      \mathit{}
       mcal`                     \mathcal{}

                Greek Letters:
       Shorthand    Expands       Shorthand    Expands
       Map          To            Map          To
     ---------    -------       ---------    -------
       a`           \alpha        v             \nu
       b`           \beta         f             \xi
       g`           \gamma        p             \pi
       d`           \delta        vp            \varpi
       e`           \epsilon      r             \rho
       ve`          \varepsilon   vr            \varrho
       z`           \zeta         s             \sigma
       n`           \eta          v             \varsigma
       t`           \theta        t             \tau
       vt`          \vartheta     u             \upsilon
       io`          \iota         h             \phi
       k`           \kappa        vh            \varphi
       l`           \lambda       x             \chi
       m`           \mu           q             \psi
       w`           \omega


   ----------
   SH SUPPORT                                   drcstubs-sh
   ----------

       Shorthand    Longhand     Expands
       Map          Map          To
     ---------    --------     -------
       ca[se]`      c`           case X in Y esac
       fo[r]`       f`           for X in Y ; do Z done
       if`          i`           if [[X]]; thenYfi
       eli[f]`      ei`          elif [[X]]; then Y
       els[e]`      e`           else X
       fu[nction]`               function X { Y }
       wh[ile]`     w`           while [[ X ]]; do Y done


   -----------
   VIM SUPPORT                                 drcstubs-vim
   -----------

       Shorthand    Longhand     Expands
       Map          Map          To
     ---------    --------     -------
       i            if           if X endif
       e            els[e]       else X
       ei           eli[f]       elseif X
                    fu[nction]   fun! X ( Y ) endfun
       w            wh[ile]      while X endwhile
       F            Df[unc]      call Dfunc("func(X)")Y
       R            Dr[et]       call Dret("return func X")
       D            De[echo]     call Decho("X")Y

==============================================================================
3. Installation                 drcstubs-install

    a) place drcstubs.tar.gz in your
       Unix: $HOME/.vim
       Windows: ..wherever..\vimfiles
       directory

    b) gunzip drcstubs.tar.gz

    c) tar -oxvf drcstubs.tar

    d) Unix:
       vim
       :helptags ~/.vim/doc
       Windows:
       vim
       :helptags ..wherever../vimfiles/doc

    e) Have a line in your <.vimrc> file such as:
       filetype plugin indent on

    The next time you bring up vim with one of the supported filetypes
    (C, C++, LaTeX, Vim, sh-ksh-bash) the Drcstubs maps will be available
    for use.  They work best if you've set up cindent (see 'cinoptions');
    the one I use follows, but may well not be the style to which you are
    accustomed:

    set cino=>s,e0,n0,f0,{0,}4,^-1s,:0,=s,g0,h1s,p2,t0,+2,(2,)20,*30

    You'll also want automatic indentation.  Vim comes with several such
    scripts; the ones I've customized are available at

    http://vim.sourceforge.net/scripts/script.php?script_id=1270

==============================================================================
4. History               drcstubs-history

    4   Sep 12, 2011    : added some *-versions (eqn*, eqna*, fla*, etc)
    3   Jun 29, 2009    : put silent! on iunmenu calls to prevent unwanted
                     error messages when inappropriately invoked.

vim: ts=4