I found this in the complete() documentation:

inoremap <F5> <C-R>=ListMonths()<CR>

    func! ListMonths()
      call complete(col('.'), ['January', 'February', 'March',
            \ 'April', 'May', 'June', 'July', 'August', 'September',
            \ 'October', 'November', 'December'])
      return ''

This basically creates a completion menu of all of the months. Control-X Control-N shows a completion menu of keywords in the current file. While Control-X Control-O shows omni completion. But I want both in the same completion menu. Is this possible with the complete function?

  • I've figured out how to do matching from current word at/before cursor. But I can't find how to get completion entries of :h i_ctrl-X_ctrl-N and :h i_ctrl-X_ctrl-O. Wish I could tag people like Rich or Christian Brandarbadt.
    – kadekai
    Aug 15 at 17:43


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.