Hi Wu,!
On Fr, 06 Nov 2009, Wu, Yue wrote:
>
> On Thu, Nov 05, 2009 at 10:09:47AM -0500, Chris Suter wrote:
> > First, open an empty buffer window with <C-w>n -- this should open a
> > new window above the window with your file, assuming you only had
> > one window open to start.
> >
> > Now, type <C-w>j to return down to the bottom window and do
> > :%g/@\S\+/normal yaW^WkGo^[p^Wj
> >
>
> Thanks, it does the trick, I'm sorry I misled you with the concept of
> array and list in vim. Still some issues exist:
>
> 1) It needs external tools.
No it doesn't
>
> 2) It needs some extra steps, e.g., open a new buffer.
Well, you can do it in the actual buffer. The question is, if you want
that.
>
> 3) It's really dirty :)
No.
>
> I needs some way like this:
>
> normal gg0 " Go to the start of the file
> for search('\...@\s\+') " Searching until reaches the end of file
> let t = getCurrentTag " Assign the current tag to t
> if index(lst, t) == -1 " If t isn't in the list
> add(lst, t) " Add it into lst
> endif
> endfor
fu! <SID>GetCat()
let tlist=[]
let rlist=[]
:g/@\S\+/call add(tlist, getline('.'))
for line in tlist
for val in filter(split(line), 'v:val =~ "@\\S\\+"')
if index(rlist, val) == -1
call add(rlist, val)
endif
endfor
endfor
return rlist
endfu
com! GetCat for arg in <SID>GetCat() | echo arg | endfor
regards,
Christian
--
• In short: just say NO TO DRUGS, and maybe you won't end up like the Hurd
people.
Torvalds, Linus (2001-10-04).
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---