" Test for completion menu let g:months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] let g:setting = '' func ListMonths() if g:setting != '' exe ":set" g:setting endif call complete(col('.'), g:months) return '' endfunc func! Test_popup_completion_insertmode() new inoremap =ListMonths() call feedkeys("a\\\\", 'tx') call assert_equal('February', getline(1)) %d let g:setting = 'noinsertmode' call feedkeys("a\\\\", 'tx') call assert_equal('February', getline(1)) call assert_false(pumvisible()) %d let g:setting = '' call feedkeys("a\". repeat("\",12)."\\", 'tx') call assert_equal('', getline(1)) %d call feedkeys("a\\\\", 'tx') call assert_equal('', getline(1)) %d call feedkeys("a\\\\\", 'tx') call assert_equal('December', getline(1)) bwipe! iunmap endfunc function! ComplTest() abort call complete(1, ['source', 'soundfold']) return '' endfunction func Test_noinsert_complete() new set completeopt+=noinsert inoremap =ComplTest() call feedkeys("i\soun\\\.", 'tx') call assert_equal('soundfold', getline(1)) call assert_equal('soundfold', getline(2)) bwipe! set completeopt-=noinsert iunmap endfunc