In Vim, you can use C-n
to complete a word found elsewhere in the buffer (or in a different buffer). If you then hit C-x C-n
it will insert the following word, and you can continue in this manner to complete a series of words one at a time.
I’ve gotten a lot of mileage out of that, and was hoping Evil/Emacs might have something similar. It does!
In Evil, instead of tapping C-x
between each C-n
, you tap SPC
between each C-n
.
For example, in a buffer like,
a█
foobar abc def ghi
tap C-n
to produce,
abc█
foobar abc def ghi
then tap SPC C-n
to produce,
abc def█
foobar abc def ghi
and again SPC C-n
,
abc def ghi█
foobar abc def ghi
etc.
I stumbled across this while reading through the source of dabbrev-expand
:
If the user inserts a space after expanding and then asks to expand again, always fetch the next word.
Vim also provides similar functionality around full line completion, i.e. C-x C-l
to complete a whole line, then C-x C-l
to complete the following line, etc. I don’t yet know if something similar exists in Evil/Emacs/dabbrev/etc.