2

I am trying to set up syntax keyword based omnicompletion in vim.

I have defined a few syntax keyword Constants in ~/.config/nvim/syntax/spl.vim
They are correctly detected and highlighted.
They are also showing up in :syntax list as below:

:syntax list                                                                                                 
--- Syntax items ---
Operator       xxx match #[=+\-*\/%]#
String         xxx match /".*"/
Comment        xxx match +\/\/.*+
Constant       xxx SWAP_OUT FREE_PAGE_TABLE INT_CLOSE DISK_SIZE GET_CODE_PAGE IDLE_PROCESS INT_LOGOUT
                   CONTEXT_SWITCH MAX_FILE_SIZE INT_DELETE WAIT_TERMINAL INIT_PROCESS MAX_BUFFER
                   RESOURCE_TABLE_OFFSET PAGE_SIZE INODE_TABLE WAIT_DISK FILE 
                   .. truncated ..

:set omnifunc outputs omnifunc=syntaxcomplete#Complete

But still Ctrl+X Ctrl+O shows Omni completion (^O^N^P) Pattern not found

How to fix this?

Vim version is: NVIM v0.4.2

set ft?
  filetype=spl
scriptnames
  ...
  ftdetect/spl.vim
  syntax/spl.vim
  ...
  • Welcome to Vi and Vim! Interesting first question; I hope you get an answer! You might want to verify :set filetype? and :scriptnames give what you expect. – D. Ben Knoble Nov 4 '19 at 12:39
  • 1
    Thanks @D.BenKnoble :) :set filetype? gives filetype=spl and :scriptnames contains ftdetect/spl.vim and syntax/spl.vim, which are expected values. – happycoder97 Nov 4 '19 at 13:57

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.