sponsor Vim development Vim logo Vim Book Ad

FormatBlock : Format (i.e., gqq) a block of lines above/below the current line

 script karma  Rating 4/3, Downloaded by 877  Comments, bugs, improvements  Vim wiki

created by
Gary Holloway
 
script type
utility
 
description
" Format (i.e., gqq) a block of lines above/below the current line from the
" line matching <beg_pattern> to the line matching <end_pattern>; intervening
" lines of the block should match <in_pattern>, if given.
"

" EXAMPLE SETUP
" Format block (do a 'gq' format) on a C-style statement (i.e., from cursor's
" line to line ending with ';'):
"
" map gqs :call FormatBlock('', ';$', '')<CR>

Primarily used as a "helper" function to FormatComment ( vimscript #886 )
 
install details
I put this in my autoload directory (~/vim/autoload), so the function is automagically loaded as needed via an autocommand:

autocmd FuncUndefined * exe 'runtime autoload/' . expand('<afile>') . '.vim'
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
FormatBlock.vim 1.3 2004-01-28 6.0 Gary Holloway Initial upload
ip used for rating: 18.209.66.87

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github