Friday, April 13, 2012

RE: how to repeat the last :[range]g with the same range?

Tim Chase wrote:
> First, that's a hideous command definition (to the degree I
> went out to the wiki and changed it to be more legible).
> you're going to use normal mode, the canonical way to clear a
> register is to use "qaq" to clear register "a". I prefer the
> explicit nature of setting it in Ex with ":let @a=''".
>
> I'd be tempted to make use of the ability to pass ranges to a
> command with something like
>
> command! -range=% MyGrep let @a='' | execute
> '<line1>,<line2>g//y A' | tabnew | enew | setlocal bt=nofile
> | put! a | nohls

What is 'enew' for?

I changed the command at:
http://vim.wikia.com/wiki/Redirect_g_search_output

from:
command! Filter let @a='' | execute 'g//y A' | split | enew | setlocal bt=nofile | put! a

to:
command! -nargs=? Filter let @a='' | execute 'g/<args>/y A' | new | setlocal bt=nofile | put! a

which included replacing 'split | enew' with just 'new'.

Is there some point I am missing?

I guess the range stuff should be added on the wiki as it's
pretty nice.

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

No comments: