Vim insert mode completion for sentences

autocompletevim

I would like to have insert mode completion for sentences rather than lines in vim.

C-x C-l completes lines, but cannot complete sentences that do not start with a new line.

For example:

I have a dog. My dog's name is Spot.

I want to be able to type:

My dog

then hit a key to complete the sentence.

What is the best way to do this? A thread with the same title did not have a solution.

Best Answer

Try C-x C-u. You will need to define the completion as described in the complete-functions section of the vim help. Type:

:help complete-functions

To see this section. Similarly,

:help i_^X

(where ^X is the C-x character) will show you the section that describes this mode. Keep in mind that sentences typically end with the pattern /. /. Good luck.

Related Question