On 2009-03-21, Yue Wu wrote:
> I have a func:
>
> echo printf("%.10s", longline)
>
> But if longline is longer than screen line, then it will be broken down
> into several lines, I have to use q to quit the echo message, that's
> not what I want. So question is, how to get the width of screen line, so
> I can use:
>
> sline = screenline
> echo printf("%." . sline . "s", longline)
>
> to truncate the longline to fit the screen?
The direct answer to your question is to use the 'columns' option,
like so:
echo printf("%." . columns& . "s", longline)
or
echo printf("%.*s", columns&, longline)
I am curious, though, about your comment about having to use q to
quit the echo message. I only ever see "Press ENTER or type command
to continue" after executing your echo.
Regards,
Gary
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---