Tuesday, December 1, 2009

Re: Custom Paragraph Formatting with gq

On 1 дек, 17:54, Andy Wokula <anw...@yahoo.de> wrote:
> 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

Wow!

Thanks, Andy!

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

No comments: