Assuming that I have a file containing only of characters and numbers (no special characters or punctuation marks), how can I swap two words that may or may not be right next to each other using VIM?I tried the following (swap all occurrences of Tom with Jerry) but it doesn't work for obvious reasons.:%s/Tom/Jerry/g:%s/Jerry/Tom/gThank you!
Swap words in VIM without using any third party plugins
linux;vim;swap
Maybe you could use an intermediary variable like this:%s/Tom/XX9G235a65/g :%s/Jerry/Tom/g :%s/XX9G235a65/Jerry/g