Python 处理“*”的BufRead Auto命令时检测到错误。";

Python 处理“*”的BufRead Auto命令时检测到错误。";,python,vim,Python,Vim,我的vim配置有问题 打开python(.py)文件时发生此错误: 打开例如html(.html)或ruby(.rb)文件时,不会发生错误 这是我的vim配置。插件都已安装 """ VUNDLE """ set nocompatible filetype off set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() Plugin 'VundleVim/Vundle.vim' " plugins Plugin 'valloric/youc

我的vim配置有问题

打开python(.py)文件时发生此错误:

打开例如html(.html)或ruby(.rb)文件时,不会发生错误

这是我的vim配置。插件都已安装

""" VUNDLE """
set nocompatible
filetype off

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

Plugin 'VundleVim/Vundle.vim'

" plugins
Plugin 'valloric/youcompleteme'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'shawncplus/phpcomplete.vim'
Plugin 'quramy/tsuquyomi'
"Plugin 'Shougo/vimproc.vim'
Plugin 'leafgarland/typescript-vim'

call vundle#end()
filetype plugin indent on



""" CONFIG """
set history=200 "command history

set so=7 "add 7 lines when moving up/down

set hlsearch "highlight search results
set showmatch "highlight matching brackets

set ruler
set relativenumber

syntax enable
set encoding=utf8
set ffs=unix,dos,mac "unix as standard file type

set expandtab
set smarttab
set shiftwidth=4
set tabstop=4

set ai "Auto indent
set si "Smart indent
set nowrap "Wrap lines

set laststatus=2

" whitespace
set list
set listchars=tab:>-,trail:~,extends:>,precedes:<

set nobackup
set nowb
set noswapfile

" NERDTree
map <C-n> :NERDTreeToggle<CR>
"autocmd vimenter * NERDTree

" NERDTreeTabs
let NERDTreeShowHidden=1
let g:nerdtree_tabs_open_on_console_startup=1
map <Leader>n <plug>NERDTreeTabsToggle<CR>

au FileType php setl ofu=phpcomplete#CompletePHP
au FileType ruby,eruby setl ofu=rubycomplete#Complete
au FileType html,xhtml setl ofu=htmlcomplete#CompleteTags
au FileType css setl ofu=csscomplete#CompleteCSS
au FileType python setl ofu=pythoncomplete#Complete

au BufNewFile,BufRead *.py, *.php, *.rb, *.html, *.js, *.ts, *.md
    \ set tabstop=4 |
    \ set softtabstop=4 |
    \ set shiftwidth=4 |
    \ set textwidth=79 |
    \ set expandtab |
    \ set autoindent |
    \ set fileformat=unix


au BufNewFile,BufRead *.css, *.scss, *.json
    \ set tabstop=2 |
    \ set softtabstop=2 |
    \ set shiftwidth=2 |
    \ set textwidth=79 |
    \ set expandtab |
    \ set autoindent |
    \ set fileformat=unix

let g:ycm_python_binary_path = 'python'

if !exists("g:ycm_semantic_triggers")
  let g:ycm_semantic_triggers = {}
endif

" TypeScript plugin tsuquyomi
let g:ycm_semantic_triggers['typescript'] = ['.']
let g:tsuquyomi_import_curly_spacing = 0
let g:tsuquyomi_single_quote_import = 1
map <C-i> :TsuImport<CR>

hi Pmenu ctermbg=green
“VUNDLE”
兼容模式
文件类型关闭
设置rtp+=~/.vim/bundle/Vundle.vim
调用vundle#begin()
插件“VundleVim/Vundle.vim”
“插件
插件“valloric/youcompleteme”
插件'scroolose/nerdtree'
插件“jistr/vim nerdtree选项卡”
插件'shawncplus/phpcomplete.vim'
插件'quramy/tsuquyomi'
“插件'Shougo/vimproc.vim'
插件'leafgarland/typescript vim'
调用vundle#end()
文件类型插件缩进
“配置”
设置历史记录=200“命令历史记录
设置so=7“上/下移动时添加7行
设置hlsearch“突出显示搜索结果
设置showmatch“突出显示匹配括号
定尺
集合相对枚举器
语法启用
设置编码=utf8
将ffs=unix、dos、mac“unix设置为标准文件类型
设置扩展选项卡
设置智能选项卡
设置shiftwidth=4
设置tabstop=4
设置ai“自动缩进”
设置si“智能缩进
设置nowrap“换行
设置laststatus=2
“空白
集合列表
设置listchars=tab:>-,trail:~,extends:>,前置:<
设置备份
立即开始
设置noswapfile
“书呆子
地图:nerdtreethoggle
“autocmd VimCenter*NERDTree
“书呆子
设NERDTreeShowHidden=1
让g:nerdtree\u tabs\u open\u on\u console\u startup=1
NERDTreeTabsToggle地图
au FileType php setl of u=phpcomplete#CompletePHP
au文件类型ruby,eruby setl of u=rubycomplete#Complete
au文件类型html,xhtml setl ofu=htmlcomplete#CompleteTags
au文件类型css setl ofu=csscomplete#CompleteCSS
au FileType python setl of u=pythoncomplete#Complete
au BufNewFile、BufRead*.py、*.php、*.rb、*.html、*.js、*.ts、*.md
\设置tabstop=4|
\设置softtabstop=4|
\设置shiftwidth=4|
\设置textwidth=79|
\设置扩展选项卡|
\设置自动缩进|
\设置fileformat=unix
au BufNewFile、BufRead*.css、*.scss、*.json
\设置tabstop=2|
\设置softtabstop=2|
\设置shiftwidth=2|
\设置textwidth=79|
\设置扩展选项卡|
\设置自动缩进|
\设置fileformat=unix
设g:ycm_python_binary_path='python'
如果!存在(“g:ycm_语义_触发器”)
设g:ycm_语义_触发器={}
恩迪夫
“TypeScript插件tsuquyomi
让g:ycm_语义_触发['typescript']=['.]
设g:tsuquyomi_导入_卷曲_间距=0
设g:tsuquyomi_single_quote_import=1
地图:荃湾
hi PMG=绿色
我确实将带有“BufNewFile”的行更改为不同的方式(1
set
命令、多个
set
命令、带管道、带反斜杠、不带反斜杠等),但没有任何帮助

有人知道问题到底是什么吗?

很难注意到(我不得不看了两遍),但是问题在于
:autocmd
定义中的模式之间的空格:

语法是

:help{pat}
显示各个模式之间不能有空格

例子 如您所见,Vim只识别第一个模式,并将以下所有命令作为(Ex)命令

:*
命令执行寄存器的内容(可能是垃圾),这会导致您看到的
E20
错误(可能是因为寄存器中有
字符)

修理 删除空白。正如我已经评论过的,您也可以跳过对每个选项重复
:set
命令

:au BufNewFile,BufRead *.py,*.php,*.rb,*.html,*.js,*.ts,*.md ...

您确定是您的
.vimrc
中的
:au BufRead*.py
吗?当您注释掉它时,问题是否消失了?我认为这是由某些(文件类型)引起的plugin.au BufRead*.py的输出是什么?哦,你可以把所有选项放在一个
:set
命令之后:
set ts=4 sts=4 sw=4…
这样,你可能不需要断线。@IngoKarkat如果我只从带有
BufRead
的行中删除
*.py
扩展名,它不会抛出错误打开一个python文件。这也帮了我的忙,Ingo。谢谢!:)我和PHP有同样的问题,现在你帮我解决了。:)非常感谢!!!同样的问题。简单而有用。谢谢,
:au[tocmd] [group] {event} {pat} [nested] {cmd}
:au BufNewFile,BufRead *.py, *.php, *.rb, *.html, *.js, *.ts, *.md echomsg 'test'

:au BufRead *.py
--- Auto-Commands ---
filetypedetect  BufRead
    *.py      setf python
BufRead
    *.py      *.php, *.rb, *.html, *.js, *.ts, *.md echomsg 'test'
:au BufNewFile,BufRead *.py,*.php,*.rb,*.html,*.js,*.ts,*.md ...