set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
"原来
set nu! "显示行号
syntax enable "语法高亮
syntax on
colorscheme desert "主题
"colorscheme desert256
"set background=dark
set guifont=courier_new:h16 "设置字体为Courier New,大小10号
autocmd GUIEnter * simalt ~x " windows下启动vim最大化
"winpos 0 0 " 设定窗口位置
"set lines=40 columns=155 " 设定窗口大小
"set gcr=a:block-blinkon0 " windows下去掉光标闪动
set nobackup " 关闭自动备份功能,backup自动备份
"set fileencodings=utf-8,gb2312,gb18030,gbk,ucs-bom,cp936,latin1 "打开中文乱码
"set enc=utf8 "存在菜单乱码,注释输出乱码
"set fencs=utf8,gbk,gb2312,gb18030
"设置文件的代码形式
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,chinese,cp936
"vim的菜单乱码解决:
"同样在 _vimrc文件里以上的中文设置后加上下列命令,
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"vim提示信息乱码的解决
language messages zh_CN.utf-8
set tabstop=2
set tabstop=4
set softtabstop=4 "表示在编辑模式的时候按退格键的时候退回缩进的长度
"当使用 expandtab 时特别有用
set shiftwidth=4 "表示每一级缩进的长度
set noexpandtab
set nu
set autoindent "表示自动缩进。
set cindent "是特别针对C语言自动缩进。
autocmd InsertLeave * se nocul " 用浅色高亮当前行
autocmd InsertEnter * se cul " 用浅色高亮当前行
":set cc=50
:set cursorcolumn
"set ruler " 显示标尺
set columns=80 "tw=80
set laststatus=1 " 启动显示状态行(1),总是显示状态行(2)
set foldenable " 允许折叠
set foldmethod=manual " 手动折叠
set background=dark "背景使用黑色
set nocompatible "去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""新文件标题""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"新建.c,.h,.sh,.java文件,自动插入文件头
autocmd BufNewFile *.py exec ":call SetTitle()"
""定义函数SetTitle,自动插入文件头
func SetTitle()
if &filetype == 'python'
call setline(1,"\#!/usr/bin/env python")
call append(line("."),"\# -*- coding: utf-8 -*-")
call append(line(".")+1, "\########################################################")
call append(line(".")+2, "\# File Name: ".expand("%"))
call append(line(".")+3, "\# Blog:http://blog.csdn.net/hurmishine")
call append(line(".")+4, "\# Created Time: ".strftime("%c"))
call append(line(".")+5, "\########################################################")
call append(line(".")+6, "")
endif
endfunc
autocmd BufNewFile * normal G
"=========== F5 run python ====================
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
let &makeprg = mp
let &errorformat = ef
endfunction
map <F5> :call CheckPythonSyntax()<CR>
"vim默认保存位置
"exec 'cd ' . fnameescape('C:\Users\Administrator.USER-20160908DM\Desktop\python\')
"exec 'cd ' . fnameescape('E:\vimFile')
set runtimepath+=d:/path-to-youcompleteme
vim界面配置
最新推荐文章于 2024-05-09 01:12:44 发布