On Sat, 21 Mar 2009 07:29:45 +0800, Gary Johnson wrote:

>
> 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)

Typo? I think it should be &columns. Thanks for the tip :)

>
> 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.
>

Yep, you're right, sorry I have misled you...

-- 
Regards,
Van.

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

Reply via email to