summaryrefslogtreecommitdiffstats
path: root/en_US/vim.xml
diff options
context:
space:
mode:
Diffstat (limited to 'en_US/vim.xml')
-rw-r--r--en_US/vim.xml156
1 files changed, 156 insertions, 0 deletions
diff --git a/en_US/vim.xml b/en_US/vim.xml
new file mode 100644
index 0000000..eaace93
--- /dev/null
+++ b/en_US/vim.xml
@@ -0,0 +1,156 @@
+<!-- $Id: vim.xml,v 1.1 2007/02/03 22:21:58 kwade Exp $ -->
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
+ "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
+
+<!-- *************** Bring in Fedora entities *************** -->
+<!ENTITY % FEDORA-ENTITIES-EN SYSTEM "fdp-entities.ent">
+%FEDORA-ENTITIES-EN;
+
+]>
+
+
+ <chapter id="ch-vim">
+ <title>VIM and DocBook</title>
+
+ <indexterm>
+ <primary>VIM</primary>
+ </indexterm>
+
+ <para>
+ VIM has many features to help you write XML content such as DocBook,
+ including syntax highlighting and customizable key bindings.
+ Additionally, one can easily use external programs from VIM for features
+ such as spell-checking.
+ This chapter assumes you already know generally how to use VIM; if you
+ want to learn how, try the <command>vimtutor</command> or by typing
+ <userinput>:help tutor</userinput> from inside VIM.
+ </para>
+
+ <sect1 id="s1-vimrc-file">
+ <title>Setting Up Your <filename>.vimrc</filename> File</title>
+
+ <indexterm>
+ <primary>VIM</primary>
+ <secondary>configuration file</secondary>
+ </indexterm>
+
+ <para>
+ Below is a short sample <filename>.vimrc</filename> file that turns on
+ some VIM features useful for editing SGML or XML content such as
+ DocBook:
+<screen>
+<computeroutput>" Turn off vi compatibility settings like limited undo
+set nocompatible
+" Syntax highlighting based on file extension
+syntax on
+" Automatically insert newlines after 80 characters
+set textwidth=80
+" Automatically indent
+set autoindent
+" Match SGML tags with %
+source $VIMRUNTIME/macros/matchit.vim</computeroutput>
+</screen>
+ </para>
+ <note>
+ <para>
+ Some of these features require the <filename>vim-enhanced</filename>
+ package to be installed. If you are using or the
+ <filename>vim-minimal</filename> package, or if you are using an older
+ version of VIM, you may not have the
+ <filename>$VIMRUNTIME/macros/matchit.vim</filename> file. You can still
+ download <ulink
+ url="http://vim.org/scripts/script.php?script_id=39">matchit.zip from
+ Vim.org</ulink> and load it separately.
+ </para>
+ </note>
+ </sect1>
+
+ <sect1 id="s1-vim-keymapping">
+ <title>Keymapping with VIM</title>
+
+ <para>
+ VIM can speed up your DocBook creation by mapping frequently typed tags
+ (or any words or phrases) onto short key combinations. By default, the
+ keymap leader is the backslash (<literal>\</literal>), but it can be
+ redefined with a command like <userinput>let mapleader =
+ ","</userinput>. There are two ways to use the following example;
+ you can put it directly in your <filename>.vimrc</filename>, or you
+ can save it in a separate file and load it with a
+ <userinput>source</userinput> command in your
+ <filename>.vimrc</filename>.
+<screen>
+<![CDATA[let mapleader = ","
+
+" skip ahead to after next tag without leaving insert mode
+imap <leader>e <esc>/><cr>:nohlsearch<cr>a
+
+" common tags that start a new text block
+imap<leader>pa <para><cr></para><esc>O
+imap<leader>s1 <sect1 id=""><cr><para><esc>jo</sect1><esc>O
+imap<leader>pl <programlisting><cr></programlisting><esc>O<esc>0i
+imap<leader>cp <computeroutput></computeroutput><esc>O<esc>0i
+
+" common tags that are placed inline
+" use <esc>F>a
+imap<leader>en <envar></envar><esc>F>a
+imap<leader>fi <filename></filename><esc>F>a
+imap<leader>lt <literal></literal><esc>F>a
+imap<leader>re <replaceable></replaceable><esc>F>a
+imap<leader>ui <userinput></userinput><esc>F>a
+imap<leader>ul <ulink url=""></ulink><esc>F>a
+imap<leader>si <systemitem></systemitem><esc>F>a
+imap<leader>us <systemitem class="username"></systemitem><esc>F>a
+imap<leader>sy <systemitem class="systemname"></systemitem><esc>F>a
+imap<leader>cm <command></command><esc>F>a
+" entities
+imap <leader>> &gt;
+imap <leader>< &lt;]]>
+</screen>
+ </para>
+ <para>
+ Unfortunately, there is not currently a complete macro set for all
+ DocBook commands, so you will need to define them yourself or customize
+ the definitions in the examples from <xref
+ linkend="s1-vim-additional-resources"></xref>.
+ </para>
+ </sect1>
+
+ <sect1 id="s1-vim-additional-resources">
+ <title>Additional VIM Resources</title>
+
+ <para>
+ Additional information about VIM may be found from:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para><ulink url=
+ "http://newbiedoc.sourceforge.net/text_editing/vim.html#JESSE-SGMLRC">
+ Example sgml-vimrc</ulink> from the <citetitle>Beginner's guide to
+ Vi Improved (VIM)</citetitle>
+ </para>
+ </listitem>
+ <listitem>
+ <para>The <ulink url="http://tnerual.eriogerg.free.fr/vim.html">VIM
+ Quick Reference Card</ulink>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <ulink url="http://www.pinkjuice.com/howto/vimxml/">Vim as XML
+ Editor</ulink>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ The <citetitle>VIM REFERENCE MANUAL</citetitle>, which comes with
+ the <filename>vim-common</filename> package &mdash;
+ <filename>/usr/share/vim/<replaceable>&lt;version&gt;</replaceable>/doc/intro.txt</filename>
+ or type <userinput>:help intro</userinput> from within VIM
+ </para>
+ </listitem>
+
+ </itemizedlist>
+
+ </sect1>
+ </chapter>