Andy Wokula schrieb:
> Robert Chan schrieb:
>> I have logbook entries that have the following structure:

> If it wasn't so d*** unusable, I would recommend 'formatexpr':
>     :h 'fex

Having sent that, I immediately regretted it.
In this case, it isn't that hard:

setlocal formatexpr=FexLogBook()

func! FexLogBook()
    if mode() =~# '[iR]'
        return 1
    endif
    exec v:lnum. "mark ["
    exec (v:lnum + v:count - 1). "mark ]"
    '[,']s/^\[.*]$/&\r/
    setl fex=
    normal! '[gq']
    setl fex=FexLogBook()
    '[,']s/^\[.*]\zs\n$//
    return
endfunc

-- 
Andy

-- 
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

Reply via email to