Hmm...It appears that I have just bought a bunch of Assassin Creed games for no other reason then they look fun...I have no idea what the game is about...
guys, I'm trying to come up with a ex command to make all conditional statements "yoda-style" (I'm trying to make that a habit, to avoid some annoying hard to track bugs because of mistyping the == with a single =)
(that isn't a smile face in the end)
I did it often in the code, but I think there are a few comparisons that might be on the regular order, so I'm thinking about running this
:%s/( *\(.*\) *== *\(.*\) *)/( \2 == \1 )/gc
I'll tell you guys if it worked, but if you spot something that could have been done better there
seems to be working, except on conditional statements that have logical operators, like: if(string == "hello" && string2 == "world")
I'm asking this question in response to the comments received on my answer to this question.
Perhaps someone can explain to me what I missed in the posted question that was glaringly apparent to everyone else. When I first saw it there were some things IMHO that made it a great candidate for "u...
in this case it looks for a "(", then 0 or more spaces, any number of characters followed by 0 or more spaces and "==", then 0 or more spaces, any number of characters, 0 or + spaces and a closing ")", and switch the "any number of characters" part of each side
the g is for global like sed, and c so it asks me first before doing any change so I can check if it should be done
one annoying part is that is there was a space before the "==" it considered it part of the "any number of characters" and not the "0 or more spaces", probably because of what you told me before about the * always looking for the most number of characters @ByteCommander