Reply to message «Re: Testing for last item in a list»,
sent 10:32:22 15 November 2010, Monday
by Jürgen Krämer:
> I don't think so, Tim. If "is" is used as the comparison operator for
> anything else than a List or a Dictionary it is equivalent to "==" (see
&g
Hi,
Jürgen Krämer schrieb:
>
> Tim Johnson wrote:
>> * ZyX [101112 12:17]:
>>>
>>> for line in lines
>>> execute "normal! i".line
>>> " " May be replaced with
>>> " call setline(line('.'), line)
>>> execute "normal! o"
>>> if line is lines[-1]
>>>
Hi,
Tim Johnson wrote:
> * ZyX [101112 12:17]:
>>
>> for line in lines
>> execute "normal! i".line
>> " " May be replaced with
>> " call setline(line('.'), line)
>> execute "normal! o"
>> if line is lines[-1]
>> " do something
>> en
On 11/12/2010 10:04 PM, ZyX wrote:
Just as an alternative, you can slice lists like you do in Python:
for line in lines[:-2]
...
endfor
Just for clarifying: in python [N:M] slice takes everything
from N'th item to M'th, excluding M'th. In vim M'th item is
included and it does no
Reply to message «Re: Testing for last item in a list»,
sent 02:57:30 13 November 2010, Saturday
by Tim Chase:
> Just as an alternative, you can slice lists like you do in Python:
>
>for line in lines[:-2]
> ...
>endfor
>
> will execute over all but th
* Tony Mechelynck [101112 14:19]:
>
> That can still be simplified:
>
> for line in lines
> exe 'norm! i' . line
> if line isnot lines[-1]
" cool! 'isnot' is new to me
> norm! o
> endif
> endfor
Thanks for the ti
On 11/12/2010 02:50 PM, Tim Johnson wrote:
Using vim 7.2 huge version on ubuntu 10.04
In the following vimscript:
"" begin code
for line in lines
execute "norm! i". line
execute 'norm! o'
endfor
"" end code
How may I check `line' to see if it is the
On 12/11/10 22:42, Tim Johnson wrote:
* ZyX [101112 12:17]:
for line in lines
execute "normal! i".line
" " May be replaced with
" call setline(line('.'), line)
execute "normal! o"
if line is lines[-1]
" do something
endif
* ZyX [101112 12:17]:
>
> for line in lines
> execute "normal! i".line
> " " May be replaced with
> " call setline(line('.'), line)
> execute "normal! o"
> if line is lines[-1]
> " do something
> endif
> endfor
Hi ZyX:
I have bee
Reply to message «Testing for last item in a list»,
sent 23:50:19 12 November 2010, Friday
by Tim Johnson:
> Using vim 7.2 huge version on ubuntu 10.04
> In the following vimscript:
> "" begin code
> for line in lines
> execute "norm! i". li
Using vim 7.2 huge version on ubuntu 10.04
In the following vimscript:
"" begin code
for line in lines
execute "norm! i". line
execute 'norm! o'
endfor
"" end code
How may I check `line' to see if it is the last item in list
`lines'?
:) Probably
:h
11 matches
Mail list logo