<<< Date Index >>>     <<< Thread Index >>>

Re: Good .vimrc / for mutt



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday, October 30 at 02:27 PM, quoth Dilip M:
>1. How to delete the lines between '>' and chars. something like 
>this,
>
>> >                     Hi, how are you.
>> >                     Send a report.
>
>Is there any function/macro used my anyone, which will fix this?
>Please share the same.

I use a little function of my own design:

autocmd FileType mail command! Fixq call Fixflowed()

function! Fixflowed()
        " save position
        let l = line(".")
        let c = col(".")
        normal G$
        " whiles are used to avoid nasty error messages
        " add spaces to the end of every line
        while search('[^]> :]\n> \?\%(> \?\)*[^> ]','w') > 0
                s/\([^]> :]\)\n\(> \?\%(> \?\)*[^> ]\)/\1 \r\2/g
        endwhile
        " make sure there's only one space at the end of every line
        while search('^.\{-}\s\{2,}$','w') > 0
                s/^\(.\{-}\)\s\{2,}$/\1 /g
        endwhile
        " now, fix the wockas spacing from the text
        while search('^[> ]*>[^> ]','w') > 0
                s/^\([> ]*>\)\([^> ]\)/\1 \2/
        endwhile
        " now, compress the wockas
        while search('^>>*\s\+>>*\%( [^>]\)*', 'w') > 0
                s/^\(>>*\)\s\+\(>>*\%( [^>]\)*\)/\1\2/
        endwhile
        " restore the original location, such as it is
        execute l . " normal " . c . "|"
endfunction

You could, if you wanted, make that function trigger on BufRead, like 
so:

     autocmd BufRead */tmp/mutt-* call Fixflowed()

~Kyle
- -- 
The rule is, jam tomorrow and jam yesterday---but never jam today.
                                                       -- Lewis Carroll
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!

iD8DBQFHJ2clBkIOoMqOI14RAveiAKDy5jkJOELSlTLUHM2J7gav4SbAmQCgo16n
hcbawGcn69xNg8wSnjIDr5k=
=vmlV
-----END PGP SIGNATURE-----