2016-09-18 6 views
2

次のような動作が発生します。私はこのVimの二重インデントのPythonファイル

31# Application definition 
32 
33 INSTALLED_APPS = [ 
34   |<-cursor is here, two indents, 8 spaces 
35  'rest_framework', 

を得るライン33

31# Application definition 
32 
33 INSTALLED_APPS = [ 
34  'rest_framework', 

から「O」を打つ、このsettings.pyスニペットを考えると私が本当に欲しいのは休息に沿って、1つのインデント、または4つのスペースの合計になりますリストの何がありますか?私はhereから主に掛かった以下の.vimrcを使用しています。

set nocompatible    " required 
filetype off     " required 

" set the runtime path to include Vundle and initialize 
set rtp+=~/.vim/bundle/Vundle.vim 
call vundle#begin() 

" alternatively, pass a path where Vundle should install plugins 
"call vundle#begin('~/some/path/here') 

" let Vundle manage Vundle, required 
Plugin 'gmarik/Vundle.vim' 

" Add all your plugins here (note older versions of Vundle used Bundle instead of Plugin) 

" Themes 
Plugin 'altercation/vim-colors-solarized' 
Plugin 'jnurmine/Zenburn' 

" All of your Plugins must be added before the following line 
call vundle#end()   " required 
filetype plugin indent on " required 

if has('gui_running') 
    set background=dark 
    colorscheme solarized 
else 
    colorscheme zenburn 
endif 

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

set encoding=utf-8 
set nu 
let python_highlight_all=1 
syntax on 
set backspace=indent,eol,start 

答えて

3

これは、デフォルトのvimインデントプラグインのために発生します。それは[の下の最初の行に2 shiftwidthを挿入します。

あなたはここに、この動作が発生したコードを見ることができます:https://github.com/vim/vim/blob/0b9e4d1224522791c0dbbd45742cbd688be823f3/runtime/indent/python.vim#L74

私はあなたが必要とまったくカッコ内のインデントを行いvim-python-pep8-indentプラグインをインストールすることをお勧めします。

+0

完璧、ありがとう。 –

関連する問題