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 <F5> :NERDTreeToggle<cr> "这个就是配置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
:先查看vim版本,我的8.0
:version
1.1
查看vim是否支持python;:echo has('python')
:装python2. 32位;将路径添加到环境变量中;
:装vs2015;将路径添加到环境变量中
:在vimrc中添加YouCompleteMe;PluginInstall 安装
:vimrs中添加
"必须加 其他编码completeme 不支持
set encoding=utf-
set langmenu=zh_CN.UTF-
language message zh_CN.UTF-
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 " 设定窗口位置
set lines= columns= " 设置窗口大小
set transparency= "透明度
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 =~ '\<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
主题设置:在vimrc 同级的runtime/colors/中新建molokai.vim文件,主题代码见下:
molokai主题代码
" Vim color file
"
" Author: Tomas Restrepo <tomas@winterdom.com>
" 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 >
" 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 =
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=# guibg=#F8F8F0
hi iCursor guifg=# 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=# 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=# gui=bold
hi Exception guifg=#A6E22E gui=bold
hi Float guifg=#AE81FF
hi FoldColumn guifg=# guibg=#
hi Folded guifg=# guibg=#
hi Function guifg=#A6E22E
hi Identifier guifg=#FD971F
hi Ignore guifg=# guibg=bg
hi IncSearch guifg=#C4BE89 guibg=# 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=# guibg=#FD971F gui=bold
hi ModeMsg guifg=#E6DB74
hi MoreMsg guifg=#E6DB74
hi Operator guifg=#F92672 " complete menu
hi Pmenu guifg=#66D9EF guibg=#
hi PmenuSel guibg=#
hi PmenuSbar guibg=#
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=# guibg=#FFE792
" marks
hi SignColumn guifg=#A6E22E guibg=#
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=# guibg=fg
hi StatusLineNC guifg=# guibg=#
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=# gui=underline hi VertSplit guifg=# guibg=# gui=bold
hi VisualNOS guibg=#403D3D
hi Visual guibg=#403D3D
hi WarningMsg guifg=#FFFFFF guibg=# gui=bold
hi WildMenu guifg=#66D9EF guibg=# hi TabLineFill guifg=#1B1D1E guibg=#1B1D1E
hi TabLine guibg=#1B1D1E guifg=# gui=none if s:molokai_original ==
hi Normal guifg=#F8F8F2 guibg=#
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=#
hi CursorLineNr guifg=#FD971F gui=none
hi CursorColumn guibg=#
hi ColorColumn guibg=#
hi LineNr guifg=# guibg=#
hi NonText guifg=#
hi SpecialKey guifg=#
end "
" Support for 256-color terminal
"
if &t_Co >
if s:molokai_original ==
hi Normal ctermbg=
hi CursorLine ctermbg= cterm=none
hi CursorLineNr ctermfg= cterm=none
else
hi Normal ctermfg= ctermbg=
hi CursorLine ctermbg= cterm=none
hi CursorLineNr ctermfg= cterm=none
endif
hi Boolean ctermfg=
hi Character ctermfg=
hi Number ctermfg=
hi String ctermfg=
hi Conditional ctermfg= cterm=bold
hi Constant ctermfg= cterm=bold
hi Cursor ctermfg= ctermbg=
hi Debug ctermfg= cterm=bold
hi Define ctermfg=
hi Delimiter ctermfg= hi DiffAdd ctermbg=
hi DiffChange ctermfg= ctermbg=
hi DiffDelete ctermfg= ctermbg=
hi DiffText ctermbg= cterm=bold hi Directory ctermfg= cterm=bold
hi Error ctermfg= ctermbg=
hi ErrorMsg ctermfg= ctermbg= cterm=bold
hi Exception ctermfg= cterm=bold
hi Float ctermfg=
hi FoldColumn ctermfg= ctermbg=
hi Folded ctermfg= ctermbg=
hi Function ctermfg=
hi Identifier ctermfg= cterm=none
hi Ignore ctermfg= ctermbg=
hi IncSearch ctermfg= ctermbg= hi keyword ctermfg= cterm=bold
hi Label ctermfg= cterm=none
hi Macro ctermfg=
hi SpecialKey ctermfg= hi MatchParen ctermfg= ctermbg= cterm=bold
hi ModeMsg ctermfg=
hi MoreMsg ctermfg=
hi Operator ctermfg= " complete menu
hi Pmenu ctermfg= ctermbg=
hi PmenuSel ctermfg= ctermbg=
hi PmenuSbar ctermbg=
hi PmenuThumb ctermfg= hi PreCondit ctermfg= cterm=bold
hi PreProc ctermfg=
hi Question ctermfg=
hi Repeat ctermfg= cterm=bold
hi Search ctermfg= ctermbg= cterm=NONE " marks column
hi SignColumn ctermfg= ctermbg=
hi SpecialChar ctermfg= cterm=bold
hi SpecialComment ctermfg= cterm=bold
hi Special ctermfg=
if has("spell")
hi SpellBad ctermbg=
hi SpellCap ctermbg=
hi SpellLocal ctermbg=
hi SpellRare ctermfg=none ctermbg=none cterm=reverse
endif
hi Statement ctermfg= cterm=bold
hi StatusLine ctermfg= ctermbg=
hi StatusLineNC ctermfg= ctermbg=
hi StorageClass ctermfg=
hi Structure ctermfg=
hi Tag ctermfg=
hi Title ctermfg=
hi Todo ctermfg= ctermbg= cterm=bold hi Typedef ctermfg=
hi Type ctermfg= cterm=none
hi Underlined ctermfg= cterm=underline hi VertSplit ctermfg= ctermbg= cterm=bold
hi VisualNOS ctermbg=
hi Visual ctermbg=
hi WarningMsg ctermfg= ctermbg= cterm=bold
hi WildMenu ctermfg= ctermbg= hi Comment ctermfg=
hi CursorColumn ctermbg=
hi ColorColumn ctermbg=
hi LineNr ctermfg= ctermbg=
hi NonText ctermfg= hi SpecialKey ctermfg= if exists("g:rehash256") && g:rehash256 ==
hi Normal ctermfg= ctermbg=
hi CursorLine ctermbg= cterm=none
hi CursorLineNr ctermfg= cterm=none hi Boolean ctermfg=
hi Character ctermfg=
hi Number ctermfg=
hi String ctermfg=
hi Conditional ctermfg= cterm=bold
hi Constant ctermfg= cterm=bold hi DiffDelete ctermfg= ctermbg= hi Directory ctermfg= cterm=bold
hi Error ctermfg= ctermbg=
hi Exception ctermfg= cterm=bold
hi Float ctermfg=
hi Function ctermfg=
hi Identifier ctermfg= hi Keyword ctermfg= cterm=bold
hi Operator ctermfg=
hi PreCondit ctermfg= cterm=bold
hi PreProc ctermfg=
hi Repeat ctermfg= cterm=bold hi Statement ctermfg= cterm=bold
hi Tag ctermfg=
hi Title ctermfg=
hi Visual ctermbg= hi Comment ctermfg=
hi LineNr ctermfg= ctermbg=
hi NonText ctermfg=
hi SpecialKey ctermfg=
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 <F5> :NERDTreeToggle<cr>
"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),总是显示状态行(2)
set foldenable " 允许折叠
set foldmethod=manual " 手动折叠
"set background=dark "背景使用黑色
set nocompatible "去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限
" 显示中文帮助
if version >=
set helplang=cn
set encoding=utf-
endif
" 设置配色方案
"colorscheme murphy
"字体
"if (has("gui_running"))
" set guifont=Bitstream\ Vera\ Sans\ Mono\ 10
"endif
set fencs=utf-,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
set termencoding=utf-
set encoding=utf-
set fileencodings=ucs-bom,utf-,cp936
set fileencoding=utf-
"""""""""""""""""""""""""
"""""新文件标题""""""""""
"新建.c,.h,.sh,.java文件,自动插入文件头
autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()"
""定义函数SetTitle,自动插入文件头
func SetTitle()
"如果文件类型为.sh文件
if &filetype == 'sh'
call setline(,"\#########################################################################")
call append(line("."), "\# File Name: ".expand("%"))
call append(line(".")+, "\# Author: test")
call append(line(".")+, "\# mail: <a href="mailto:test@jbxue.com">test@jbxue.com</a>")
call append(line(".")+, "\# Created Time: ".strftime("%c"))
call append(line(".")+, "\#########################################################################")
call append(line(".")+, "\#!/bin/bash")
call append(line(".")+, "")
else
call setline(, "/*************************************************************************")
call append(line("."), " > File Name: ".expand("%"))
call append(line(".")+, " > Author: test")
call append(line(".")+, " > Mail: <a href="mailto:test@jbxue.com">test@jbxue.com</a> ")
call append(line(".")+, " > Created Time: ".strftime("%c"))
call append(line(".")+, " ************************************************************************/")
call append(line(".")+, "")
endif
if &filetype == 'cpp'
call append(line(".")+, "#include<iostream>")
call append(line(".")+, "using namespace std;")
call append(line(".")+, "")
endif
if &filetype == 'c'
call append(line(".")+, "#include<stdio.h>")
call append(line(".")+, "")
endif
"新建文件后,自动定位到文件末尾
autocmd BufNewFile * normal G
endfunc
"""""""""""""""""""""""""""""""
"键盘命令
"""""""""""""""""""""""""""""""
nmap <leader>w :w!<cr>
nmap <leader>f :find<cr>
" 映射全选+复制 ctrl+a
map <C-A> ggVGY
map! <C-A> <Esc>ggVGY
map <F12> gg=G
" 选中状态下 Ctrl+c 复制
vmap <C-c> "+y
"去空行
nnoremap <F2> :g/^\s*$/d<CR>
"比较文件
nnoremap <C-F2> :vert diffsplit
"新建标签
map <M-F2> :tabnew<CR>
"列出当前目录文件
map <F3> :tabnew .<CR>
"打开树状文件目录
map <C-F3> \be
"C,C++ 按F5编译运行
map <F5> :call CompileRunGcc()<CR>
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 <F8> :call Rungdb()<CR>
func! Rungdb()
exec "w"
exec "!g++ % -g -o %<"
exec "!gdb ./%<"
endfunc
""""""""""""""""""""""""
""实用设置
""""""""""""""""""""""""
" 设置当文件被改动时自动载入
set autoread
" quickfix模式
autocmd FileType c,cpp map <buffer> <leader><space> :w<cr>:make<cr>
"代码补全
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=
set foldmethod=indent
set foldlevel=
set foldenable " 开始折叠
" 不要使用vi的键盘模式,而是vim自己的
set nocompatible
" 语法高亮
set syntax=on
" 去掉输入错误的提示声音
set noeb
" 在处理未保存或只读文件的时候,弹出确认
set confirm
" 自动缩进
set autoindent
set cindent
" Tab键的宽度
set tabstop=
" 统一缩进为4
set softtabstop=
set shiftwidth=
" 不要用空格代替制表符
set noexpandtab
" 在行和段开始处使用制表符
set smarttab
" 显示行号
set number
" 历史记录数
set history=
"禁止生成临时文件
set nobackup
set noswapfile
"搜索忽略大小写
set ignorecase
"搜索逐字符高亮
set hlsearch
set incsearch
"行内替换
set gdefault
"编码设置
set enc=utf-
set fencs=utf-,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
"语言设置
set langmenu=zh_CN.UTF-
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=
" 命令行(在状态行下)的高度,默认为1,这里是2
set cmdheight=
" 侦测文件类型
filetype on
" 载入文件类型插件
filetype plugin on
" 为特定文件类型载入相关缩进文件
filetype indent on
" 保存全局变量
set viminfo+=!
" 带有如下符号的单词不要被换行分割
set iskeyword+=_,$,@,%,#,-
" 字符间插入的像素行数目
set linespace=
" 增强模式中的命令行自动完成操作
set wildmenu
" 使回格键(backspace)正常处理indent, eol, start等
set backspace=
" 允许backspace和光标键跨越行边界
set whichwrap+=<,>,h,l
" 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位)
set mouse=a
set selection=exclusive
set selectmode=mouse,key
" 通过使用: commands命令,告诉我们文件的哪一行被改变过
set report=
" 在被分割的窗口间显示空白,便于阅读
set fillchars=vert:\ ,stl:\ ,stlnc:\
" 高亮显示匹配的括号
set showmatch
" 匹配括号高亮的时间(单位是十分之一秒)
set matchtime=
" 光标移动到buffer的顶部和底部时保持3行距离
set scrolloff=
" 为C程序提供自动缩进
set smartindent
" 高亮显示普通txt文件(需要txt.vim脚本)
au BufRead,BufNewFile * setfiletype txt
"自动补全
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {<CR>}<ESC>O
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap " ""<ESC>i
:inoremap ' ''<ESC>i
function! ClosePair(char)
if getline('.')[col('.') - ] == a:char
return "\<Right>"
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 = " 在右侧显示窗口
let Tlist_Compart_Format = " 压缩方式
let Tlist_Exist_OnlyWindow = " 如果只有一个buffer,kill窗口也kill掉buffer
let Tlist_File_Fold_Auto_Close = " 不要关闭其他文件的tags
let Tlist_Enable_Fold_Column = " 不要显示折叠树
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=
""""""""""""""""""""""""""""""
" Tag list (ctags)
""""""""""""""""""""""""""""""""
let Tlist_Ctags_Cmd = '/usr/bin/ctags'
let Tlist_Show_One_File = "不同时显示多个文件的tag,只显示当前文件的
let Tlist_Exit_OnlyWindow = "如果taglist窗口是最后一个窗口,则退出vim
let Tlist_Use_Right_Window = "在右侧窗口中显示taglist窗口
" minibufexpl插件的一般设置
let g:miniBufExplMapWindowNavVim =
let g:miniBufExplMapWindowNavArrows =
let g:miniBufExplMapCTabSwitchBufs =
let g:miniBufExplModSelTarget =
默认全屏: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= columns=
else
" This is console Vim.
if exists("+lines")
set lines=
endif
if exists("+columns")
set columns=
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 <F1> :NERDTreeToggle<cr> "这个就是配置nerdtree的使用 就是按f几就出来了 "tagbar 配置
"
nmap <Leader>tb :TagbarToggle<CR>
let g:tagbar_ctags_bin='ctags'
let g:tagbar_width=
map <F2> :Tagbar<CR>
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 " 设定窗口位置
"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
set softtabstop=
set shiftwidth= "必须加 其他编码completeme 不支持
set encoding=utf-
set langmenu=zh_CN.UTF-
language message zh_CN.UTF-
set termencoding=GBK "右击是显示中文正常
"set encoding=utf-8
"set fileencodings=utf-8,chinese,latin-1
if has("win32")
set fileencoding=chinese
else
set fileencoding=utf-
endif
"解决菜单乱码 source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"解决consle输出乱码
language messages zh_CN.utf- 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