On 03/12/08 16:35, Mr. Shawn H. Corey wrote:
> Hi,
>
> I have the following map:
>
> :map<C-P> :set textwidth=60<CR>gqap<CR>:set textwidth=0<CR>
>
> Is the a more elegant way to do this?
>
>
It depends what you call "more elegant". Personally I don't like <CR> in
the middle of a mapping. You can use
:map <C-P> :set tw=60 <Bar> exe 'normal gqap' <Bar> set tw=0
or
function ReformatPara(width)
let save_tw = &tw
let &tw = a:width
normal gqap
let &tw = save_tw
endfunction
map <C-P> :call ReformatPara(60)<CR>
Best regards,
Tony.
--
If you stick a stock of liquor in your locker,
It is slick to stick a lock upon your stock.
Or some joker who is slicker,
Will trick you of your liquor,
If you fail to lock your liquor with a lock.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---