Sunday, April 14, 2013

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

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?

--
--
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@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: