我安装了python-mode vim插件,它正确检查语法,但是当我开始换行时它不会自动缩进代码。
我不确定可能会阻止这种情况,所以这就是我的vimrc。
的.vimrc:
"" Pathogen settings
filetype off
call pathogen#infect()
call pathogen#helptags()
filetype plugin on
set nocompatible
" Change leader
let mapleader = ","
" Set color scheme
colorscheme badwolf
" Code settings
syntax on
set textwidth=100
set colorcolumn=100
set tabstop=8
set softtabstop=4
set shiftwidth=4
set autoindent
set expandtab
set nowrap
set textwidth=0 wrapmargin=0
set relativenumber
set number
set ruler
" Make it so jk returns to normal mode
inoremap jk <esc>
" Easy editing/sourcing of vimrc
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
" Useful shortcuts
nnoremap <leader>w :w<cr>
nnoremap <leader>q :q<cr>
nnoremap <leader><space> bi<space><esc>ea<space><esc>
" Plugin shortcuts
nnoremap <c-n> :NERDTreeToggle<cr>
nnoremap <c-k> <c-w>k
nnoremap <c-j> <c-w>j
nnoremap <c-l> <c-w>l
nnoremap <c-h> <c-w>h
nnoremap <leader>l :TagbarToggle<cr>
nnoremap <leader>td <Plug>TaskList
nnoremap <leader>g :GundoToggle<cr>
" Vimscript file settings ---------- {{{
augroup filetype_vim
autocmd!
autocmd FileType vim setlocal foldmethod=marker
augroup END
" }}}
" Python file settings ---------- {{{
augroup filetype_python
autocmd!
autocmd FileType python setlocal foldmethod=indent
autocmd FileType python set foldlevel=99
" }}}
我安装的插件:
ack git minibufexpl.vim snipmate tagbar
command-t gundo nerdtree supertab tasklist
fugitive makegreen python-mode surround vim-airline
答案 0 :(得分:2)
将filetype plugin on
更改为filetype indent plugin on