1 進入本身的vim mkdir ./bundle/vundlephp
2 在vimrc同級中執行 git clone https://github.com/gmarik/vundle.git ./bundle/vundle 將一些插件文件 下載到./bundle/vundle中java
3 編寫本身的vim配置,其實很簡單python
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便可安裝上面三個插件ios
而後安裝的nerdtree的按f5就能夠看到效果了git
注意vimr配置中 set rtp+=/Applications/MacVim.app/Contents/Resources/vim/bundle/vundle/ 後面的地址要正確github
自動補全:vim
'msanders/snipmate.vim'windows
Plugin 'msanders/snipmate.vim'
自動補全設置:/Users/lijundong/.vim/bundle/snipmate.vim/snippetsbash
代碼提示app
'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 =~ '\<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 > 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 <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 " 啓動顯示狀態行(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: <a href="mailto:test@jbxue.com">test@jbxue.com</a>") 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: <a href="mailto:test@jbxue.com">test@jbxue.com</a> ") 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<iostream>") call append(line(".")+7, "using namespace std;") call append(line(".")+8, "") endif if &filetype == 'c' call append(line(".")+6, "#include<stdio.h>") call append(line(".")+7, "") 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=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 ( ()<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('.') - 1] == 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 = 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 <F1> :NERDTreeToggle<cr> "這個就是配置nerdtree的使用 就是按f幾就出來了 "tagbar 配置 " nmap <Leader>tb :TagbarToggle<CR> let g:tagbar_ctags_bin='ctags' let g:tagbar_width=30 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 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 =~ '\<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