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

Re: Function behaving unexpectedly. Very confused.

Expand Messages
  • John Little
    Sorry, guys, Google groups and firefox between them discarded my post. Fortunately It s All Text (the firefox plug-in I used to allow me to type my post in
    Message 1 of 4 , Jun 7, 2010
    • 0 Attachment
      Sorry, guys, Google groups and firefox between them discarded my
      post. Fortunately It's All Text (the firefox plug-in I used to allow
      me to type my post in vim) kept a copy, so I'll try again.

      On Jun 7, 2:04 pm, ShayAllen <alexalle...@...> wrote:
      > I'm baffled.

      I changed the substitute in your function to the marks command, and it
      showed bo
      th marks on line 1. Then I ran marks manually after the function
      ends, and it s
      howed them on line 3. Vim is not updating the marks until you press :
      to enter
      the substitute command manually.

      I think this is a consequence of the behaviour that these marks are
      not set unti
      l the visual mode ends. The help in motion.txt should mention this,
      IMO, but it
      's in usr_10.txt:

      The marks remain at their position until another Visual selection
      is made. Thus you can use the "'<" command to jump to position
      where the
      Visual area started.

      So if you remove the substitute from your function, call it and type
      '< immediat
      ely after it returns, the selection is extended to line 1.

      It seems that the shift to command mode when you press : manually
      causes the '<
      and '> marks to be set (usefully I suppose), but this doesn't happen
      in a functi
      on.

      HTH, John

      --
      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
    Your message has been successfully submitted and would be delivered to recipients shortly.