Propozycja struktury

Sergiusz Pawlowicz ser w pld-linux.org
Nie, 28 Gru 2003, 19:24:48 CET


--->[Quoting Marek Ciesielski <marekc w klub.chip.pl>:]

> BTW szukam teraz środowiska pracy (czyt. edytora) - bo vim ma niby
> wszystko ale np. denerwuje mnie że nie można zapanować nad tagiem
> <screen> i przy wcięciach robi się kaszana - może ktoś zna sposób na
> zmuszenie VIM żeby podczas formatowania zostawiał <screen> z lewej
> strony (no i tekst między tymi tagami)? 

ja używam następującego zestawu, pomagającego w pracy.


" Dan York .vimrc tweaked for use with DocBook 4.1
" $Id: .vimrc,v 1.4 2001/07/13 10:49:33 dyork Exp $
" Used with vim 5.7
" If you come up with any additional useful mappings, please
" pass them along to 'dyork w Lodestar2.com'

" serek
":au BufReadPost * if line("'\"") | exe "normal '\"" | endif

" maps the F1 key to Esc to disable going into Help. On my
" IBM ThinkPad laptop, the Esc key is above F1 and I keep 
" hitting F1 and (arrggghhh!!) going into help!
imap <F1> <ESC>

" turn on syntax highlighting
set syntax=on
" set text width to 78 characters
set tw=78
" set auto-indenting
set ai

set modeline

" ABBREVIATIONS
" some abbreviations that I was using for DocBook characters.
" These have to be typed separated by whitespace and are replaced
" *after* they are typed. (i.e. typing 'ems' alone will expand it,
" but 'items' will not expand) I started using mappings instead of
" this method.
iab em1 <emphasis>
iab em2 </emphasis>
iab ems <emphasis role="strong">

" MAPPINGS
" Like the .vimrc file shown at http://www.vim.org/ I decided to
" start all my mappings with a comma. Since I do pretty much all
" my work in DocBook, I just started with the letter after the 
" comma for a DB tag, rather than using something like 'd' to 
" indicate it was a DB tag (i.e. ',dp' instead of ',p'). If you 
" want to use other mappings, you may want to change this.
" My mappings are currently primarily for easy of entering DB
" tags. I haven't yet gotten into changing existing text with mappings.

" A side effect of using the comma for mappings is that when you type
" a comma in vim, it will now pause and wait for input. If you just hit
" the spacebar, you should see a regular old comma appear.

" Note: 'imap' = a mapping for 'insert' mode of vim
" All of these commands work ONLY when you are in Insert mode

" <CR> will put a line return in the file. This is purely my style of
" entering certain DocBook tags.  You may wish to remove some.

" After typing the DocBook tag, many of these macros then switch to 
" vim command mode, reposition the cursor to where I want it to be, 
" and then re-inter insert mode. You may wish to change where it ends.

" This one has two p's to type in a paragraph because when it was simply
" ',p' before, it precluded the use of other macros beginning with 'p'
" such as ',pl' for programlisting. The two p's are fast to type.

imap ,pp <para><CR></para><esc>k$a

" header and setup info
imap ,dtx <?xml version="1.0"?><CR><!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"<CR>"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
imap ,dts <!DOCTYPE BOOK PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
imap ,bk <book><CR><bookinfo><CR><title></title><CR></bookinfo><CR><CR></book><esc>kkk$bba
imap ,ar <article><CR><articleinfo><CR><title></title><CR></articleinfo><CR><CR></article><esc>kkk$bba

" character formatting
imap ,em <emphasis></emphasis><esc>bba
imap ,es <emphasis role="strong"></emphasis><esc>bbla

" links
imap ,ul <ulink url=""></ulink><esc>bb3la
imap ,lk <link linkend=""></link><esc>bb3la

" lists
" note that ',l2' was created solely to fit into ,il and ,ol
imap ,li <listitem><CR><para><CR></para><CR></listitem><esc>kk$a
imap ,l2 <listitem><CR><para><CR></para><CR></listitem>
imap ,il <itemizedlist><CR>,l2<CR></itemizedlist><esc>kkk$a
imap ,ol <orderedlist><CR>,l2<CR></orderedlist><esc>kkk$a
imap ,ve <varlistentry><CR><term></term><CR>,l2<CR></varlistentry>
imap ,vl <variablelist><CR><title></title><CR>,ve<CR></variablelist>

" sections
" I put a <para> in here so that onsgmls will treat it as valid DB even with 
" nothing entered into the text.
" Note that I also assign an 'id' to each section so that openjade generates
" files with those ids as names.
imap ,s1 <sect1 id=""><CR><title></title><CR><para><CR></para><CR></sect1><esc>kkk$bba
imap ,s2 <sect2 id=""><CR><title></title><CR><para><CR></para><CR></sect2><esc>kkk$bba
imap ,s3 <sect3 id=""><CR><title></title><CR><para><CR></para><CR></sect3><esc>kkk$bba
imap ,se <section id=""><CR><title></title><CR><para><CR></para><CR></section><esc>kkk$bba
imap ,ch <chapter id=""><CR><title></title><CR><para><CR></para><CR></chapter><esc>kkk$bba

" images
" My mediaobject has two imagedata entries - 1 for EPS and 1 for JPG
imap ,img <imageobject><CR><imagedata fileref="" format=""><CR><esc>$a</imageobject><esc>
imap ,to <textobject><CR><phrase></phrase><CR></textobject>
imap ,mo1 <mediaobject><CR>,img<esc>k$hiEPS<esc>j$a<CR>,img<esc>k$hiJPG<esc>j$a<CR>,to<CR></mediaobject>
imap ,mo <mediaobject><CR>,img<esc>k$hiPNG<esc>j$a<CR>,to<CR></mediaobject>

"tables
imap ,en <entry></entry><esc>bba
imap ,tb <table><CR><title></title><CR><tgroup cols=2><CR><tbody><CR></tbody><CR></tgroup><CR></table><esc>kk
"imap ,ro <row><CR><entry></entry><CR></row><esc>k$bba

" Q and A sets
imap ,qq <question><CR><para></para><CR></question><esc>k$bba
imap ,qa <answer><CR><para></para><CR></answer><esc>k$bba
imap ,qe <qandaentry><CR></qandaentry><esc>O
imap ,qs <qandaset><CR></qandaset><esc>O
imap ,qd <qandadiv><CR><title></title><CR></qandadiv><esc>k$bba

" other objects
imap ,ti <title></title><esc>bba
imap ,fn <filename></filename><esc>bba
imap ,fo <footnote><para></para></footnote>
imap ,pl <programlisting><CR></programlisting><esc>O
imap ,sb <sidebar><CR><title></title><CR><para></para><CR></sidebar>
imap ,sc <screen><CR></screen><esc>O
imap ,no <note><CR><para></para><CR></note>
imap ,w <warning><CR><para></para><CR></warning>
imap ,co <!--  --><esc>bhi
imap ,cm <command></command><esc>bba
imap ,bq <blockquote><CR></blockquote><esc>O
imap ,re <emphasis>&lt;enter&gt;</emphasis>
imap ,qt <quote></quote><esc>bba

" macro for character data
imap ,cd <![CDATA[]]><esc>$ba

" macros for DocBook XML Slides using Norman Walsh's slides DocType
imap ,fl <foil><title></title><CR><para><CR></para><CR></foil><esc>kkk$bba

" ----------------------------------------------------
" Advogato entries
" Designed to help speed up entry of Advogato diaries
" ----------------------------------------------------
imap ,ae <p><b></b> -<CR><esc>kwwwwa
imap ,aa <a href=""></a><esc>bbla
imap ,ai <i></i><esc>bba
imap ,ap <person></person><esc>bba

" This will reformat a paragraph to < 80 characters

map g !}fmt -c

" AUTOCOMMANDS
" This one writes a file automatically when it loses focus
"autocmd FocusLost * :w



Więcej informacji o liście dyskusyjnej pld-doc