vim 插件管理

1  进入自己的vim mkdir ./bundle/vundle

2  在vimrc同级中执行 git clone https://github.com/gmarik/vundle.git ./bundle/vundle   将一些插件文件 下载到./bundle/vundle中

3  编写自己的vim配置,其实很简单

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=/Applications/MacVim.app/Contents/Resources/vim/bundle/vundle/ "我这是macvim 我试了我这边写绝对路径就没有问题;这个就是runtimepath 的缩写
call vundle#begin()

" let Vundle manage Vundle, required  这下面三个就是插件啦。其实在github 中你如果找到其他插件,安装下面格式加在下面即可
Plugin 'gmarik/Vundle.vim'
Plugin 'fatih/vim-go'
Plugin 'scrooloose/nerdtree'

"例如:Plugin 'xxx/xxx'
" All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required nmap :NERDTreeToggle  "这个就是配置nerdtree的使用 就是按f5就出来了

这些配完了打开vim 命令行模式中输入PluginInstall即可安装上面三个插件

然后安装的nerdtree的按f5就可以看到效果了

注意vimr配置中  set rtp+=/Applications/MacVim.app/Contents/Resources/vim/bundle/vundle/  后面的地址要正确

 自动补全:

'msanders/snipmate.vim'

Plugin 'msanders/snipmate.vim'

自动补全设置:/Users/lijundong/.vim/bundle/snipmate.vim/snippets

代码提示

'Valloric/YouCompleteMe' 

 代码提示这个装的很艰辛

环境windows
    1:先查看vim版本,我的8.0
        :version
    1.1
      查看vim是否支持python;:echo has('python')
2:装python2.7 32位;将路径添加到环境变量中; 3:装vs2015;将路径添加到环境变量中 4:在vimrc中添加YouCompleteMe;PluginInstall 安装 5:vimrs中添加 "必须加 其他编码completeme 不支持 set encoding=utf-8 set langmenu=zh_CN.UTF-8 language message zh_CN.UTF-8 set termencoding=GBK

以上为插件的设置  下面为自己的设置

source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
set guioptions-=T " 隐藏工具栏
set guioptions-=m " 隐藏菜单栏
set cursorline " 设置当前行高亮
set autoindent " 设置自动缩进
set number " 显示行数
set ignorecase " 搜索不区分大小写
winpos 0 0 " 设定窗口位置
set lines=40 columns=160 " 设置窗口大小
set transparency=10  "透明度
colorscheme molokai "主题 前提是要你要这个主题啊
set syntax=on   "语法高亮
" 带有如下符号的单词不要被换行分割
set iskeyword+=_,$,@,%,#,-

编码设置

set enc=utf-8

set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936

这个不清楚

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 =~ '\ ' . arg3 . eq
endfunction

主题设置:在vimrc 同级的runtime/colors/中新建molokai.vim文件,主题代码见下:

molokai主题代码

" Vim color file
"
" Author: Tomas Restrepo 
" https://github.com/tomasr/molokai
"
" Note: Based on the Monokai theme for TextMate
" by Wimer Hazenberg and its darker variant
" by Hamish Stuart Macpherson
"

hi clear

if version > 580
    " no guarantees for version 5.8 and below, but this makes it stop
    " complaining
    hi clear
    if exists("syntax_on")
        syntax reset
    endif
endif
let g:colors_name="molokai"

if exists("g:molokai_original")
    let s:molokai_original = g:molokai_original
else
    let s:molokai_original = 0
endif


hi Boolean         guifg=#AE81FF
hi Character       guifg=#E6DB74
hi Number          guifg=#AE81FF
hi String          guifg=#E6DB74
hi Conditional     guifg=#F92672               gui=bold
hi Constant        guifg=#AE81FF               gui=bold
hi Cursor          guifg=#000000 guibg=#F8F8F0
hi iCursor         guifg=#000000 guibg=#F8F8F0
hi Debug           guifg=#BCA3A3               gui=bold
hi Define          guifg=#66D9EF
hi Delimiter       guifg=#8F8F8F
hi DiffAdd                       guibg=#13354A
hi DiffChange      guifg=#89807D guibg=#4C4745
hi DiffDelete      guifg=#960050 guibg=#1E0010
hi DiffText                      guibg=#4C4745 gui=italic,bold

hi Directory       guifg=#A6E22E               gui=bold
hi Error           guifg=#E6DB74 guibg=#1E0010
hi ErrorMsg        guifg=#F92672 guibg=#232526 gui=bold
hi Exception       guifg=#A6E22E               gui=bold
hi Float           guifg=#AE81FF
hi FoldColumn      guifg=#465457 guibg=#000000
hi Folded          guifg=#465457 guibg=#000000
hi Function        guifg=#A6E22E
hi Identifier      guifg=#FD971F
hi Ignore          guifg=#808080 guibg=bg
hi IncSearch       guifg=#C4BE89 guibg=#000000

hi Keyword         guifg=#F92672               gui=bold
hi Label           guifg=#E6DB74               gui=none
hi Macro           guifg=#C4BE89               gui=italic
hi SpecialKey      guifg=#66D9EF               gui=italic

hi MatchParen      guifg=#000000 guibg=#FD971F gui=bold
hi ModeMsg         guifg=#E6DB74
hi MoreMsg         guifg=#E6DB74
hi Operator        guifg=#F92672

" complete menu
hi Pmenu           guifg=#66D9EF guibg=#000000
hi PmenuSel                      guibg=#808080
hi PmenuSbar                     guibg=#080808
hi PmenuThumb      guifg=#66D9EF

hi PreCondit       guifg=#A6E22E               gui=bold
hi PreProc         guifg=#A6E22E
hi Question        guifg=#66D9EF
hi Repeat          guifg=#F92672               gui=bold
hi Search          guifg=#000000 guibg=#FFE792
" marks
hi SignColumn      guifg=#A6E22E guibg=#232526
hi SpecialChar     guifg=#F92672               gui=bold
hi SpecialComment  guifg=#7E8E91               gui=bold
hi Special         guifg=#66D9EF guibg=bg      gui=italic
if has("spell")
    hi SpellBad    guisp=#FF0000 gui=undercurl
    hi SpellCap    guisp=#7070F0 gui=undercurl
    hi SpellLocal  guisp=#70F0F0 gui=undercurl
    hi SpellRare   guisp=#FFFFFF gui=undercurl
endif
hi Statement       guifg=#F92672               gui=bold
hi StatusLine      guifg=#455354 guibg=fg
hi StatusLineNC    guifg=#808080 guibg=#080808
hi StorageClass    guifg=#FD971F               gui=italic
hi Structure       guifg=#66D9EF
hi Tag             guifg=#F92672               gui=italic
hi Title           guifg=#ef5939
hi Todo            guifg=#FFFFFF guibg=bg      gui=bold

hi Typedef         guifg=#66D9EF
hi Type            guifg=#66D9EF               gui=none
hi Underlined      guifg=#808080               gui=underline

hi VertSplit       guifg=#808080 guibg=#080808 gui=bold
hi VisualNOS                     guibg=#403D3D
hi Visual                        guibg=#403D3D
hi WarningMsg      guifg=#FFFFFF guibg=#333333 gui=bold
hi WildMenu        guifg=#66D9EF guibg=#000000

hi TabLineFill     guifg=#1B1D1E guibg=#1B1D1E
hi TabLine         guibg=#1B1D1E guifg=#808080 gui=none

if s:molokai_original == 1
   hi Normal          guifg=#F8F8F2 guibg=#272822
   hi Comment         guifg=#75715E
   hi CursorLine                    guibg=#3E3D32
   hi CursorLineNr    guifg=#FD971F               gui=none
   hi CursorColumn                  guibg=#3E3D32
   hi ColorColumn                   guibg=#3B3A32
   hi LineNr          guifg=#BCBCBC guibg=#3B3A32
   hi NonText         guifg=#75715E
   hi SpecialKey      guifg=#75715E
else
   hi Normal          guifg=#F8F8F2 guibg=#1B1D1E
   hi Comment         guifg=#7E8E91
   hi CursorLine                    guibg=#293739
   hi CursorLineNr    guifg=#FD971F               gui=none
   hi CursorColumn                  guibg=#293739
   hi ColorColumn                   guibg=#232526
   hi LineNr          guifg=#465457 guibg=#232526
   hi NonText         guifg=#465457
   hi SpecialKey      guifg=#465457
end

"
" Support for 256-color terminal
"
if &t_Co > 255
   if s:molokai_original == 1
      hi Normal                   ctermbg=234
      hi CursorLine               ctermbg=235   cterm=none
      hi CursorLineNr ctermfg=208               cterm=none
   else
      hi Normal       ctermfg=252 ctermbg=233
      hi CursorLine               ctermbg=234   cterm=none
      hi CursorLineNr ctermfg=208               cterm=none
   endif
   hi Boolean         ctermfg=135
   hi Character       ctermfg=144
   hi Number          ctermfg=135
   hi String          ctermfg=144
   hi Conditional     ctermfg=161               cterm=bold
   hi Constant        ctermfg=135               cterm=bold
   hi Cursor          ctermfg=16  ctermbg=253
   hi Debug           ctermfg=225               cterm=bold
   hi Define          ctermfg=81
   hi Delimiter       ctermfg=241

   hi DiffAdd                     ctermbg=24
   hi DiffChange      ctermfg=181 ctermbg=239
   hi DiffDelete      ctermfg=162 ctermbg=53
   hi DiffText                    ctermbg=102 cterm=bold

   hi Directory       ctermfg=118               cterm=bold
   hi Error           ctermfg=219 ctermbg=89
   hi ErrorMsg        ctermfg=199 ctermbg=16    cterm=bold
   hi Exception       ctermfg=118               cterm=bold
   hi Float           ctermfg=135
   hi FoldColumn      ctermfg=67  ctermbg=16
   hi Folded          ctermfg=67  ctermbg=16
   hi Function        ctermfg=118
   hi Identifier      ctermfg=208               cterm=none
   hi Ignore          ctermfg=244 ctermbg=232
   hi IncSearch       ctermfg=193 ctermbg=16

   hi keyword         ctermfg=161               cterm=bold
   hi Label           ctermfg=229               cterm=none
   hi Macro           ctermfg=193
   hi SpecialKey      ctermfg=81

   hi MatchParen      ctermfg=233  ctermbg=208 cterm=bold
   hi ModeMsg         ctermfg=229
   hi MoreMsg         ctermfg=229
   hi Operator        ctermfg=161

   " complete menu
   hi Pmenu           ctermfg=81  ctermbg=16
   hi PmenuSel        ctermfg=255 ctermbg=242
   hi PmenuSbar                   ctermbg=232
   hi PmenuThumb      ctermfg=81

   hi PreCondit       ctermfg=118               cterm=bold
   hi PreProc         ctermfg=118
   hi Question        ctermfg=81
   hi Repeat          ctermfg=161               cterm=bold
   hi Search          ctermfg=0   ctermbg=222   cterm=NONE

   " marks column
   hi SignColumn      ctermfg=118 ctermbg=235
   hi SpecialChar     ctermfg=161               cterm=bold
   hi SpecialComment  ctermfg=245               cterm=bold
   hi Special         ctermfg=81
   if has("spell")
       hi SpellBad                ctermbg=52
       hi SpellCap                ctermbg=17
       hi SpellLocal              ctermbg=17
       hi SpellRare  ctermfg=none ctermbg=none  cterm=reverse
   endif
   hi Statement       ctermfg=161               cterm=bold
   hi StatusLine      ctermfg=238 ctermbg=253
   hi StatusLineNC    ctermfg=244 ctermbg=232
   hi StorageClass    ctermfg=208
   hi Structure       ctermfg=81
   hi Tag             ctermfg=161
   hi Title           ctermfg=166
   hi Todo            ctermfg=231 ctermbg=232   cterm=bold

   hi Typedef         ctermfg=81
   hi Type            ctermfg=81                cterm=none
   hi Underlined      ctermfg=244               cterm=underline

   hi VertSplit       ctermfg=244 ctermbg=232   cterm=bold
   hi VisualNOS                   ctermbg=238
   hi Visual                      ctermbg=235
   hi WarningMsg      ctermfg=231 ctermbg=238   cterm=bold
   hi WildMenu        ctermfg=81  ctermbg=16

   hi Comment         ctermfg=59
   hi CursorColumn                ctermbg=236
   hi ColorColumn                 ctermbg=236
   hi LineNr          ctermfg=250 ctermbg=236
   hi NonText         ctermfg=59

   hi SpecialKey      ctermfg=59

   if exists("g:rehash256") && g:rehash256 == 1
       hi Normal       ctermfg=252 ctermbg=234
       hi CursorLine               ctermbg=236   cterm=none
       hi CursorLineNr ctermfg=208               cterm=none

       hi Boolean         ctermfg=141
       hi Character       ctermfg=222
       hi Number          ctermfg=141
       hi String          ctermfg=222
       hi Conditional     ctermfg=197               cterm=bold
       hi Constant        ctermfg=141               cterm=bold

       hi DiffDelete      ctermfg=125 ctermbg=233

       hi Directory       ctermfg=154               cterm=bold
       hi Error           ctermfg=222 ctermbg=233
       hi Exception       ctermfg=154               cterm=bold
       hi Float           ctermfg=141
       hi Function        ctermfg=154
       hi Identifier      ctermfg=208

       hi Keyword         ctermfg=197               cterm=bold
       hi Operator        ctermfg=197
       hi PreCondit       ctermfg=154               cterm=bold
       hi PreProc         ctermfg=154
       hi Repeat          ctermfg=197               cterm=bold

       hi Statement       ctermfg=197               cterm=bold
       hi Tag             ctermfg=197
       hi Title           ctermfg=203
       hi Visual                      ctermbg=238

       hi Comment         ctermfg=244
       hi LineNr          ctermfg=239 ctermbg=235
       hi NonText         ctermfg=239
       hi SpecialKey      ctermfg=239
   endif
end

" Must be at the end, because of ctermbg=234 bug.
" https://groups.google.com/forum/#!msg/vim_dev/afPqwAFNdrU/nqh6tOM87QUJ
set background=dark

如果对vundle的配置是这样:

"设置vundle
set nocompatible " be iMproved
filetype off " required!
set rtp+=/Applications/MacVim.app/Contents/Resources/vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'godlygeek/tabular'
Bundle 'L9'
Bundle 'FuzzyFinder'
" non github repos ,非git的访问地址的,格式如下:
Bundle 'git://git.wincent.com/command-t.git'
Bundle "scrooloose/nerdtree"

filetype plugin indent on " required!
"可以在vim中执行的一些命令
" Brief help
" :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..

nmap  :NERDTreeToggle
"vundle 设置完毕

在打开vim 后安装插件是在命令行BundleInstall=>安装;BundleList=>已装插件;BundleSearch=>搜索;BundleClear=>删除

取消搜索后的高亮

:noh

这里有比较全的配置;但有些可能没有,有些可能错误,仅供参考

"""""""""""""""""""
" 显示相关 
"""""""""""""""""""
"set shortmess=atI " 启动的时候不显示那个援助乌干达儿童的提示 
"winpos 5 5 " 设定窗口位置 
"set lines=40 columns=155 " 设定窗口大小 
"set nu " 显示行号 
set go= " 不要图形按钮 
"color asmanian2 " 设置背景主题 
set guifont=Courier_New:h10:cANSI " 设置字体 
"syntax on " 语法高亮 
autocmd InsertLeave * se nocul " 用浅色高亮当前行 
autocmd InsertEnter * se cul " 用浅色高亮当前行 
"set ruler " 显示标尺 
set showcmd " 输入的命令显示出来,看的清楚些 
"set cmdheight=1 " 命令行(在状态行下)的高度,设置为1 
"set whichwrap+=<,>,h,l " 允许backspace和光标键跨越行边界(不建议) 
"set scrolloff=3 " 光标移动到buffer的顶部和底部时保持3行距离 
set novisualbell " 不要闪烁(不明白) 
autocmd GUIEnter * simalt ~x "全屏
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")} "状态行显示的内容

set laststatus=1 " 启动显示状态行(1),总是显示状态行(2)
set foldenable " 允许折叠 
set foldmethod=manual " 手动折叠 
"set background=dark "背景使用黑色 
set nocompatible "去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限 
" 显示中文帮助
if version >= 603
set helplang=cn
set encoding=utf-8
endif
" 设置配色方案
"colorscheme murphy
"字体 
"if (has("gui_running")) 
" set guifont=Bitstream\ Vera\ Sans\ Mono\ 10 
"endif
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936
set fileencoding=utf-8
"""""""""""""""""""""""""
"""""新文件标题""""""""""
"新建.c,.h,.sh,.java文件,自动插入文件头 
autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()" 
""定义函数SetTitle,自动插入文件头 
func SetTitle() 
"如果文件类型为.sh文件 
if &filetype == 'sh' 
call setline(1,"\#########################################################################") 
call append(line("."), "\# File Name: ".expand("%")) 
call append(line(".")+1, "\# Author: test") 
call append(line(".")+2, "\# mail: [email protected]") 
call append(line(".")+3, "\# Created Time: ".strftime("%c")) 
call append(line(".")+4, "\#########################################################################") 
call append(line(".")+5, "\#!/bin/bash") 
call append(line(".")+6, "") 
else 
call setline(1, "/*************************************************************************") 
call append(line("."), " > File Name: ".expand("%")) 
call append(line(".")+1, " > Author: test") 
call append(line(".")+2, " > Mail: [email protected] ") 
call append(line(".")+3, " > Created Time: ".strftime("%c")) 
call append(line(".")+4, " ************************************************************************/") 
call append(line(".")+5, "")
endif
if &filetype == 'cpp'
call append(line(".")+6, "#include")
call append(line(".")+7, "using namespace std;")
call append(line(".")+8, "")
endif
if &filetype == 'c'
call append(line(".")+6, "#include")
call append(line(".")+7, "")
endif
"新建文件后,自动定位到文件末尾
autocmd BufNewFile * normal G
endfunc 
"""""""""""""""""""""""""""""""
"键盘命令
"""""""""""""""""""""""""""""""
nmap w :w!
nmap f :find
" 映射全选+复制 ctrl+a
map  ggVGY
map!  ggVGY
map  gg=G
" 选中状态下 Ctrl+c 复制
vmap  "+y
"去空行 
nnoremap  :g/^\s*$/d 
"比较文件 
nnoremap  :vert diffsplit 
"新建标签 
map  :tabnew 
"列出当前目录文件 
map  :tabnew . 
"打开树状文件目录 
map  \be 
"C,C++ 按F5编译运行
map  :call CompileRunGcc()
func! CompileRunGcc()
exec "w"
if &filetype == 'c'
exec "!g++ % -o %<"
exec "! ./%<"
elseif &filetype == 'cpp'
exec "!g++ % -o %<"
exec "! ./%<"
elseif &filetype == 'java' 
exec "!javac %" 
exec "!java %<"
elseif &filetype == 'sh'
:!./%
endif
endfunc
"C,C++的调试
map  :call Rungdb()
func! Rungdb()
exec "w"
exec "!g++ % -g -o %<"
exec "!gdb ./%<"
endfunc
""""""""""""""""""""""""
""实用设置
""""""""""""""""""""""""
" 设置当文件被改动时自动载入
set autoread
" quickfix模式
autocmd FileType c,cpp map   :w:make
"代码补全 
set completeopt=preview,menu 
"允许插件 
filetype plugin on
"共享剪贴板 
set clipboard+=unnamed 
"从不备份 
set nobackup
"make 运行
:set makeprg=g++\ -Wall\ \ %
"自动保存
set autowrite
set ruler " 打开状态栏标尺
set cursorline " 突出显示当前行
set magic " 设置魔术
set guioptions-=T " 隐藏工具栏
set guioptions-=m " 隐藏菜单栏
"set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ %{&encoding}\ %c:%l/%L%)\
" 设置在状态行显示的信息
set foldcolumn=0
set foldmethod=indent 
set foldlevel=3 
set foldenable " 开始折叠
" 不要使用vi的键盘模式,而是vim自己的
set nocompatible
" 语法高亮
set syntax=on
" 去掉输入错误的提示声音
set noeb
" 在处理未保存或只读文件的时候,弹出确认
set confirm
" 自动缩进
set autoindent
set cindent
" Tab键的宽度
set tabstop=4
" 统一缩进为4
set softtabstop=4
set shiftwidth=4
" 不要用空格代替制表符
set noexpandtab
" 在行和段开始处使用制表符
set smarttab
" 显示行号
set number
" 历史记录数
set history=1000
"禁止生成临时文件
set nobackup
set noswapfile
"搜索忽略大小写
set ignorecase
"搜索逐字符高亮
set hlsearch
set incsearch
"行内替换
set gdefault
"编码设置
set enc=utf-8
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
"语言设置
set langmenu=zh_CN.UTF-8
set helplang=cn
" 我的状态行显示的内容(包括文件类型和解码)
"set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")}
"set statusline=[%F]%y%r%m%*%=[Line:%l/%L,Column:%c][%p%%]
" 总是显示状态行
set laststatus=2
" 命令行(在状态行下)的高度,默认为1,这里是2
set cmdheight=2
" 侦测文件类型
filetype on
" 载入文件类型插件
filetype plugin on
" 为特定文件类型载入相关缩进文件
filetype indent on
" 保存全局变量
set viminfo+=!
" 带有如下符号的单词不要被换行分割
set iskeyword+=_,$,@,%,#,-
" 字符间插入的像素行数目
set linespace=0
" 增强模式中的命令行自动完成操作
set wildmenu
" 使回格键(backspace)正常处理indent, eol, start等
set backspace=2
" 允许backspace和光标键跨越行边界
set whichwrap+=<,>,h,l
" 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位)
set mouse=a
set selection=exclusive
set selectmode=mouse,key
" 通过使用: commands命令,告诉我们文件的哪一行被改变过
set report=0
" 在被分割的窗口间显示空白,便于阅读
set fillchars=vert:\ ,stl:\ ,stlnc:\
" 高亮显示匹配的括号
set showmatch
" 匹配括号高亮的时间(单位是十分之一秒)
set matchtime=1
" 光标移动到buffer的顶部和底部时保持3行距离
set scrolloff=3
" 为C程序提供自动缩进
set smartindent
" 高亮显示普通txt文件(需要txt.vim脚本)
au BufRead,BufNewFile * setfiletype txt
"自动补全
:inoremap ( ()i
:inoremap ) =ClosePair(')')
:inoremap { {}O
:inoremap } =ClosePair('}')
:inoremap [ []i
:inoremap ] =ClosePair(']')
:inoremap " ""i
:inoremap ' ''i
function! ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\"
else
return a:char
endif
endfunction
filetype plugin indent on 
"打开文件类型检测, 加了这句才可以用智能补全
set completeopt=longest,menu
""""""""""""""""""""""""""""""""
" CTags的设定 
""""""""""""""""""""""""""""""""
let Tlist_Sort_Type = "name" " 按照名称排序 
let Tlist_Use_Right_Window = 1 " 在右侧显示窗口 
let Tlist_Compart_Format = 1 " 压缩方式 
let Tlist_Exist_OnlyWindow = 1 " 如果只有一个buffer,kill窗口也kill掉buffer 
let Tlist_File_Fold_Auto_Close = 0 " 不要关闭其他文件的tags 
let Tlist_Enable_Fold_Column = 0 " 不要显示折叠树 
autocmd FileType java set tags+=D:\tools\java\tags 
"autocmd FileType h,cpp,cc,c set tags+=D:\tools\cpp\tags 
"let Tlist_Show_One_File=1 "不同时显示多个文件的tag,只显示当前文件的
"设置tags 
set tags=tags 
"set autochdir
"""""""""""""""""""""""""
"其他东东
"""""""""""""""""""""""""
"默认打开Taglist 
let Tlist_Auto_Open=1 
"""""""""""""""""""""""""""""" 
" Tag list (ctags) 
"""""""""""""""""""""""""""""""" 
let Tlist_Ctags_Cmd = '/usr/bin/ctags' 
let Tlist_Show_One_File = 1 "不同时显示多个文件的tag,只显示当前文件的 
let Tlist_Exit_OnlyWindow = 1 "如果taglist窗口是最后一个窗口,则退出vim 
let Tlist_Use_Right_Window = 1 "在右侧窗口中显示taglist窗口
" minibufexpl插件的一般设置
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1

 默认全屏:Windows 成功;Mac没有试

Mac

if has("gui_running")
  " GUI is running or is about to start.
  " Maximize gvim window (for an alternative on Windows, see simalt below).
  set lines=999 columns=999
else
  " This is console Vim.
  if exists("+lines")
    set lines=50
  endif
  if exists("+columns")
    set columns=100
  endif
endif

Windows

autocmd GUIEnter * simalt ~x

 贴上我windows上vimrc 配置

set nocompatible              " be iMproved, required
"filetype off                  " required

set rtp+=$VIM/vimfiles/bundle/Vundle.vim
"插件的安装路径
call vundle#begin('$VIM/vimfiles/bundle/')

Plugin 'gmarik/Vundle.vim'
Plugin 'L9'
Plugin 'msanders/snipmate.vim'
Plugin 'majutsushi/tagbar'
Plugin 'scrooloose/nerdtree'
Plugin 'Valloric/YouCompleteMe'

call vundle#end()
filetype plugin indent on
nmap  :NERDTreeToggle  "这个就是配置nerdtree的使用  就是按f几就出来了

"tagbar 配置
"
nmap tb :TagbarToggle
let g:tagbar_ctags_bin='ctags'
let g:tagbar_width=30
map  :Tagbar
autocmd BufReadPost *.cpp,*.c,*.h,*.hpp,*.cc,*.cxx,*.php call tagbar#autoopen()


source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
set guioptions-=T " 隐藏工具栏
set guioptions-=m " 隐藏菜单栏
set guioptions-=r " 隐藏滚动条
set guifont=Source_Code_Pro:h10 " 设置字体为  字体:大小
set cursorline " 设置当前行高亮
set autoindent " 设置自动缩进
set number " 显示行数
winpos 0 0 " 设定窗口位置
"set lines=45 columns=170 " 设置窗口大小
autocmd GUIEnter * simalt ~x
"set background=light
"set background=dark 
colorscheme evening "主题 前提是要你要这个主题啊
set syntax=on   "语法高亮
" 带有如下符号的单词不要被换行分割
set iskeyword+=_,$,@,%,#,-

set noswapfile
set nobackup
set ignorecase "忽略大小写

" Tab键的宽度
set tabstop=4
" 统一缩进为4
set softtabstop=4
set shiftwidth=4

"必须加 其他编码completeme 不支持
set encoding=utf-8
set langmenu=zh_CN.UTF-8
language message zh_CN.UTF-8
set termencoding=GBK

"右击是显示中文正常
"set encoding=utf-8
"set fileencodings=utf-8,chinese,latin-1
if has("win32")
set fileencoding=chinese
else
set fileencoding=utf-8
endif
"解决菜单乱码

source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"解决consle输出乱码
language messages zh_CN.utf-8

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 =~ '\ ' . arg3 . eq
endfunction

你可能感兴趣的:(定位,python,vim,windows,mac)