franzlorenzon
franzlorenzon

Reputation: 5943

Vim: autocomplete not only from the left but also considering the right

A lot of times when I'm writing on Vim I use the autocomplete feature, and it works greatly.

But I'm wondering if Vim could autocomplete not only from the left but also considering the right part of a word (or of the line). Example file:

1 # example lines
2 VimIsGreat = true
3 Vim
4 Vim
5 # autocomplete considering the right part of a word (or line):
6 Vimeat
7 Vim = true

Using default autocomplete ([3] line autocomplete, [4] word autocomplete):

3 Vim[ctrl+x] → VimIsGreat = true
4 Vim[ctrl+n] → VimIsGreat

For the lines 6-7, autocomplete doesn't naturally consider the right part of the word (or of the line). Now I'm getting this:

6 Vim[ctrl+n]eat → VimIsGreateat
7 Vim[ctrl+x] = true →  Whole line completion (^L^N^P) Pattern not found

What I'm wishing:

5 # autocomplete considering the right part of a word [6] (or line [7]):
6 Vim[ctrl+?]eat → VimIsGreat
7 Vim[ctrl+?] = true → VimIsGreat = true

I hope I clarified my point. Is there anything I can do to get this behavior? (what I'm wishing section)

Upvotes: 1

Views: 60

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172758

Have a look at my BidiComplete plugin; it provides a custom completion that does exactly that.

Upvotes: 3

Related Questions