hi Tim:
I tested it , with that line in my vimrc,
a ":MyGrep" command still doesn't pick up the "previous" range I used in
a g:// and still seems search the whole buffer.
maybe I'm not following, but currently I'm just using that "qaq" +
"[range]g//y A" method and then manually paste reg a into next tab.
thanks for your help and time spent on it anyway!
regards
ping
On 04/13/2012 02:29 PM, Tim Chase wrote:
On 04/11/12 10:17, ping wrote:
1) :?pattern1?,/pattern2/g/pattern/
you finally are satisfied with the info you grabbed, then
2) with a new defined cmd like this:
"command! MyGrep execute 'normal! 0"ay0' | execute 'g//y A' | tabnew |
enew | setlocal bt=nofile | put! a | nohls
now with :MyGrep, ideally if there is no *range*, will got last matches
and put in a neighboring tab,
First, that's a hideous command definition (to the degree I went out
to the wiki and changed it to be more legible). If 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
which you can read about at
:help command-range
:help <line1>
3) repeat 1) on this new buffer(maybe with different range and pattern)
I'd say it's highly unlikely that one would *want* the same range in
this secondary buffer, since it's already been winnowed down to the
specified range by this point. However, the same pattern makes sense
and can be done using the blank pattern as above.
-tim
--
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