Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

:'a,'bg/fred/s/dick/joe/igc : VERY USEFUL

Wow, thanks for the tip, any ideas on what it does?

A lot of these seem to be learn to use regular expressions and not really vim related other than vim supports regular expressions. I.E. the 4 or 5 different ways to find an exactly 4 digit number that mostly seem to boil down to '/' does search by regular expressions and here is a regular expression that finds 4 digit numbers.



> 'a,'b

Between mark `a' and `b'

> g/fred

If the line contains the pattern Fred, execute the following command (s/dick/joe/igc)

> s/dick/joe/

Replace dick with joe

> /igc

i: Case insensitive

g: Replace multiple occurrences on the same line

c: Ask for confirmation on each substitution

I may be wrong about some detail, but I believe that's it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: