DSL Tips and Tricks :: Vim tips



Ah, yeah.

I think the thing I most often have trouble with as a result of using Vim is when using other editors. Many times a string of text gets started with "i", or ends with :wq =o)

Clearly I need to work on my vim chops as I'm missing out on all this.  All I ever use it for is a quick config file edit.
I was looking through lucky's cheatlink for a way to search & replace using wild characters (* or ?)  Example:

search "F1 F2 F3 F4....    
replace "F(1) F(2) F(3) F(4)

It's probably there somewhere, but couldn't find anything.

Could try something with regexp, such as 's/F\([0-9]\)/F(\1)/g'
Of course, if you needed it more than 1 digit, you could use an additional +

Quote
I was looking through lucky's cheatlink for a way to search & replace using wild characters (* or ?)

Grrr, off the top of my head I can figure out the search. The replace string needs work (e.g., it's changing F1 to F(d)). Off to google...

:%s@F\d@F(\d)@g

This can't be too difficult.

Edit: Especially if you do what hats suggested. The digit range (\d) will work for [0-9].

Next Page...
original here.