Friday, July 1, 2011

Re: setline vs call setline

Reply to message «setline vs call setline»,
sent 21:20:49 01 July 2011, Friday
by cyboman:

You cannot ever call a function with
:function()
. Functions are accessible only from something that forces expression context
(and :call command is one of these). Commands are not functions, though
sometimes they have similar names (like `call', `function', `substitute').

Original message:
> 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.

No comments: