Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable omnicomplete or ftplugin or something in vim

I am trying to disable (auto-/omni-/whichever-) completion in sql. It is a problem for me because I used <C-c> for escape and when the file end in .sql it seems to initiate some search with a frustrating 2 second pause. In particular, typing k during the pause is causing a collision that inserts unwanted sql keywords.

.vimrc has

  filetype plugin off
  set omnifunc=

and :filetype returns filetype detection:ON plugin:OFF indent:ON

but in insert mode <C-c>k still prints

  -- Omni completion (^O^N^P)
   match 1 of 80` while autocompleting

and :verbose imap <C-c>k returns

i  <C-C>k      *@<C-\><C-O>:call sqlcomplete#Map("sqlKeyword\\w*")<CR><C-X><C-O>
        Last set from ~/projects.vim

and verbose set omnifunc can be overwritten, even when I :set omnifunc= (when I set it to nothing) directly:

  omnifunc=sqlcomplete#Complete
        Last set from /opt/local/share/vim/vim74/autoload/sqlcomplete.vim

More due diligence:

  1. :help omnifunc
  2. :help ftplugin
  3. This, which is maybe the same, but wasn't answered: How do I turn off Omni Complete in Vim?
  4. Other SO advice, which is all about turning these features on
  5. Changing the filename to have a different suffic solves the problem but that is dumb.
like image 671
enfascination Avatar asked Jul 24 '14 10:07

enfascination


1 Answers

Those mappings come from $VIMRUNTIME/ftplugin/sql.vim. You'll find it documented under :help ft-sql. How to customize / turn off the mappings is described under :help sql-completion-customization (and following paragraphs). Summary:

If you don't want any of those mappings:

let g:omni_sql_no_default_maps = 1

To just redefine the annoying key:

let g:ftplugin_sql_omni_key = '<Leader>sql'

You can also completely disable that key by choosing a nonexisting one:

let g:ftplugin_sql_omni_key = '<Plug>DisableSqlOmni'

Put any of those into your ~/.vimrc.

like image 181
Ingo Karkat Avatar answered Oct 16 '22 07:10

Ingo Karkat