我在设置Vim (7.1.xxx)来编辑Python文件(*.py)时遇到了问题。缩进似乎被破坏了(最好4个空格)。我遵循了我在谷歌上找到的一些教程。仍然没有效果:/请帮助。
发布于 2008-09-15 17:53:33
我在我的macbook上使用以下代码:
" configure expanding of tabs for various file types
au BufRead,BufNewFile *.py set expandtab
au BufRead,BufNewFile *.c set expandtab
au BufRead,BufNewFile *.h set expandtab
au BufRead,BufNewFile Makefile* set noexpandtab
" --------------------------------------------------------------------------------
" configure editor with tabs and nice stuff...
" --------------------------------------------------------------------------------
set expandtab " enter spaces when tab is pressed
set textwidth=120 " break lines when line length increases
set tabstop=4 " use 4 spaces to represent tab
set softtabstop=4
set shiftwidth=4 " 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
(编辑为仅显示与缩进/制表符相关的内容)
发布于 2012-08-06 23:01:33
我使用:
$ 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
但我要试试达伦的作品
发布于 2017-06-03 10:05:02
一种更简单的选择:只需在/etc/vim/vimrc文件中取消注释配置的以下部分(最初已注释掉):
if has("autocmd")
filetype plugin indent on
endif
https://stackoverflow.com/questions/65076
复制相似问题