Loading ...
Sorry, an error occurred while loading the content.

Re: Set the cursor position in vim functions

Expand Messages
  • Francois Desarmenien
    Le Tue, 30 Apr 2002 12:35:39 -0700 ... I was just missing the normal prepended, but still wonder what does it stands for... Many thanks, François
    Message 1 of 10 , May 1, 2002
    • 0 Attachment
      Le Tue, 30 Apr 2002 12:35:39 -0700
      gary@... (Gary Holloway) a ecrit:

      > Try
      >
      > exe 'normal ' . column . '|'

      I was just missing the "normal " prepended, but
      still wonder what does it stands for...

      Many thanks,

      François
    • Brett Pershing Stahlman
      Francois, The reason that ... worked is that when in ex mode (command-line mode), a command consisting of a single number means go to the line indicated by the
      Message 2 of 10 , May 1, 2002
      • 0 Attachment
        Francois,
        The reason that
        :exec lineno
        worked is that when in ex mode (command-line mode), a command consisting of
        a single number means go to the line indicated by the number. All lines in a
        vim script represent commands executed on the command line, so if you want
        to do a normal mode command -
        e.g., N|, to go to column N from within a vim script, you have to tell vim
        that the keystrokes are to be executed in normal mode rather than ex mode.
        The way you do this is to use the normal command.
        e.g., to go to column 10, you would type

        :normal 10|

        Since the arguments to "normal" command are taken literally (i.e., no
        variable substitution takes place), you must build up the normal command as
        a string that can be passed to execute command if the column position is a
        variable.
        e.g.,
        :let str = "normal " . col . '|'
        :execute str

        or, to do it in one line,
        :execute "normal " . col . '|'

        Hope this helps explain it...

        Brett S.

        ----- Original Message -----
        From: Francois Desarmenien <francois@...>
        To: Gary Holloway <gary@...>
        Cc: <vim@...>
        Sent: Wednesday, May 01, 2002 4:22 AM
        Subject: Re: Set the cursor position in vim functions


        Le Tue, 30 Apr 2002 12:35:39 -0700
        gary@... (Gary Holloway) a ecrit:

        > Try
        >
        > exe 'normal ' . column . '|'

        I was just missing the "normal " prepended, but
        still wonder what does it stands for...

        Many thanks,

        François
      • Francois Desarmenien
        Le Wed, 1 May 2002 08:36:07 -0500 ... Yes, it does: now I begin to catch a glimpse of the vim programming philosophy which is quite disconcerting at first
        Message 3 of 10 , May 1, 2002
        • 0 Attachment
          Le Wed, 1 May 2002 08:36:07 -0500
          "Brett Pershing Stahlman" <brett.stahlman@...> a ecrit:

          > Hope this helps explain it...

          Yes, it does: now I begin to catch a glimpse of the vim programming
          philosophy which is quite disconcerting at first sight... as is its
          huge documentation, without any critisism in mind.

          Many thanks for your time and patience, to you and all the others
          from the list, too.

          François
        Your message has been successfully submitted and would be delivered to recipients shortly.