" ############################################################################# " ### Documentation ########################################################### " ############################################################################# " File: text.vim " Version: $Id$ " Summary: Handle textwidth in a reasonable manner, especially with 'par' " Maintainer: Tim Skirvin " License: BSD License " " Run ':SetWidth NUMBER' to set the text width to the appropriate number, " and change other related functions to match. " ############################################################################# " ### Functions ############################################################### " ############################################################################# " SetWidth - set the textwidth to whatever we want to use function! SetWidth(textwidth) let width = a:textwidth let &textwidth = a:textwidth let &formatprg = "par q1g1T8w".a:textwidth endfunction " SetDefaults - set the defaults the first time based on the default values function! SetDefaults() call SetWidth(&tw) endfunction " ############################################################################# " ### main #################################################################### " ############################################################################# " Ways of invoking the above commands, ie ':SW 80' command! -nargs=1 SetWidth call SetWidth() command! -nargs=1 SW call SetWidth() command! -nargs=1 Sw call SetWidth() " Set it so we can reset the width at the given column map #tw :exec SetWidth(=col(".")) " Actually run the appropriate commands exec SetDefaults() " ############################################################################# " ### Version Log ############################################################# " ############################################################################# " # 0.10 Thu Mar 24 14:14:55 CST 2005 tskirvin " ### Initial version.