> This is my use case...
Your use case calls for a replace expression, see :help sub-replace.
Say,
:let ct = 1
:g#// PLT#s//\=submatch(0).ct/|let ct+=1
Now, that doesn't work well if your // PLT occurs more than once on a
line. If so, you need a small function:
:let ct=0
:func! Myct()
:let g:ct += 1
:return g:ct
:endfunc
:%s#// PLT#\=submatch(0).Myct()#g
HTH, regards, 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:
Post a Comment