I'd like to know if there's a way to make the 'gq' command
skip formatting lines shorter than 'tw' lines? What I do with
text files is gggqG. However, if the text file happen to
contain a small table or items listed in vertical column, gq
seem to join them, which is not a desired effect (because
they're pre-formatted, and are pretty that way). Is there a
way to achieve this? What 'fo' setting shall I use?

I don't know if there's a 'fo' tweak to do this, but you can do something like

 :g/^.\{60}/norm gqip

where the 60 is the 'tw'.  You can pull it in with

  ^R=&tw

(control-R equals ampersand tee double-you) which you map with something like

  :nnoremap <f4> :g/^.<bslash>{<c-r>=&tw<cr>}/norm gqip<cr>

or as an exec

  :nnoremap <f4> :exec 'g/^.<bslash>{'.&tw.'}/norm gqip'<cr>


The variants perform "gqip" only on lines that are at least 'tw' characters long. This assumes that your "protected" preformatted lines have empty lines above/below them so they don't get caught up in the "gqip"

Hope this helps,

-tim



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

Reply via email to