> Here is my command line, it finds the text "XXXX" and replaces > that text with an incremented number (variable i) up to the > max replacement value of 3999. > :let i=1120|%g/XXXX/s/\zsXXXX\ze/\=i/|let i=i+1|if (i > 3999)|break| > endif > > Everything works great except for the "break" statement. When > the "break" is hit it generates an error since break is only > intended for use with a while statement. I've tried putting > the "<Esc>" text in place of the break statement, I've tried > inserting a ctrl-c in line... and I can't make any of them > work.
I think with a little rejiggering, you can move the "if" to the front: :let i=1120 :g/XXXX/if i < 4000 | s/\zsXXXX\ze/\=i/ | let i=i+1 | endif You might have to adjust for fence-posting errors I may have introduced. The :g will still visit each line, but if the threshold is passed, no action is taken on those lines. -tim --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
