Thursday, January 18, 2018

Re: Keystroke command

On 2018-01-18 22:41, Gua Chung Lim wrote:
> For example gUw is the keystrokes to change the
> > current word to uppercase. Can I put gUw into the command like...
> >
> > :%s/^foobar/gUw/g
> > to change any foobar at the beginning of the line to FOOBAR?
> > (I know this is a wrong example, I'm trying my hard time to
> > explain. ;-p )
> I found it.
> :g/^foobar/norm! gUw

For this particular one (replacing a pattern with its uppercase
version), you can use

:%s/^foobar/\U&

There's a lot of power in Vim's search-and-replace, so it's worth
reading up at

:help sub-replace-special

and continuing on to read at

:help :s%


-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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: