Friday, August 26, 2011

Re: display faster output of external app

Reply to message «Re: display faster output of external app»,
sent 23:40:52 26 August 2011, Friday
by niva:

> In fact I will use your advise with that assumin I have already
> stored getline('.') into lineArray
>
> let line=getline('.')
> call setline('.', line[:stridx(line, ' ')].g:output)
>
> So I transform your expr with that one :
> call setline('.', itemReadLine[0].g:output)
>
> but I know the maxlinelength through my variable s:maxlinelength (=53
> in my file).
>
> It is useful for me to align to the substitution string to the 53'
> column.
> How can I insert 53 blank into your stline method ? or use a mov of
> cursor on antoher way ?
I guess you'd better try my last proposal (that one with matchlist). Original
solution was not aligning to 53 blanks, but if you want:
let [d, before; d2]=matchlist(getline('.'),
\'\v^(\s*\S{,'.s:maxlinelength.'})')
let lines=split(g:output, "\n", 1)
let lwidth=strdisplaywidth(before)
let lines[0]=before.repeat(' ', 54-lwidth).lines[0]
call append('.', lines)
.delete _

Original message:
> > If it is `1' (meaning that you operate on the whole file):
> > %call MyMainFunc()
>
> I operate on the whole file.
>
> In fact I will use your advise with that assumin I have already
> stored getline('.') into lineArray
>
> let line=getline('.')
> call setline('.', line[:stridx(line, ' ')].g:output)
>
> So I transform your expr with that one :
> call setline('.', itemReadLine[0].g:output)
>
> but I know the maxlinelength through my variable s:maxlinelength (=53
> in my file).
>
> It is useful for me to align to the substitution string to the 53'
> column.
> How can I insert 53 blank into your stline method ? or use a mov of
> cursor on antoher way ?
>
> thanks

No comments:

Post a Comment