Reputation: 312
I would like to create snippets that do a custom completion at each tab stop using Vim's complete()
function. Here's a simple example of what i want to achieve.
snippet date "Date snippet"
day of month: ${1:`!v complete(col('.'), [1, 2, 3, 4])`}
month: ${2:`!v complete(col('.'), ['Jan', 'Feb', 'March'])`}
year: ${3:`!v complete(col('.'), ['2012', '2013', '2014', '2015'])`}
endsnippet
At the first tab stop i want to see Vim's auto-complete menu with [1, 2, 3, 4]
items. Similarly for other tab stops. But, when i actually run this snippet I get the following output
day of month: Jan0an0
month: 201200120
year:100
There might be other ways to achieve auto-complete as shown in screen cast Episode 4: Python Interpolation. But, I would love to see Vim's auto-complete inside UltiSnips.
Please anyone suggest on how to achieve this.
Upvotes: 1
Views: 829
Reputation: 1527
Unfortunately, due to Vim's design, this is not achievable in vanilla Vim+UltiSnips today. It might be doable once neovim fixes interaction issues.
See https://github.com/SirVer/ultisnips/issues/428
Upvotes: 1