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

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

Expand Messages
  • Ben Fritz
    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.
    • Show all 8 messages in this topic