vim的 plug.vim的配置文件网址:
https://github.com/junegunn/vim-plug/blob/master/plug.vim
将其内容复制到 vim的安装目录下 D:\ware\Vim\vim80\autoload\
"环境变量配置
"$VIM=D:/ware/Vim/_vimrc
":so $VIM
source $VIMRUNTIME/vimrc_example.vim
behave mswin
" 函数加!符号
" function! MyDiff()
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 arg1 = substitute(arg1, '!', '\!', 'g')
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg2 = substitute(arg2, '!', '\!', 'g')
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let arg3 = substitute(arg3, '!', '\!', 'g')
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
if empty(&shellxquote)
let l:shxq_sav = ''
set shellxquote&
endif
let cmd = '"' . $VIMRUNTIME . '\diff"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
let cmd = substitute(cmd, '!', '\!', 'g')
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
if exists('l:shxq_sav')
let &shellxquote=l:shxq_sav
endif
endfunction
"*************************************************************
"" 设置字体 行距
"set guifont=Courier_new:h11:b:cDEFAULT
set guifont=Courier_new:h11:b:cDEFAULT
set linespace=10
"设置tab
set tabstop=4
"set expandtab
set noexpandtab
"setlocal shiftwidth=4 "换行自动缩进4个空格
set cindent "c语言的缩进
"set cinkeys=:,0#,!^F,o,O,e
"cinoptions=>s,e0,n0,f0,{0,}0,^0,L-1,:s,=s,l0,b0,gs,hs,N0,E0,ps,ts,is,+s,c3,C0,/0,(2s,us,U0,w0,W0,k0,m0,j0,J0,)20,*70,#0
"缩进 修改了j0改为了j0 调整javascript代码
set cinoptions=>s,e0,n0,f0,{0,}0,^0,Ls,:s,=s,l0,b0,gs,hs,N0,E0,ps,ts,is,+s,c3,C0,/0,(2s,us,U0,w0,W0,k0,m0,js,Js,)20,*70,#0
set shiftwidth=4
let g:html_indent_script1 = "inc"
let g:html_indent_style1 = "inc"
"显示行号
set nu
"允许使用鼠标
set mouse=a
"===================================================================
" Gvim中文菜单乱码解决方案
" 设置文件编码格式
set encoding=utf-8
set fileencodings=utf-8,chinese,latin-1,gbk,gb18030,gk2312
if has("win")
set fileencoding=chinese
else
set fileencoding=utf-8
endif
"解决菜单乱码
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"解决consle提示信息输出乱码
language messages zh_CN.utf-8
"如果 vim查看编码 :set fileencoding
"如果 vim设置编码 :set fileencoding=utf8
"===================================================================
"设置光标颜色
"hi CursorLine cterm=NONE ctermfg=black guifg=black
"hi Cursor guifg=#eeeeee guibg=#008700
"hi Cursor guibg=#ffd700 guifg=#000000
"hi iCursor guifg=white guibg=#32CD32
"插入模式下插入一行
inoremap <C-j> <Esc>o
"设置alt+j k移动代码的快捷键
nmap <M-j> mz:m+<cr>`z
nmap <M-k> mz:m-2<cr>`z
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
"设置快捷键空间前缀为空格
"let mapleader = "\<space>"
"设置加载vimrc的快捷键
"nnoremap <leader>sv :source $MYVIMRC<cr>
nnoremap <leader>ss :source d:/ware/Vim/_vimrc<cr>
"自动配对标点符号
inoremap ( ()<Esc>i
inoremap [ []<Esc>i
"inoremap < <><Esc>i
inoremap { {}<Esc>i
inoremap ' ''<Esc>i
inoremap " ""<Esc>i
" 在浏览器预览 for win32 vim调用chrome浏览器设置快捷键 f4+C+R
function! ViewInBrowser(name)
let file = expand("%:p")
exec ":update " . file
let l:browsers = {
\"cr":"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe",
\"ff":"D:/WebDevelopment/Browser/Firefox/Firefox.exe",
\"op":"D:/WebDevelopment/Browser/Opera/opera.exe",
\"ie":"C:/progra~1/intern~1/iexplore.exe",
\"ie6":"D:/WebDevelopment/Browser/IETester/IETester.exe -ie6",
\"ie7":"D:/WebDevelopment/Browser/IETester/IETester.exe -ie7",
\"ie8":"D:/WebDevelopment/Browser/IETester/IETester.exe -ie8",
\"ie9":"D:/WebDevelopment/Browser/IETester/IETester.exe -ie9",
\"iea":"D:/WebDevelopment/Browser/IETester/IETester.exe -all"
\}
let htdocs='E:\\apmxe\\htdocs\\'
let strpos = stridx(file, substitute(htdocs, '\\\\', '\', "g"))
if strpos == -1
exec ":silent !start ". l:browsers[a:name] ." file://" . file
else
let file=substitute(file, htdocs, "http://127.0.0.1:8090/", "g")
let file=substitute(file, '\\', '/', "g")
exec ":silent !start ". l:browsers[a:name] file
endif
endfunction
nmap <f4>cr :call ViewInBrowser("cr")<cr>
nmap <f4>ff :call ViewInBrowser("ff")<cr>
nmap <f4>op :call ViewInBrowser("op")<cr>
nmap <f4>ie :call ViewInBrowser("ie")<cr>
nmap <f4>ie6 :call ViewInBrowser("ie6")<cr>
"配置文件的目录
nnoremap <silent> <leader>. :cd %:p:h<CR>
call plug#begin('D:\ware\Vim\vim80\plugged')
Plug 'mattn/emmet-vim'
Plug 'https://github.com/vim-scripts/VisIncr.git'
Plug 'https://git::@github.com/tomtom/tcomment_vim.git'
Plug 'preservim/nerdtree'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'altercation/vim-colors-solarized'
Plug 'tpope/vim-surround'
"Plug 'Chiel92/vim-autoformat'
"Plug 'maksimr/vim-jsbeautify'
Plug 'https://git::@github.com/vim-scripts/dbext.vim.git'
Plug 'rakr/vim-one'
Plug 'mhinz/vim-janah'
Plug 'vim-perl/vim-perl', { 'for': 'perl', 'do': 'make clean carp dancer highlight-all-pragmas moose test-more try-tiny' }
Plug 'https://github.com/junegunn/vim-easy-align.git'
call plug#end()
"""""""""""""""""""""""""""""""""
""设置主题 solarized
"colorscheme one
"set background=dark " for the dark version
"set background=light " for the light version
syntax enable
"set background=light
"colorscheme solarized
let g:airline_theme='one'
colorscheme one
set background=light
let g:one_allow_italics = 1
"设置缩进 vim-indent-guides
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_auto_colors = 0
let g:indent_guides_color_change_percent = 10
hi IndentGuidesOdd guibg=#E3DDCC ctermbg=3
hi IndentGuidesEven guibg=NONE ctermbg=4
"更改快捷键 emmet
let g:user_emmet_expandabbr_key = '<C-A>'
"设置html标签成对出现 closetag
let g:closetag_html_style=1
"F3自动格式化代码 vim-autoformat
noremap <F3> :Autoformat<CR>
let g:autoformat_verbosemode=1
" f6的快捷键
" jsbeautify {
map <F6> :call JsBeautify()<cr>
" or
autocmd FileType javascript noremap <buffer> <F6> :call JsBeautify()<cr>
" for json
autocmd FileType json noremap <buffer> <F6> :call JsonBeautify()<cr>
" for jsx
autocmd FileType jsx noremap <buffer> <F6> :call JsxBeautify()<cr>
" for html
autocmd FileType html noremap <buffer> <F6> :call HtmlBeautify()<cr>
" for css or scss
autocmd FileType css noremap <buffer> <F6> :call CSSBeautify()<cr>
" }
hi Cursor guifg=black guibg=#32CD32
hi MatchParen ctermbg=Yellow guifg=white guibg=#FFD700
" 设置NerdTree
map <F3> :NERDTreeMirror<CR>
map <F3> :NERDTreeToggle<CR>
map <C-l> :tabn<CR>
map <C-h> :tabp<CR>
map <C-n> :tabnew<CR>
" 设置nerdtree目录结构始终在左边
let g:NERDTreeWinPos ="left"
" vim自动加载
set autoread
set autowriteall
"-- 设置 数据库实例名称 查询的时候 select * from emp; 标识不同的数据库实例 (推荐使用这种方式)
"let g:dbext_default_profile_ORA = 'type=ORA:user=pif:passwd=123456:host=192.168.1.40:conn_parms=orcl'
let g:dbext_default_profile_mysql_local_ODBC = 'type=ODBC:user=root:passwd=123456:dsnname=mysql'
let g:dbext_default_profile_oracle_ODBC = 'type=ODBC:user=pif:passwd=pif_2018:dsnname=oracle'
let g:dbext_default_profile = 'oracle_ODBC'
let g:dbext_default_always_prompt_for_variables=0
let g:dbext_default_DBI_max_column_width = 40
let g:dbext_default_DBI_column_delimiter = "|"
nnoremap <leader>ev :edit $MYVIMRC<cr>
augroup reload_vimrc
autocmd!
autocmd bufwritepost $MYVIMRC nested source $MYVIMRC
" autocmd bufwritepost $VIM/vimrc nested :source $VIM/vimrc
augroup END
"""设置与系统粘贴版交互的快捷键
map <C-c> "+y
map <C-v> "+p
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
"设置自动换行
set nowrap
gvim中文乱码
set fileencodings=utf-8,gb2312,gbk,gb18030
set termencoding=utf-8
"set fileformats=unix
set encoding=prc