我想在序言中说我对vimscript很缺乏经验,所以请耐心等待我。当我运行SyntasticInfo时,我得到以下内容:
Syntastic version: 3.7.0-199 (Vim 704, Windows)
Info for filetype: python
Global mode: active
Filetype python is active
The current file will be checked automatically
syntastic: error: checker output:
syntastic: error: checker python/python: can't parse version string (abnormal termination?)
Available checkers: flake8 pep8 pycodestyle pyflakes
Currently enabled checker: flake8
我怀疑它与我的vimrc中的shell var有关但我无法弄清楚为什么它在我第一次打开gvim实例和缓冲区开关时有效。
以下是我的vimrc:
"bundle management
set rtp+=$HOME\vimfiles\bundle\vim-colors-solarized
set rtp+=$HOME\vimfiles\bundle\syntastic
set rtp+=$HOME\vimfiles\bundle\SimpylFold
set rtp+=$HOME\vimfiles\bundle\vim-python-pep8-indent
set rtp+=$HOME\vimfiles\bundle\vim-flake8
set rtp+=$HOME\vimfiles\bundle\AsyncCommand
set nocompatible
filetype plugin indent on
syntax on
color solarized
autocmd BufEnter * silent! lcd %:p:h
"browse vert diffsplit
behave xterm
set expandtab
"set shell=powershell.exe\ -ExecutionPolicy\ Unrestricted
"\ -windowstyle\ hidden
set shell=cmd
set shellcmdflag=/c
set noshellslash
set shellpipe=>
set shellredir=>
set smartcase
set showcmd
set winaltkeys=no
set viminfo='100,f1,n$USERPROFILE\\_viminfo.txt
set lines=86
set columns=240
set mousemodel=popup
set clipboard=autoselect
set noswapfile
set autoread
set autowrite
set iskeyword+=.
set iskeyword+=&
set iskeyword+=$
set iskeyword+=%
set iskeyword+=:
set fileformats=dos,unix
set backspace=indent,eol,start
set ts=3
set autoindent
set ruler
set ignorecase
set number
set hlsearch
set modeline
set modelines=29
set guifont=Lucida_Console:h11:cANSI
set complete-=k complete+=k
set omnifunc=syntaxcomplete#Complete
set encoding=utf-8
set wildmenu
set wildmode=list:longest,full
""bad white space
highlight BadWhitespace ctermbg=red guibg=darkred
au BufRead,BufNewFile, *.c,*.h,*.sas match BadWhitespace /\s\+$/
"syntastic var
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_enable_highlighting=1
let g:syntastic_always_populate_loc_list=1
let g:syntastic_auto_loc_list=1
let g:syntastic_check_on_open=1
let g:syntastic_debug=8
au BufRead, *.py let g:syntastic_debug_file = "~/syntastic.log"
let g:syntastic_check_on_wq=0
let g:syntastic_python_checkers=['flake8']
let syntastic_nested_autocommands=1
"saves and loads folds in files that have them
au BufWinLeave * silent! mkview
au BufWinEnter * silent! loadview
augroup sascode
au GuiEnter,BufEnter *.sas,*.log,*.lst set makeprg=sas\ -nosplash\ -sysin\ %\ -log\ %:r.log\ -print\ %:r.lst
au GuiEnter,BufEnter *.sas,*.log,*.lst,*.tcl set ff=dos
au GuiEnter,BufEnter *.sas,*.log,*.lst,*.tcl setf sas
au GuiEnter,BufEnter *.sas,*.log,*.lst,*.tcl set lines=86 | set columns=240
au GuiEnter,BufEnter *.sas,*.log,*.lst,*.tcl color solarized
au GuiEnter,BufEnter *.sas,*.log,*.lst,*.tcl syntax on
au GuiEnter,BufEnter *.sas,*.log,*.lst,*.tcl set autoindent
augroup END
"Declare local buffer variables when entering a buffer if not already defined
au BufEnter,BufReadPost *.py,*.sas,*.lst,*.log call SetBVars("false")
au BufFilePost *.py,*.sas,*.lst,*.log call SetBVars("true") "after saveas command reset buffer vars
function! SetBVars(reset)
if !exists("b:fileRoot") || a:reset=="true"
let b:fileRoot = expand("%:p:r")
let b:ssas ='"'.b:fileRoot.'.sas"'
let b:slog ='"'.b:fileRoot.'.log"'
let b:slst ='"'.b:fileRoot.'.lst"'
let b:sbat ='"'.b:fileRoot.'.bat"'
let b:spy ='"'.b:fileRoot.'.py"'
let b:sas =b:fileRoot.'.sas'
let b:log =b:fileRoot.'.log'
let b:lst =b:fileRoot.'.lst'
let b:bat =b:fileRoot.'.bat'
let b:py =b:fileRoot.'.py'
endif
endfun
au BufRead,BufNewFile *.ps1 set filetype=PowerShell
au! Syntax PowerShell source $HOME\syntax\ps1.vim
augroup XML
au GuiEnter *.xml,*.XML color solarized
au GuiEnter *.xml,*.XML set ts=3
au GuiEnter *.xml,*.XML setf xml
au GuiEnter *.xml,*.XML set ff=dos
au GuiEnter *.xml,*.XML set shiftwidth=3
au GuiEnter *.xml,*.XML set lines=80 | set columns=190
augroup END
augroup scripts
au GuiEnter *.pl,*.sh,*.js,*htm,*.bat :set makeprg=perl\ %
au GuiEnter *.pl,*.sh,*.js,*htm,*.bat color solarized
au GuiEnter *.pl,*.sh,*.js,*htm,*.bat set ts=3
au GuiEnter *.pl,*.sh,*.js,*htm,*.bat set ff=dos
au GuiEnter *.pl,*.sh,*.js,*htm,*.bat set shiftwidth=3
au GuiEnter *.pl,*.sh,*.js,*htm,*.bat set lines=60 | set columns=190
augroup END
augroup textfiles
au GuiEnter *.txt,*.TXT set wrapmargin=10
au GuiEnter *.txt,*.TXT color solarized
au GuiEnter *.txt,*.TXT set textwidth=130
au GuiEnter *.txt,*.TXT set lines=70 | set columns=220
au GuiEnter *.txt,*.TXT set autoindent
augroup END
augroup config
au GuiEnter .profile,*rc color solarized
au GuiEnter .profile,*rc set lines=60 | set columns=140
augroup END