Monday, December 31, 2012

Re: increment existing numbers by 1

I found this

You have to use normal to execute normal mode commands in command mode:

:g/searchString/ normal ^A

Note that you have to press Ctrl-V Ctrl-A to get the ^A character.

I have

:s@\d\+@\=submatch(0) +1@g

to do what I want.

But can CTRL-A or ^A be used in a :s@search@replace@g command? I
haven't found anything that shows that it can be used that way. I saw
in :help that it can be used in a macro. It seems if it could be used
in a single line search with global replacement at the command line
then it could also be used in a map.

I'm just curious because I found a workable solution when I was trying
to figure out if CTRL-A could be used.

Thanks

--
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