Vim: Right hand, index finger, ampersand, repeat substiution

You start writing from the left. So you start with your left hand. Then next comes the right hand. The left hand and right hand are linked. The index finger is most prominent on the right hand. The index finger, on the number row, touches &. (The number 7) And & links things together as your left and right hand work together.

In vim, & repeats a substitution on the current line. Given the line one two one one three one four with the cursor at the start, and you issue :s/one/111 you get 111 two one one three one four. If you then press & then you get 111 two 111 one three one four etc. & does not, however, copy over the flags from the first substitution.

g& does the same thing but it repeats the substitution on all lines. And it remembers the substitution flags. If you want to repeat the substitution on a visual selection, make the selection and then type :&&. The double ampersand uses the flags that were used with initial substitution.

The & is used a lot in programming for a logical (when doubled) or bitwise and. You can also say & this post is finished.

vim
I've removed disqus comments
Instead, press this
to express thanks
So far, 0 people have pressed the octopus