Saturday, July 2, 2011

Re: setline vs call setline

On 01/07/11 19:20, cyboman wrote:
> i'm writing a small script which uses setline. i'm somewhat new to vim
> scripting. whenever setline was called i would get an error saying
> that this is not an editor command. after looking up in the
> documentation for setline, i changed it to call setline and everything
> started working. but i'm confused. when should i use call and when i
> simply just call a function?
>
> any help is appreciated.
>

In addition to all the replies you already got, there is an additional
possibility:

if setline(lnum, text)
echoerr "something went wrong calling setline(" lnum
\ . ", '" . string(text) . "')"
endif

since setline() returns a non-zero value if there was an error.


Best regards,
Tony.
--
Lackland's Laws:
(1) Never be first.
(2) Never be last.
(3) Never volunteer for anything

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment