Anyone whose done a decent amount of writing in Docbook will realise that
they seem to spend most of their time typing tags. Constructs like:
won't be unfamiliar to most:) Sicken by this after 300+ pages of docs I
wrote this bit of vim code to ease the pain. The above nightmare can now
be written like this:
just ":so" this piece of code(it hammers the E mark and t reg though):
imap / /<ESC>:call SGMLCheckInput()<CR>a
let curstr = strpart(getline(line(".")), col(".") - 2, 2)
if match(curstr, "<") == 0
if match(curstr, "/") == 1
if match(a:tag, "/") == -1
let idx = 1
let init = 1
while idx >= 1
if init == 1
let idx = 0
let init = 0
execute "normal ?<.[-a-zA-Z0-9_]*\r\"ty/>\r"
let idx = idx + SGMLCheckTag(@t)
execute "normal mE"
let tag = SGMLSearchBack()
execute "normal `Ea" . tag . ">\e"
You can add it to your vimrc with something like:
autocmd BufRead *.sgml so /usr/share/vim/macros/sgmltag.vim
Bother! said Pooh, as the Tribbles rained down on him.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!