On 04/09/2010 04:47 PM, Antony Scriven wrote:
For a quick a quick hack, try this.

    :let tokens=[]
    :%s/&&\S\+/\=add(tokens,submatch(0))/g
    :undo
    :new
    :put=tokens

I like it :)

As a quick abuse of add(), the :undo can be obviated by making it

  :let tokens=[]
  :%s/&&\S\+./\=add(tokens,submatch(0))[-1]/g
  :new
  :put=tokens

which returns the last item added, and thus the found-token gets replaced by itself.

-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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to