You probably know ddp command in Vim to exchange two lines. But what if you want to exchange only parts of these lines?
For example, you have two parameters:
Parameter=Value Another parameter=some other valueAnd you want to exchange their values to get this:
Parameter=some other value Another parameter=Value
If you might need to do it more than once and your level of laziness (a.k.a. urge to optimize stuff) is somewhat close to mine, you might find this Vim command useful:
^f=l"qDj^f=l"wD"qpk^f="wp
It does exactly that.
To use it:
- Copy-paste above line into Vim
- Copy it into an internal Vim register ("xdd to cut current line to register x)
- Put cursor somewhere in the first line and execute macro stored in your register (@x)