Is there a way to perform a completion similar to <c-x><c-l>
, but completes lines based on an arbitrary substring rather than a leading prefix of the line? I'm especially interested in a way of doing this without using a plugin, assuming one exists.
<c-x><c-l>
in insert mode completes an entire line, (taking indentation into account).
For example, in the following buffer let @
denote where the cursor is
import foo
import bar
imp@
If I then type <c-x><c-l>
, the contents of the buffer become
import foo
import bar
import bar
However, I frequently want to complete lines (especially Python imports or repetitive assignments) using a substring rather than a leading prefix of a line.
I'd like to be able to do something equivalent to the following:
import foo
import bar
fo@
which would become the following after the almost-<c-x><c-l>
-but-not-quite completion.
import foo
import bar
import foo