MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/338tx5/vim/cqj662e/?context=3
r/ProgrammerHumor • u/kobaltzz • Apr 20 '15
427 comments sorted by
View all comments
102
And many more hours trying to figure out how to use it in the first place. (For context, written by an occasional vim user).
38 u/ngildea Apr 20 '15 Maybe if you used if more than occasionally you wouldn't be so confused! :P 45 u/Neekoy Apr 20 '15 edited Sep 08 '26 Marvelous coordinated pause smile cough blanketThis post was anonymized with Redact 3 u/pehnn_altura Apr 21 '15 :%s/foo/bar/gFind and replace all instances of foo with bar. Great shortcut if you need to rename a variable! 0 u/[deleted] Apr 21 '15 [deleted] → More replies (5) 2 u/minno Apr 21 '15 I prefer :%s/foo/bar/gc so that I don't accidentally change a part of the file I didn't mean to. → More replies (1) 2 u/VictoryGin1984 Apr 21 '15 Or better yet, :%s/\<foo\>/bar/g, so you only match the whole word "foo". 2 u/Endur Apr 21 '15 Took me a while to remember that syntax. I still need to look it up to remember what letter does confirmation and all that other stuff → More replies (1)
38
Maybe if you used if more than occasionally you wouldn't be so confused! :P
45 u/Neekoy Apr 20 '15 edited Sep 08 '26 Marvelous coordinated pause smile cough blanketThis post was anonymized with Redact 3 u/pehnn_altura Apr 21 '15 :%s/foo/bar/gFind and replace all instances of foo with bar. Great shortcut if you need to rename a variable! 0 u/[deleted] Apr 21 '15 [deleted] → More replies (5) 2 u/minno Apr 21 '15 I prefer :%s/foo/bar/gc so that I don't accidentally change a part of the file I didn't mean to. → More replies (1) 2 u/VictoryGin1984 Apr 21 '15 Or better yet, :%s/\<foo\>/bar/g, so you only match the whole word "foo". 2 u/Endur Apr 21 '15 Took me a while to remember that syntax. I still need to look it up to remember what letter does confirmation and all that other stuff → More replies (1)
45
Marvelous coordinated pause smile cough blanket
This post was anonymized with Redact
3 u/pehnn_altura Apr 21 '15 :%s/foo/bar/gFind and replace all instances of foo with bar. Great shortcut if you need to rename a variable! 0 u/[deleted] Apr 21 '15 [deleted] → More replies (5) 2 u/minno Apr 21 '15 I prefer :%s/foo/bar/gc so that I don't accidentally change a part of the file I didn't mean to. → More replies (1) 2 u/VictoryGin1984 Apr 21 '15 Or better yet, :%s/\<foo\>/bar/g, so you only match the whole word "foo". 2 u/Endur Apr 21 '15 Took me a while to remember that syntax. I still need to look it up to remember what letter does confirmation and all that other stuff → More replies (1)
3
:%s/foo/bar/g
Find and replace all instances of foo with bar. Great shortcut if you need to rename a variable!
0 u/[deleted] Apr 21 '15 [deleted] → More replies (5) 2 u/minno Apr 21 '15 I prefer :%s/foo/bar/gc so that I don't accidentally change a part of the file I didn't mean to. → More replies (1) 2 u/VictoryGin1984 Apr 21 '15 Or better yet, :%s/\<foo\>/bar/g, so you only match the whole word "foo". 2 u/Endur Apr 21 '15 Took me a while to remember that syntax. I still need to look it up to remember what letter does confirmation and all that other stuff → More replies (1)
0
[deleted]
→ More replies (5)
2
I prefer :%s/foo/bar/gc so that I don't accidentally change a part of the file I didn't mean to.
→ More replies (1)
Or better yet, :%s/\<foo\>/bar/g, so you only match the whole word "foo".
Took me a while to remember that syntax. I still need to look it up to remember what letter does confirmation and all that other stuff
102
u/[deleted] Apr 20 '15
And many more hours trying to figure out how to use it in the first place. (For context, written by an occasional vim user).