Skip to content

Instantly share code, notes, and snippets.

@sgsheg
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sgsheg/efbc8fef006d83effd10 to your computer and use it in GitHub Desktop.
Save sgsheg/efbc8fef006d83effd10 to your computer and use it in GitHub Desktop.
vimrc on Windows
set bsdir=buffer
set autochdir
set enc=utf-8
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
set langmenu=zh_CN.UTF-8
language message zh_CN.UTF-8
set helplang=cn
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
set nobackup
"搜索忽略大小写
set ignorecase
"搜索逐字符高亮
" 语法高亮
syntax on
" for backspace
set backspace=indent,eol,start
set incsearch
"行内替换
" 搜索匹配显示
set hlsearch
set gdefault
"始终显示行号
set nu!
"显示光标的坐标
set ruler
"设置Tab键的宽度
set shiftwidth=4
set tabstop=4
set expandtab
if has('multi_byte_ime')
hi Cursor guifg=bg guibg=Orange gui=NONE
hi CursorIM guifg=NONE guibg=Skyblue gui=NONE
set iminsert=0 imsearch=0
endif
"禁用自动缩进
set noautoindent
"与Windows共享剪贴板
set clipboard+=unnamed
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
filetype off
"此处规定Vundle的路径
set rtp+=$VIM/vimfiles/bundle/vundle/
"此处规定插件的安装路径
call vundle#rc('$VIM/vimfiles/bundle/')
Bundle 'gmarik/vundle'
filetype plugin indent on
"
" Brief help -- 此处后面都是vundle的使用命令
" :BundleList - list configured bundles
" :BundleInstall(!) - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!) - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed..
Bundle 'JavaScript-syntax'
Bundle 'jQuery'
Bundle 'othree/html5.vim'
Bundle 'groenewege/vim-less'
Bundle 'Markdown'
Bundle 'Markdown-syntax'
Bundle 'php.vim-html-enhanced'
Bundle "pangloss/vim-javascript"
Bundle "MarcWeber/vim-addon-mw-utils"
Bundle "tomtom/tlib_vim"
Bundle "snipmate-snippets"
Bundle "garbas/vim-snipmate"
"自定义关联文件类型
au BufNewFile,BufRead *.less set filetype=css
au BufNewFile,BufRead *.phtml set filetype=php
au BufRead,BufNewFile *.js set ft=javascript.jquery
set guifont=Monaco:h10
"set gfw=YaHei\ Consolas\ Hybrid:h9
"set guifont=Consolas:h12
"set guifont=YaHei\ Consolas\ Hybrid:h12
"set guifont=Yahei\ Mono:h12
" add to .vimrc
Bundle 'flazz/vim-colorschemes'
" set for powerline
Bundle 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
Bundle 'altercation/vim-colors-solarized'
Bundle 'scrooloose/nerdtree'
Bundle 'vbundles/ctrlp'
" set color
colo Monokai
" 自动加载视图
autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent loadview
" 下面是关于自动缩进的控制,不喜欢自动缩进可以关掉。
"Auto indent
"set ai
" Smart indet
"set si
" C-style indeting
"set cindent
" Markdown||自动读取md文件并给予颜色高亮
au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,README.md setf markdown
" lazy ':'|映射\到:
map \ :
" For powerline
Bundle "Lokaltog/vim-powerline"
" Use with git to install the font
set laststatus=2
let g:Powerline_symbols='unicode'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment