I tinkered around a bit more and came up with this code for making Ctrl+J
(justify paragraph) work, even with quoted text.

It assumes that ^[> ]*$ is the paragraph separator, meaning that any line
which is blank or only contains '>' and ' ' separates a paragraph. Here is
the full code for making Ctrl+J work:

[pmak@lina pmak]$ cat .muttvimrc
function! PrevPara()
  if !search("^[> ]*$", 'bW')
    1
  endif
endfunction

function! NextPara()
  if !search("^[> ]*$", 'W')
    $
  endif
endfunction

set formatoptions=tcqv
set comments=nb:>
set tw=75
set cpo-=<
map { :call PrevPara()<ENTER>
map } :call NextPara()<ENTER>
map <C-J> {gq}j
[pmak@lina pmak]$ egrep editor .muttrc
set editor="vim -u ~/.muttvimrc +/^$"

I'll keep refining this as I use it more and find any quirks. (If anyone
here actually uses my code and has comments please let me know. :)

BTW, regarding those other suggestions involving binding "fmt" or "par"
to a key, isn't it slow to fork a process every time you press the
rejustify key, or is that overhead negligible?

Reply via email to