vimpluginsvundle

Vim plugins declared in ftplugin do not work


Gvim is behaving weird and I can't find the reason. I use Vundle, and all the plugins declared in my .vimrc are working fine. I declared some additional settings and plugins in .vim/after/ftplugin/java.vim.

The mappings work fine, but the plugins do not work. If I choose a different file in my current gvim session, I get those error messages:

Error detected while processing function vundle#config#bundle[2]..<SNR>14_check_bundle_name:
line 2:
Vundle error: Name collision for Plugin Raimondi/delimitMate. Plugin Raimondi/delimitMate previously used the name "delimitMate". Skipping Plugin Raimondi/delimitMate.
Vundle error: Name collision for Plugin artur-shaik/vim-javacomplete2...
[comment: same error message for all plugins declared in the ftplugin]

I noticed, that if I run :VundleInstall the plugins are suddenly working (the error messages stay when I change the file, no plugins are installed when I use the command).

Here is the beginning of my .vimrc:

syntax on
set guifont=Inconsolata\ Medium\ 12
set nocompatible
set t_Co=256

filetype off

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

"[comment: all plugins I use for every filetype]

call vundle#end()            " required

filetype plugin indent on

and this is my java.vim file:

filetype off
"to automatically close brackets
Plugin 'Raimondi/delimitMate'

"omni-complete for Java
Plugin 'artur-shaik/vim-javacomplete2'

"use tab to navigate through insert completion
Plugin 'ervandew/supertab'
filetype plugin indent on

"needed to make javacomplete2 working properly
autocmd FileType java setlocal omnifunc=javacomplete#Complete

My OS is Ubuntu 16.04.


Solution

  • All your :Plugin commands are supposed to be between these two lines:

    call vundle#begin()
    
    " :Plugin commands go here
    
    call vundle#end() 
    

    Try another plugin manager if you absolutely need lazy loading.