Monday, April 15, 2013

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

On Monday, April 15, 2013 12:54:14 AM UTC+12, Axel Bender wrote:

> :command -range=% aaa call <line1>,<line2>func().

That doesn't look right; don't you mean

:command! -range=% Aaa <line1>,<line2>call Func()

If you "start from visual block", when you type the : vim puts

:'<,'>

on the "command-line", and then you type the command name

:'<,'>Aaa

if Func is defined with the range attribute, line(".") and a:firstline will be set to that of '<. If you remove the "'<,'>", you've just specified the whole file, so line(".") and a:firstline will be 1.

You can still get at '< and '> in your function, they will be line("'<") and line("'>"), though that will give the last visual mode used, even if there's no visual mode when the command is invoked.

HTH, John Little

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