Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vim autocmd错误_Vim - Fatal编程技术网

Vim autocmd错误

Vim autocmd错误,vim,Vim,我用这个脚本在加载Python文件时设置变量 au BufNewFile,BufRead *.py \ set tabstop=4 \ set softtabstop=4 \ set shiftwidth=4 \ set textwidth=79 \ set expandtab \ set autoindent \ set fileformat=unix 加载Python文件时,出现以下错误: Error detected while p

我用这个脚本在加载Python文件时设置变量

au BufNewFile,BufRead *.py
    \ set tabstop=4
    \ set softtabstop=4
    \ set shiftwidth=4
    \ set textwidth=79
    \ set expandtab
    \ set autoindent
    \ set fileformat=unix
加载Python文件时,出现以下错误:

Error detected while processing BufRead Auto commands for "*.py":
E518: Unknown option: set
这应该起作用:

au BufNewFile,BufRead *.test set tabstop=4 
      \softtabstop=4 
      \shiftwidth=4  
      \textwidth=790  
      \expandtab  
      \autoindent  
      \fileformat=unix

你能行。而不是*.test,它对我有效。 (Astrix.Astrix)

例如:
布夫奈维尔,布弗雷德。设置tabstop=4

以下是实现所需功能的几种方法:

au BufNewFile,BufRead *.py
    \ set tabstop=4 |
    \ set softtabstop=4 |
    \ set shiftwidth=4 |
    \ set textwidth=79 |
    \ set expandtab |
    \ set autoindent |
    \ set fileformat=unix

说明

在自动命令中,您正在调用
:set
(:h:set)命令,该命令 用于设置vim选项。如果要设置多个选项,请 可以调用
:使用多个用空格分隔的选项设置

或者为每个选项多次调用
:set
,将每个
:set
带有
|
(:h:bar)的命令

提示

因为您的目标是定义特定于 python文件,您应该使用
:autocmd Filetype python…
来 这将创建一个
ftplugin/python/custom.vim
文件,其中 您可以使用相反的
:setlocal
命令启用这些设置 to
:set
仅为当前缓冲区设置它们


很酷,只是不需要空白。只是一个建议:看起来你真正想要的是
Filetype
事件,而不是
BufNewFile
BufRead
au BufNewFile,BufRead *.test set tabstop=4 softtabstop=4 shiftwidth=4  textwidth=79 expandtab autoindent fileformat=unix
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 *.py
    \ set tabstop=4
    \ softtabstop=4
    \ shiftwidth=4
    \ textwidth=79
    \ expandtab
    \ autoindent
    \ fileformat=unix