在加载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发布于 2016-06-16 21:03:04
这应该是可行的:
au BufNewFile,BufRead *.test set tabstop=4
\softtabstop=4
\shiftwidth=4
\textwidth=790
\expandtab
\autoindent
\fileformat=unix或
au BufNewFile,BufRead *.test set tabstop=4|set softtabstop=4|set shiftwidth=4|set textwidth=79 |set expandtab|set autoindent|set fileformat=unix或
au BufNewFile,BufRead *.test set tabstop=4 softtabstop=4 shiftwidth=4 textwidth=79 expandtab autoindent fileformat=unix发布于 2017-03-30 04:22:41
以下是实现您想要的目标的几种方法:
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=unixExplanation: 在您的自动命令中,您正在调用
:set(:h : set )命令,该命令用于设置vim选项。如果要设置多个选项,可以用空格分隔的多个选项调用:set,也可以为每个选项多次调用:set,用|(:h :bar)分隔每个:set命令。 Tip: 由于您的目标是为python文件专门定义某些选项,所以您应该为此使用:autocmd Filetype python ...,或者更好地创建一个ftplugin/python/custom.vim文件,在这里您可以使用:setlocal命令(而不是:set)启用这些设置,以便只为当前缓冲区设置它们。
发布于 2017-03-29 21:56:52
你可以做的。而不是*.test,它适用于我。(Astrix .( Astrix )
例子: au BufNewFile,BufRead。设置tabstop=4
https://stackoverflow.com/questions/37868969
复制相似问题