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

Re: Determine the position we left off before moving to the command line

Expand Messages
  • Ben Fritz
    ... I know of no reason whatsoever why line( . ) would not work. I use it all the time. Is your cursor actually on line 1 when you invoke the command? -- --
    Message 1 of 8 , Apr 15, 2013
      On Sunday, April 14, 2013 7:54:14 AM UTC-5, Axel Bender wrote:
      > I'm searching a way to determine the last cursor position before entering the command line to execute a command defined with
      >
      > :command -range=% aaa call <line1>,<line2>func().
      >
      > If I start from a visual block, I'm able to retrieve that position with line(".") or a:firstline in func().
      >
      > However, if I don't use a range, e.g. if I just enter :aaa, I'm unable able to determine that position as line(".")/a:firstline are both 1.
      >
      > I tried to resort to defining the command like so
      >
      > :command -range=% aaa normal ma| <line1>,<line2>call ... | normal `a
      >
      > but to no avail; func() wouldn't get executed...
      >
      > Any tips?

      I know of no reason whatsoever why line('.') would not work. I use it all the time. Is your cursor actually on line 1 when you invoke the command?

      --
      --
      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

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Axel Bender
      Hm, somehow my last (yesterday evening) post got removed... Anyway. I attached a VimL file which shows the problem (at least here: version 7.3.903, Windows 7,
      Message 2 of 8 , Apr 15, 2013
        Hm, somehow my last (yesterday evening) post got removed...

        Anyway. I attached a VimL file which shows the problem (at least here: version 7.3.903, Windows 7, 64 bit). Please try to execute :Hi w/o a visual block, the cursor being in line 2.

        --
        --
        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

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      Your message has been successfully submitted and would be delivered to recipients shortly.