Windows下的gvim简单配置python运行
set guifont=Consolas:h14 "设置字体的
set tabstop=4 "tab设置的
color Solarized "我选的配色方案(Solarized可以换成你colors文件中任意一个文件的名字)
set nu "显示行号
set ai "自动缩进
set si "智能缩进
set guioptions-=T "是不要工具栏
set nobackup "不产生~文件
"一键运行代码
function CheckPythonSyntax()
let mp = &makeprg
let ef = &errorformat
let exeFile = expand("%:t")
setlocal makeprg=python\ -u
set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
silent make %
copen
" set efm 是设置quickfix的errorformat,以便vim识别
" makeprg 是vim内置的编译命令,可以通过更改来实现编译对应类型文件。具体可参考vim官方说明文件。
" copen是打开quickfix,n用来设置quichfix窗口大小,如 cope5。在错误描述上回车,可以直接跳转到错误行。
let &makeprg = mp
let &errorformat = ef
endfunction
"一个是普通模式下,一个是插入模式下
au filetype python map <f5> :w <cr>:call CheckPythonSyntax() <cr>
au filetype python imap <f5> <esc> :w <cr>:call CheckPythonSyntax() <cr></cr></cr></esc></f5></cr></cr></f5>
配色下载地址 https://github.com/altercation/vim-colors-solarized,将colors中的的solarized.vim放到.Vim\vim81\colors中(相应vim安装目录中)
更多精彩

