I have the following vimrc file :

syntax on
set nocompatible              " be iMproved, required
filetype off                  " required

if has("autocmd")
  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif

if &compatible
  set nocompatible               " Be iMproved

set runtimepath+=/home/mohsen/.vim/bundle/neobundle.vim/

call neobundle#begin(expand('/home/mohsen/.vim/bundle'))

NeoBundleFetch 'Shougo/neobundle.vim'

NeoBundle 'rdnetto/YCM-Generator'
NeoBundle 'Shougo/neosnippet.vim'
NeoBundle 'Shougo/neosnippet-snippets'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'ctrlpvim/ctrlp.vim'
NeoBundle 'flazz/vim-colorschemes'

NeoBundle 'Shougo/vimshell', { 'rev' : '3787e5' }

call neobundle#end()

filetype plugin indent on


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

Plugin 'VundleVim/Vundle.vim'
Bundle 'YouCompleteMe'
Plugin 'tpope/vim-fugitive'
Plugin 'command-t'
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}

call vundle#end()            " required
filetype plugin indent on    " required

Plugin 'tmhedberg/SimpylFold'
filetype plugin on
set splitbelow
set splitright
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
set foldmethod=indent
set foldlevel=99
nnoremap <space> za

let g:SimpylFold_docstring_preview=1
au BufNewFile,BufRead *.py
    \ set tabstop=4 |
    \ set softtabstop=4 |
    \ set shiftwidth=4 |
    \ set textwidth=79 |
    \ set expandtab |
    \ set autoindent |
    \ set fileformat=unix
au BufNewFile,BufRead *.js, *.html, *.css
    \ set tabstop=2 |
    \ set softtabstop=2 |
    \ set shiftwidth=2
Plugin 'vim-scripts/indentpython.vim'
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h "match BadWhitespace /\s\+$/
set encoding=utf-8

let g:ycm_autoclose_preview_window_after_completion=1
map <leader>g  :YcmCompleter GoToDefinitionElseDeclaration<CR>

execute pathogen#infect()

Plugin 'vim-syntastic/syntastic'
Plugin 'nvie/vim-flake8'
let python_highlight_all=1

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0

let g:syntastic_python_checkers = ['pylint']
let g:syntastic_php_checkers = ['php', 'phpcs', 'phpmd']
let g:syntastic_tex_checkers = ['lacheck', 'text/language_check']
let g:syntastic_aggregate_errors = 1
let g:syntastic_enable_perl_checker = 1

Plug 'rdnetto/YCM-Generator' , { 'branch': 'stable'}

And my bundle dir is :

 ls -l .vim/bundle/
total 68
drwxr-xr-x  6 mohsen mohsen 4096 Sep 19 15:12 command-t
drwxr-xr-x  6 mohsen mohsen 4096 Sep 23 21:23 ctrlp.vim
drwxr-xr-x  4 mohsen mohsen 4096 Sep 19 17:16 indentpython.vim
-rw-r--r--  1 mohsen mohsen  552 Sep 23 21:23 NeoBundle.lock
drwxr-xr-x  8 mohsen mohsen 4096 Sep 23 21:18 neobundle.vim
drwxr-xr-x  4 mohsen mohsen 4096 Sep 23 21:21 neosnippet-snippets
drwxr-xr-x 12 mohsen mohsen 4096 Sep 23 21:22 neosnippet.vim
drwxr-xr-x  7 mohsen mohsen 4096 Sep 19 17:09 SimpylFold
drwxr-xr-x  6 mohsen mohsen 4096 Sep 19 15:05 sparkup
drwxr-xr-x  8 mohsen mohsen 4096 Sep 22 20:46 syntastic
drwxr-xr-x  5 mohsen mohsen 4096 Sep 23 21:22 vim-colorschemes
drwxr-xr-x  5 mohsen mohsen 4096 Sep 24 16:26 vim-flake8
drwxr-xr-x  7 mohsen mohsen 4096 Sep 19 15:12 vim-fugitive
drwxr-xr-x  7 mohsen mohsen 4096 Sep 23 21:23 vimshell_3787e5
drwxr-xr-x  8 mohsen mohsen 4096 Sep 19 14:42 Vundle.vim
drwxr-xr-x  5 mohsen mohsen 4096 Sep 23 19:55 YCM-Generator
drwxr-xr-x 11 mohsen mohsen 4096 Sep 20 17:50 YouCompleteMe

When I run vim I get the following error:

Error detected while processing /home/mohsen/.vim/vimrc:
line  164:
E464: Ambiguous use of user-defined command: Plug 'rdnetto/YCM-Generator' , { 'branch': 'stable'}
Press ENTER or type command to continue

What's my problem?

  • 4
    you apparently use Vundle, Neobundle and pathogen and perhaps even vim-plug to load plugins. You should clean this up and decide one one single plugin manager to use. Or use the native package feature that comes with Vim 8 – Christian Brabandt Sep 24 '18 at 14:51
  • 2
    Christian is right, you should have a look at this and this – statox Sep 24 '18 at 14:56
  • Is it problem if I use 2 or higher plugin manager? – PersianGulf Sep 24 '18 at 15:43
  • 2
    You have just discovered it is @PersianGulf :-) You could make it work with some effort perhaps, but I wouldn't recommend it. – Martin Tournoij Sep 24 '18 at 15:47
  • 1
    @PersianGulf Strictly speaking, no. But practically, yes, because you're unnecessarily overcomplicating things, which is the root of your issue in this question. You wouldn't use pacman, yum and apt to manage packages on your Linux install, right? :) Same thing here. Each plugin manager works toward the same goal, but does so in its own way. Having all 3 intermix simultaneously is begging for problems. – ZeroKnight Sep 24 '18 at 18:11

The error message comes from the last line of your vimrc:

Plug 'rdnetto/YCM-Generator' , { 'branch': 'stable'}

This is a call to the Plug command of the Vim-plug plugin manager. To work, this line should be surrounded by the following lines as it's stated in the readme:

call plug#begin('~/.vim/plugged')
Plug 'rdnetto/YCM-Generator' , { 'branch': 'stable'}
call plug#end()

Now your real problem is that you try to use three or four different plugins managers: that is totally unnecessary. Instead you should have a read at our question What is the difference between the vim plugin managers?, decide which plugin manager you want to use and use only this one for all of your plugins.

At a second reading of your vimrc: you have plugins that you're trying to install several time (i.e. vim-fugitive) I guess it means that you blindly copied the vimrc of other people and mixed them together without understanding every line. That is not a good idea (your question is the proof of what I'm saying). You would probably loose less time crafting your own vimrc to fit your own needs than debugging someone else's config.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.