%FEDORA-ENTITIES-EN; ]> VIM and DocBook VIM 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 vimtutor or by typing :help tutor from inside VIM.
Setting Up Your <filename>.vimrc</filename> File VIM configuration file Below is a short sample .vimrc file that turns on some VIM features useful for editing SGML or XML content such as DocBook: " 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 Some of these features require the vim-enhanced package to be installed. If you are using or the vim-minimal package, or if you are using an older version of VIM, you may not have the $VIMRUNTIME/macros/matchit.vim file. You can still download matchit.zip from Vim.org and load it separately.
Keymapping with VIM 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 (\), but it can be redefined with a command like let mapleader = ",". There are two ways to use the following example; you can put it directly in your .vimrc, or you can save it in a separate file and load it with a source command in your .vimrc. e />:nohlsearcha " common tags that start a new text block imappa O imapsn
jo
O imappl O0i imapcp O0i " common tags that are placed inline " use F>a imapen F>a imapfi F>a imaplt F>a imapre F>a imapui F>a imapul F>a imapsi F>a imapus F>a imapsy F>a imapcm F>a " entities imap > > imap < <]]>
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 .
Additional VIM Resources Additional information about VIM may be found from: Example sgml-vimrc from the Beginner's guide to Vi Improved (VIM) The VIM Quick Reference Card Vim as XML Editor The VIM REFERENCE MANUAL, which comes with the vim-common package — /usr/share/vim/<version>/doc/intro.txt or type :help intro from within VIM