Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7057111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:56:49+00:00 2026-05-28T03:56:49+00:00

Why does this exceedingly simple function: function! ParseAllEvents() let i = 1 while i

  • 0

Why does this exceedingly simple function:

function! ParseAllEvents()
    let i = 1
    while i > 0 
        exec 'ParseEvent('.i.')'
        let i -= 1
    endwhile
endfunction

and/or:

function! ParseAllEvents()
    let i = 1
    while i > 0 
        ParseEvent(i)
        let i -= 1
    endwhile
endfunction

Generate this error?

E488: Trailing Characters: ParseEvent(1)

The ParseEvent(i) function works fine when called in the command line

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:56:50+00:00Added an answer on May 28, 2026 at 3:56 am

    So, as we’ve been discussing in the comments, it was a matter of “calling” the
    function by prepending a :call.

    Generally a function will be evaluated anywhere an expression is expected,
    however this does not mean that they are evaluated directly in your script,
    since Vim script is just a chain of ex commands (those which begin with a
    colon). A function is not an ex command.

    Let’s come to the practical side, take a look in what the user manual says in
    chapter 41:

    41.3 Expressions

    Vim has a rich, yet simple way to handle expressions. You can read the
    definition here: |expression-syntax|. Here we will show the most common
    items.

    The numbers, strings and variables mentioned above are expressions by
    themselves. Thus everywhere an expression is expected, you can use a number,
    string or variable. Other basic items in an expression are:

       $NAME        environment variable
       &name        option
       @r           register
    

    The expressions referred here aren’t the ex commands. Most of the time
    expressions are evaluated in the commands arguments. This is a Vim expression:

    i+=1
    

    But you cant use it in Vim script directly, since it’s not an ex command. You
    need something like:

    :let i+=1
    

    Now check the help for :let:

    :let {var-name} = {expr1}                               :let E18
                            Set internal variable {var-name} to the result of the
                            expression {expr1}.  The variable will get the type
                            from the {expr}.  If {var-name} didn't exist yet, it
                            is created.
    

    We’re looking for {expr1}. This means an expression is expected — that’s
    what you need to check before using an ex command.

    Back to the functions, note that the :call command then allows you to call
    a function in an ex context.

    So if the command being used expects an expression argument, go ahead and
    include your functions, and other regular stuff. They will be evaluated,
    variables will have their value “yielded” and so on. The :execute comes
    handy if the command accepts a text argument. For example, if you need to move
    the current line to a line number stored in a variable, you can use the :m
    command. The help:

    :[range]m[ove] {address}                        :m :mo :move E134
                            Move the lines given by [range] to below the line
                            given by {address}.
    

    As you can see, an address is expected directly, not an expression. If you
    have the number in a variable called line and do this:

    :m line
    

    That’s an error, because there is no line numbered line. Then you need
    :exec to evaluate the expression before executing it — that’s what it does,
    takes an expression as argument, evaluated it and executed as an ex command.

    :exec "m " . line
    "     ^^^^^^^^^^^
    "     This expression evaluates to, say, "m 14" which is then executed
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does this pattern: setTimeout(function(){ // do stuff }, 0); Actually return control to the
Does this look like it should work? I'm wanting to generate directions from one
Does this protect against SQL injection attacks? function sanitize($value) { // Stripslashes if (is_array($value))
Why does this work: a = [] a.push(['test']); (function() {alert('poop')})() But this gives the
Does this control have a name? Or is it just a bunch of simple
Does this smell? I have a few properties you can only set once. They
Does this code cause a memory leak: int main(){ int * a = new
Does this seem right, the dataFilePath is on disk and contains the right data,
Why does this javascript return 108 instead of 2008? it gets the day and
What does this mean exactly? I'm doing something like this: File.Copy(@\\foo\bar\baz.txt, @c:\test\baz.txt); MSDN doesn't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.