我很难设置VIM(7.1.xxx)来编辑python文件.缩进似乎被打破(最佳4个空格).我已经按照我通过Google找到的一些教程进行了操作.仍然没有效果:/请帮助.
我在我的macbook上使用它:
" configure expanding of tabs for various file types au BufRead,BufNewFile *.py set expandtab au BufRead,BufNewFile *.c set noexpandtab au BufRead,BufNewFile *.h set noexpandtab au BufRead,BufNewFile Makefile* set noexpandtab " -------------------------------------------------------------------------------- " configure editor with tabs and nice stuff... " -------------------------------------------------------------------------------- set expandtab " enter spaces when tab is pressed set text break lines when line length increases set tabstop=4 " use 4 spaces to represent tab set softtabstop=4 set shift number of spaces to use for auto indent set autoindent " copy indent from current line when starting a new line " make backspaces more powerfull set backspace=indent,eol,start set ruler " show line and column number syntax on " syntax highlighting set showcmd " show (partial) command in status line
(编辑为仅显示与缩进/制表符相关的内容)
我用:
$ cat ~/.vimrc syntax on set showmatch set ts=4 set sts=4 set sw=4 set autoindent set smartindent set smarttab set expandtab set number
但是我要尝试达人的参赛作品
一个更简单的选项:只需在/ etc/vim/vimrc文件中取消注释配置的以下部分(最初被注释掉):
if has("autocmd") filetype plugin indent on endif