-------------------------------------------- 2016-07-23 16:38:18 --------------------------------------------css
" ================================= FUNCTIONS ================================= 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
" unbuntu自動最大化 須要安裝wmctrl
" sudo apt-get install wmctrl function Maximize_Window() silent !wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz endfunction
"標籤頁欄中去除當前所編輯文件的路徑信息,只保留文件名 function ShortTabLabel () let bufnrlist = tabpagebuflist (v:lnum) let label = bufname (bufnrlist[tabpagewinnr (v:lnum) -1]) let filename = fnamemodify (label, ':t') return filename endfunction " 關閉當前打開的文件 function DeleteCurBuf() let l:currentBufNum = bufnr("%") if 0 == buflisted(l:currentBufNum) exec "echo \'This buffer can not delete.\'" return endif if buflisted(bufnr("#")) exec "b#" else exec "bp" endif let l:newBufNum = bufnr("%") if l:currentBufNum == l:newBufNum exec "echo \'This is the last opened file.\'" return endif exec "bw " . l:currentBufNum endfunction function WasCommented(str) let len = strlen(a:str) let i = 0 while i < len if a:str[i] != ' ' && a:str[i] != "\t" break endif let i += 1 endwhile if i < len - 1 && a:str[i] == a:str[i+1] && a:str[i] == "/" return 1 else return 0 endif endfunction function ToggleCommentLine() let nr = line('.') let str_line = getline(nr) if WasCommented(str_line) let newstr = substitute(str_line, '//', '', '') else let newstr = substitute(str_line, '^', '//', '') endif :call setline(nr, newstr) endfunction " 1 tagbar打開了,2 nerdtree打開了,3都打開了,0都沒打開 function WhichOpened() let returnValue = 0 if bufwinnr('__Tagbar__') != -1 let returnValue += 1 endif if bufwinnr('NERD_tree_1') != -1 let returnValue += 2 endif return returnValue endfunction function SwitchTagbarNERDTree() let tmp = WhichOpened() exec "NERDTreeClose" if (tmp != 2) && (tmp != 3) exec "TagbarClose" exec "NERDTreeToggle" exec "normal! \<c-w>l" else exec "TagbarOpen" endif endfunction let s:lastTNStatus = 1 function OpenCloseTagbarNERDTree() let currTNStatus = WhichOpened() exec "NERDTreeClose" if currTNStatus != 0 exec "TagbarClose" let s:lastTNStatus = currTNStatus elseif s:lastTNStatus == 1 exec "TagbarOpen" else exec "TagbarClose" exec "NERDTreeToggle" exec "normal! \<c-w>l" endif endfunction function FindFilePath() exec 'TagbarClose' exec 'NERDTreeFind' exec "normal! \<c-w>l" endfunction " This function works only on language is English. function IsQuickfixLoaded() redir => bufoutput exe "silent! buffers!" " This echo clears a bug in printing that shows up when it is not present silent! echo "" redir END return match(bufoutput, "\"\\[Quickfix List\\]\"", 0, 0) != -1 endfunction function ToggleQuickfix() if IsQuickfixLoaded() :ccl :exec "normal! \<c-w>l" else :copen :exec "normal! \<c-w>J" endif endfunction "function SetSatusLine2() " "set statusline=%4n%m\ %1*>\ %*%t%1*\ <%*\ %<%h%w%q%r%F%=%l,\ %c\ :\ %p%%%1*\|%*0x%02B%1*\|%*%{&fileformat}%1*\|%*%{&encoding} " set statusline=%4*NONINS%2*%m%5*\ %t\ %*%<%h%w%q%r%F%=<%n>\ %l,\ %c\ :\ %p%%%1*\|%*0x%02B%1*\|%*%{&fileformat}%1*\|%*%{&encoding} " au InsertEnter * set statusline=%3*INSERT%2*%m%5*\ %t\ %*%<%h%w%q%r%F%=<%n>\ %l,\ %c\ :\ %p%%%1*\|%*0x%02B%1*\|%*%{&fileformat}%1*\|%*%{&encoding} " au InsertLeave * set statusline=%4*NONINS%2*%m%5*\ %t\ %*%<%h%w%q%r%F%=<%n>\ %l,\ %c\ :\ %p%%%1*\|%*0x%02B%1*\|%*%{&fileformat}%1*\|%*%{&encoding} " set laststatus=2 "endfunction function SetSatusLine() let fix_part='%2*%m%5*\ %t\ %*%<%h%w%q%r%F%=<%n>\ %l,\ %c\ :\ %p%%%1*\|%*0x%02B%1*\|%*%{&fileformat}%1*\|%*%{&encoding}' let insert_mode='%3*INSERT' let other_mode='%4*OTHERS' exe 'set statusline=' . other_mode . fix_part exe 'au InsertEnter * set statusline=' . insert_mode . fix_part exe 'au InsertLeave * set statusline=' . other_mode . fix_part set laststatus=2 endfunction " ================================= SETTINGS ================================== set encoding=utf-8 set langmenu=zh_CN.UTF-8 "set menu's language of gvim. language messages en_US.UTF-8 set nocompatible if has("win32") source $VIMRUNTIME/vimrc_example.vim source $VIMRUNTIME/mswin.vim behave mswin set diffexpr=MyDiff() au GuiEnter * simalt ~x " 自動最大化 endif if has("gui_running") "若是在 GUI 環境下運行則設置下面語句 set guifont=Consolas:h11 "set guifont=Dejavu\ Sans\ Mono:h10 set guioptions-=T " 不顯示工具欄 set guioptions-=L " 不顯示左邊滾動條 set guioptions-=r " 不顯示右邊滾動條 set guioptions-=m set guitablabel=%{ShortTabLabel()} set vb t_vb= " 禁用響鈴提醒 au GuiEnter * set t_vb= endif set number set hlsearch set tabstop=4 set expandtab set shiftwidth=4 set autoindent set hidden " 避免當前編輯文檔未保存時,在新窗口打開文檔 set ignorecase set cursorline "set textwidth=80 " 超事後自動拆行 set colorcolumn=81 set mouse=a set completeopt=menu " 補全設置 call SetSatusLine() set nobackup set noundofile set noswapfile "set nowrap " 不拆行 "set fdm=syntax " 代碼摺疊方式 set nofoldenable " 啓動時關閉摺疊 "set syntax enable set cst " tag有多個匹配項時能夠提供選擇的機會 " 設置自動補全的單詞列表,若是沒有set complete那麼須要按<c-x><c-k>纔會出現補全, " 若是設置了set complete那麼直接使用<c-n>或<c-p>就能夠了。 set dictionary+=~/vim_autocomplete_dic.txt set complete+=k " ------------------------------ 設置快捷鍵 -------------------------------- nmap Q :call DeleteCurBuf()<cr> nmap <leader>q <c-w>c nmap <leader>b :ls<CR> nmap <leader>n :nohl<CR> nmap <leader>w :update<CR> nmap <leader>e :browse confirm e<CR> nmap <leader>c :cd if has("win32") nmap <leader>s :e c:/users/*******/_vimrc<CR> else nmap <leader>s :e ~/.vimrc<CR> endif nmap ;s <Plug>(easymotion-F) nmap ;f <Plug>(easymotion-f) nmap ;j <Plug>(easymotion-j) nmap ;k <Plug>(easymotion-k) "nmap <c-s-tab> :tabn<cr> nmap <c-s-tab> :bp<cr> nmap <c-l> :tab split<cr> inoremap <c-l> <c-o><del> nmap <c-k> :tabc<cr> nmap <C-Tab> <ESC>:bn<CR> vmap <C-Tab> <ESC>:bn<CR> imap <C-Tab> <ESC>:bn<CR> nmap <s-Tab> <ESC>:b#<CR> vmap <s-Tab> <ESC>:b#<CR> imap <s-Tab> <ESC>:b#<CR> inoremap <c-f> <pagedown> inoremap <c-b> <pageup>nmap <C-x><c-d> :pwd<CR> nmap <c-x><c-s> :cd ..<CR>:pwd<CR> nmap <c-x><c-x> :CtrlPBuffer<cr> nnoremap <c-x><c-z> :nohl<cr> vnoremap <c-x><c-z> <c-c>:nohl<cr> inoremap <c-x><c-z> <c-o>:nohl<cr> nmap <f1> <esc>:call OpenCloseTagbarNERDTree()<cr> vmap <f1> <esc>:call OpenCloseTagbarNERDTree()<cr> imap <f1> <esc>:call OpenCloseTagbarNERDTree()<cr> nmap <f2> <esc>:call SwitchTagbarNERDTree()<cr> vmap <f2> <esc>:call SwitchTagbarNERDTree()<cr> imap <f2> <esc>:call SwitchTagbarNERDTree()<cr> vmap <F3> <C-C><ESC>/<C-R>+<CR><ESC> nmap <F3> <ESC>/<C-R>=expand("<cword>")<CR><CR> imap <F3> <ESC>/<C-R>=expand("<cword>")<CR><CR> nmap <F4> <ESC>:Grep vmap <F4> <ESC>:Grep imap <F4> <ESC>:Grep nmap <f5> :call ToggleCommentLine()<cr> imap <f5> <c-o>:call ToggleCommentLine()<cr> vmap <f5> <esc>:call ToggleCommentLine()<cr> nmap <F6> <ESC>:CtrlPFunky<cr> vmap <F6> <ESC>:CtrlPFunky<cr> imap <F6> <ESC>:CtrlPFunky<cr> nmap <f9> <esc>:call FindFilePath()<cr> vmap <f9> <esc>:call FindFilePath()<cr> imap <f9> <esc>:call FindFilePath()<cr> nmap <F10> <ESC>:call ToggleQuickfix()<CR> vmap <F10> <ESC>:call ToggleQuickfix()<CR> imap <F10> <ESC>:call ToggleQuickfix()<CR> nnoremap <F7> <ESC>:CtrlP<CR> vnoremap <F7> <ESC>:CtrlP<CR> inoremap <F7> <ESC>:CtrlP<CR> nmap <F8> <ESC>:CtrlPBuffer<CR> vmap <F8> <ESC>:CtrlPBuffer<CR> imap <F8> <ESC>:CtrlPBuffer<CR> nnoremap <silent> <F11> <ESC>:<C-R>=line("'<")<CR>,<C-R>=line("'>")<CR>s/^/\/\/<CR>/^$x<CR> vnoremap <silent> <F11> <ESC>:<C-R>=line("'<")<CR>,<C-R>=line("'>")<CR>s/^/\/\/<CR>/^$x<CR> inoremap <silent> <F11> <ESC>:<C-R>=line("'<")<CR>,<C-R>=line("'>")<CR>s/^/\/\/<CR>/^$x<CR> nnoremap <silent> <F12> <ESC>:<C-R>=line("'<")<CR>,<C-R>=line("'>")<CR>s/\/\//<CR>/^$x<CR> vnoremap <silent> <F12> <ESC>:<C-R>=line("'<")<CR>,<C-R>=line("'>")<CR>s/\/\//<CR>/^$x<CR> inoremap <silent> <F12> <ESC>:<C-R>=line("'<")<CR>,<C-R>=line("'>")<CR>s/\/\//<CR>/^$x<CR> " -------------------------------- 設置插件 ---------------------------------- filetype off if has("win32") set rtp+=$VIM/vimfiles/bundle/vundle/ call vundle#rc('$VIM/vimfiles/bundle/') else set rtp+=~/.vim/bundle/vundle/ call vundle#rc('~/.vim/bundle/') endif Bundle 'gmarik/vundle' Bundle 'altercation/vim-colors-solarized' "Bundle 'molokai' "Bundle 'endel/vim-github-colorscheme' "Bundle 'ciaranm/inkpot' "Bundle 'Lokaltog/vim-powerline' "Bundle 'vim-airline/vim-airline' "Bundle 'vim-airline/vim-airline-themes' Bundle 'majutsushi/tagbar' Bundle 'scrooloose/nerdtree' "Bundle 'ervandew/supertab' "Bundle 'yegappan/grep' Bundle 'dkprice/vim-easygrep' Bundle 'easymotion/vim-easymotion' Bundle 'kien/ctrlp.vim' Bundle 'tacahiroy/ctrlp-funky' Bundle 'drmingdrmer/xptemplate' Bundle 'ap/vim-buftabline' "Bundle 'vim-scripts/bufferlist.vim' "Bundle 'mihaifm/bufstop' "Bundle 'itchyny/thumbnail.vim' "Bundle 'tomtom/tselectbuffer_vim' "Bundle 'vim-scripts/PopupBuffer.vim' "Bundle 'vim-scripts/jsbeautify' "Bundle 'othree/xml.vim' "Bundle 'Valloric/YouCompleteMe' "Bundle 'vim-scripts/javacomplete' "Bundle 'artur-shaik/vim-javacomplete2' "Bundle 'vim-scripts/OmniCppComplete' filetype plugin indent on " EasyGrep let g:EasyGrepMode=2 " use TrackExt let g:EasyGrepReplaceWindowMode=2 "autowriteall; create no new windows (when replace) let g:EasyGrepJumpToMatch=0 let g:EasyGrepAllOptionsInExplorer=1 set grepprg=grep\ -n\ -a let g:EasyGrepCommand=1 let g:EasyGrepRecursive=1 let g:EasyGrepSearchCurrentBufferDir=0 let g:EasyGrepFilesToExclude='.svn,.git,.root,bin,target,*.swp,*.gif,*.png,*.jpg,*.svg,*.zip,*.gz,*.class,*.jar,tags,tags.files' " 設置supertab "let g:SuperTabDefaultCompletionType="context" "let g:SuperTabMappingForward = '<s-tab>' "let g:SuperTabMappingBackward = '<tab>' " 設置Tagbar let g:tagbar_left=1 "let g:tagbar_width=30 let g:tagbar_autoclose=0 "let g:tagbar_sort = 0 let g:tagbar_compact = 1 "let g:tagbar_show_linenumbers = 2 " NERDTree "let NERDTreeWinPos='right' let NERDTreeShowLineNumbers=0 let NERDTreeWinSize=40 let NERDTreeMinimalUI=1 " 設置 ctrlp let g:ctrlp_cmd='CtrlPBuffer' let g:ctrlp_working_path_mode = 'rw' let g:ctrlp_by_filename = 1 let g:ctrlp_max_height = 30 let g:ctrlp_max_files = 100000 let g:ctrlp_use_caching = 1 let g:ctrlp_clear_cache_on_exit = 0 if has("win32") let g:ctrlp_cache_dir = $VIM.'/cache/ctrlp' else let g:ctrlp_cache_dir = '~/.ctrlp' endif let g:ctrlp_root_markers = ['.root'] " set my root marker for ctrlp let g:ctrlp_custom_ignore = { \ 'dir': '\v[\/](build|bin|target)$', \ 'file': '\v\.(jar|class|xml|yang|MF|sh|bat|xlsx|files|properties|proto|conf|md|txt|xsd|png|gif|svg|json|gz|less|css|scss)$', \ 'link': 'SOME_BAD_SYMBOLIC_LINKS',} " ctrlp_funky let g:ctrlp_extensions = ['funky'] let g:ctrlp_funky_syntax_highlight = 1 colorscheme solarized
修改了solarized.vim, 增長下面配色java
hi User2 ctermbg=red guibg=red " 文件被修改 hi User3 ctermfg=black ctermbg=yellow guifg=black guibg=yellow " 插入模式 hi User4 ctermfg=black ctermbg=green guifg=black guibg=darkgreen " 非插入模式 hi User5 ctermfg=black ctermbg=white guifg=black guibg=lightyellow " 文件名
OLDgit
-------------------------------------------- 2106-06-21 11:52:00 --------------------------------------------github
" 設置編碼 set encoding=utf-8 set langmenu=zh_CN.UTF-8 "set menu's language of gvim. no spaces beside '=' language messages en_US.UTF-8 "zh_CN.utf-8 " ---------------------- 系統自帶設置 ------------------------- set nocompatible source $VIMRUNTIME/vimrc_example.vim source $VIMRUNTIME/mswin.vim behave mswin 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 if has("gui_running") "標籤頁欄中去除當前所編輯文件的路徑信息,只保留文件名 function ShortTabLabel () let bufnrlist = tabpagebuflist (v:lnum) let label = bufname (bufnrlist[tabpagewinnr (v:lnum) -1]) let filename = fnamemodify (label, ':t') return filename endfunction set guitablabel=%{ShortTabLabel()} endif "------------------- vim基礎設置 -------------------------- set nu set hlsearch set tabstop=4 set expandtab set shiftwidth=4 set autoindent set hidden " 避免當前編輯文檔未保存時,在新窗口打開文檔 set ignorecase set cursorline "set textwidth=80 set colorcolumn=81 set mouse=a set completeopt=menu " 補全設置 "set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ %{&encoding}\ %c:%l/%L%) set statusline=%4n%m\ %1*>\ %*%t%1*\ <%*\ %<%h%w%q%r%F%=%l,\ %c\ :\ %p%%%1*\|%*0x%02B%1*\|%*%{&fileformat}%1*\|%*%{&encoding} "hi myhl guibg=#ff0000 set nobackup set noundofile set noswapfile set laststatus=2 "set nowrap " 不拆行 set fdm=syntax " 代碼摺疊方式 set nofoldenable " 啓動時關閉摺疊 "set syntax enable if has("gui_running") "若是在 GUI 環境下運行則設置下面語句 set guifont=Consolas:h12 "set guifont=Dejavu\ Sans\ Mono:h10 set guioptions-=T " 不顯示工具欄 set guioptions-=L " 不顯示左邊滾動條 set guioptions-=r " 不顯示右邊滾動條 set guioptions-=m set vb t_vb= " 禁用響鈴提醒 au GuiEnter * set t_vb= "hi SpecialKey guifg=BG endif if has("win32") au GuiEnter * simalt ~x endif " --------------------------設置 經常使用快捷鍵-------------------------------- function DeleteCurBuf() let l:currentBufNum = bufnr("%") if 0 == buflisted(l:currentBufNum) exec "echo \'This buffer can not delete.\'" return endif exec "bn" let l:newBufNum = bufnr("%") if l:currentBufNum == l:newBufNum exec "echo \'This is the last opened file.\'" return endif exec "bw " . l:currentBufNum endfunction nmap Q :call DeleteCurBuf()<cr> nmap <leader>q :q<CR> nmap <leader>b :ls<CR> nmap <leader>n :nohl<CR> nmap <leader>w :update<CR> nmap <leader>W :wa<CR> nmap <leader>e :browse confirm e<CR> "nmap <leader>s :e $VIM/_vimrc<CR> nmap <leader>s :e c:/users/*******/_vimrc<CR> nmap <leader>c :cd "let g:EasyMotion_leader_key = ';' nmap ;s <Plug>(easymotion-F) nmap ;f <Plug>(easymotion-f) nmap ;j <Plug>(easymotion-j) nmap ;k <Plug>(easymotion-k) nmap <C-d><c-d> :pwd<CR> nmap <c-d><c-s> :cd ..<CR>:pwd<CR> nmap <c-s-tab> :tabn<cr> nmap <c-l> :tab split<cr> nmap <c-k> :tabc<cr> nmap <S-Tab> <ESC>:bn<CR> vmap <S-Tab> <ESC>:bn<CR> imap <S-Tab> <ESC>:bn<CR> nmap <C-Tab> <ESC>:b#<CR> vmap <C-Tab> <ESC>:b#<CR> imap <C-Tab> <ESC>:b#<CR> map <c-w>, <esc>:vertical resize +3<cr> map <c-w>. <esc>:vertical resize -3<cr> function WasCommented(str) let len = strlen(a:str) let i = 0 while i < len if a:str[i] != ' ' || a:str[i] != "\t" break endif let i += 1 endwhile if i < len - 1 && a:str[i] == a:str[i+1] && a:str[i] == "/" return 1 else return 0 endif endfunction function ToggleCommentLine() let nr = line('.') let str_line = getline(nr) if WasCommented(str_line) let newstr = substitute(str_line, '//', '', '') else let newstr = substitute(str_line, '^', '//', '') endif :call setline(nr, newstr) endfunction nmap <f5> <esc>:call ToggleCommentLine()<cr> imap <f5> <esc>:call ToggleCommentLine()<cr> vmap <f5> <esc>:call ToggleCommentLine()<cr> " 1 tagbar打開了,2 nerdtree打開了,3都打開了,0都沒打開 function WhichOpened() let returnValue = 0 if bufwinnr('__Tagbar__') != -1 let returnValue += 1 endif if bufwinnr('NERD_tree_1') != -1 let returnValue += 2 endif return returnValue endfunction function SwitchTagbarNERDTree() let tmp = WhichOpened() exec "NERDTreeClose" if (tmp != 1) && (tmp != 3) exec "TagbarOpen" else exec "TagbarClose" exec "NERDTreeToggle" exec "normal! \<c-w>l" endif endfunction let s:lastTNStatus = 1 function OpenCloseTagbarNERDTree() let currTNStatus = WhichOpened() exec "NERDTreeClose" if currTNStatus != 0 exec "TagbarClose" let s:lastTNStatus = currTNStatus elseif s:lastTNStatus == 1 exec "TagbarOpen" else exec "TagbarClose" exec "NERDTreeToggle" exec "normal! \<c-w>l" endif endfunction nmap <f1> <esc>:call OpenCloseTagbarNERDTree()<cr> vmap <f1> <esc>:call OpenCloseTagbarNERDTree()<cr> imap <f1> <esc>:call OpenCloseTagbarNERDTree()<cr> nmap <f2> <esc>:call SwitchTagbarNERDTree()<cr> vmap <f2> <esc>:call SwitchTagbarNERDTree()<cr> imap <f2> <esc>:call SwitchTagbarNERDTree()<cr> "nmap <F1> <esc>:NERDTreeClose<cr>:TagbarOpen<cr> "vmap <F1> <esc>:NERDTreeClose<cr>:TagbarOpen<cr> "imap <F1> <esc>:NERDTreeClose<cr>:TagbarOpen<cr> "nmap <F2> <esc>:TagbarClose<cr>:NERDTreeClose<cr>:NERDTreeToggle<cr> "vmap <F2> <esc>:TagbarClose<cr>:NERDTreeClose<cr>:NERDTreeToggle<cr> "imap <F2> <esc>:TagbarClose<cr>:NERDTreeClose<cr>:NERDTreeToggle<cr> nmap <c-f9> :NERDTreeFind<cr> vmap <F3> <C-C><ESC>/<C-R>+<CR><ESC> nmap <F3> <ESC>/<C-R>=expand("<cword>")<CR><CR> imap <F3> <ESC>/<C-R>=expand("<cword>")<CR><CR> nmap <F4> <ESC>:Grep vmap <F4> <ESC>:Grep imap <F4> <ESC>:Grep "nmap <F5> <ESC>:NERDTreeClose<cr>:TagbarClose<cr> "vmap <F5> <ESC>:NERDTreeClose<cr>:TagbarClose<cr> "imap <F5> <ESC>:NERDTreeClose<cr>:TagbarClose<cr> nmap <F6> <ESC>:CtrlPFunky<cr> vmap <F6> <ESC>:CtrlPFunky<cr> imap <F6> <ESC>:CtrlPFunky<cr> nnoremap <silent> <F11> <ESC>:<C-R>=line("'<")<CR>,<C-R>=line("'>")<CR>s/^/\/\/<CR>/^$x<CR> vnoremap <silent> <F11> <ESC>:<C-R>=line("'<")<CR>,<C-R>=line("'>")<CR>s/^/\/\/<CR>/^$x<CR> inoremap <silent> <F11> <ESC>:<C-R>=line("'<")<CR>,<C-R>=line("'>")<CR>s/^/\/\/<CR>/^$x<CR> nnoremap <silent> <F12> <ESC>:<C-R>=line("'<")<CR>,<C-R>=line("'>")<CR>s/\/\//<CR>/^$x<CR> vnoremap <silent> <F12> <ESC>:<C-R>=line("'<")<CR>,<C-R>=line("'>")<CR>s/\/\//<CR>/^$x<CR> inoremap <silent> <F12> <ESC>:<C-R>=line("'<")<CR>,<C-R>=line("'>")<CR>s/\/\//<CR>/^$x<CR> function FindFilePath() exec 'TagbarClose' exec 'NERDTreeFind' exec "normal! \<c-w>l" endfunction nmap <f9> <esc>call FindFilePath()<cr> vmap <f9> <esc>call FindFilePath()<cr> imap <f9> <esc>call FindFilePath()<cr> function IsQuickfixLoaded() redir => bufoutput exe "silent! buffers!" " This echo clears a bug in printing that shows up when it is not present silent! echo "" redir END return match(bufoutput, "\"\\[Quickfix List\\]\"", 0, 0) != -1 endfunction function ToggleQuickfix() if IsQuickfixLoaded() :ccl :exec "normal! \<c-w>l" else :copen :exec "normal! \<c-w>J" endif endfunction nmap <F10> <ESC>:call ToggleQuickfix()<CR> vmap <F10> <ESC>:call ToggleQuickfix()<CR> imap <F10> <ESC>:call ToggleQuickfix()<CR> nnoremap <F7> <ESC>:CtrlP<CR> vnoremap <F7> <ESC>:CtrlP<CR> inoremap <F7> <ESC>:CtrlP<CR> nmap <F8> <ESC>:CtrlPBuffer<CR> vmap <F8> <ESC>:CtrlPBuffer<CR> imap <F8> <ESC>:CtrlPBuffer<CR> " -----------------------------------設置各插件------------------------------------- " Bundle filetype off " 設置vundle路徑 set rtp+=$VIM/vimfiles/bundle/vundle/ call vundle#rc('$VIM/vimfiles/bundle/') Bundle 'gmarik/vundle' "Bundle 'altercation/vim-colors-solarized' Bundle 'molokai' "Bundle 'ciaranm/inkpot' "Bundle 'Lokaltog/vim-powerline' "Bundle 'vim-airline/vim-airline' "Bundle 'vim-airline/vim-airline-themes' Bundle 'majutsushi/tagbar' Bundle 'scrooloose/nerdtree' Bundle 'ervandew/supertab' "Bundle 'yegappan/grep' Bundle 'dkprice/vim-easygrep' Bundle 'easymotion/vim-easymotion' Bundle 'kien/ctrlp.vim' Bundle 'tacahiroy/ctrlp-funky' Bundle 'drmingdrmer/xptemplate' Bundle 'vim-scripts/jsbeautify' "Bundle 'othree/xml.vim' "Bundle 'Valloric/YouCompleteMe' "Bundle 'vim-scripts/javacomplete' "Bundle 'artur-shaik/vim-javacomplete2' "Bundle 'vim-scripts/OmniCppComplete' filetype plugin indent on " grep "let Grep_Find_Path = '"C:\Program Files\Git\usr\bin\find.exe"' "let Grep_Path = '"C:\Program Files\Git\usr\bin\grep.exe"' "let Grep_Xargs_Path = '"C:\Program Files\Git\usr\bin\xargs.exe"' "let Grep_Default_Options = '-i -r --include="*.cpp" --include="*.h" --include="*.hpp" --include="*.c" --include="*.cc" --include="*.java"' "let Grep_Default_Filelist = '.' " EasyGrep let g:EasyGrepMode=2 " use TrackExt let g:EasyGrepReplaceWindowMode=2 "autowriteall; create no new windows (when replace) let g:EasyGrepJumpToMatch=0 let g:EasyGrepAllOptionsInExplorer=1 "let g:EasyGrepRoot="search:.git,.svn,.root" set grepprg=grep\ -n\ -a let g:EasyGrepCommand=1 let g:EasyGrepRecursive=1 let g:EasyGrepSearchCurrentBufferDir=0 let g:EasyGrepFilesToExclude='.svn,.git,.root,bin,target,*.swp' " 設置supertab let g:SuperTabDefaultCompletionType="context" let g:SuperTabMappingForward = '<s-tab>' let g:SuperTabMappingBackward = '<tab>' " 設置Tagbar let g:tagbar_left=1 "let g:tagbar_width=30 let g:tagbar_autoclose=0 "let g:tagbar_sort = 0 let g:tagbar_compact = 1 "let g:tagbar_show_linenumbers = 2 " NERDTree "let NERDTreeWinPos='right' let NERDTreeShowLineNumbers=0 let NERDTreeWinSize=40 " 設置 cscope if has("cscope") set csprg=cscope set csto=0 set cst set cscopequickfix=s-,g-,c-,f-,d-,i-,t-,e- set nocsverb set csverb "nmap zs :cs find s <C-R>=expand("<cword>")<CR><CR> map <C-g><C-g> :cs find g <C-R>=expand("<cword>")<CR><CR> nmap <C-G><C-C> :cs find c <C-R>=expand("<cword>")<CR><CR> nmap <C-G><C-T> :cs find t <C-R>=expand("<cword>")<CR><CR> vmap <C-G><C-T> <ESC>:cs find t <C-R>=expand("<cword>")<CR><CR> imap <C-G><C-T> <ESC>:cs find t <C-R>=expand("<cword>")<CR><CR> "nmap ze :cs find e <C-R>=expand("<cword>")<CR><CR> nmap <C-G><C-f> :cs find f <C-R>=expand("<cword>")<CR><CR> "nmap zi :cs find i ^<C-R>=expand("<cword>")<CR>$<CR> "nmap zd :cs find d <C-R>=expand("<cword>")<CR><CR> endif " 設置 ctrlp "let g:ctrlp_map = '' " 去掉ctrl+p快捷鍵 let g:ctrlp_cmd='CtrlPBuffer' let g:ctrlp_working_path_mode = 'rw' let g:ctrlp_by_filename = 1 let g:ctrlp_max_height = 30 let g:ctrlp_max_files = 50000 let g:ctrlp_use_caching = 1 let g:ctrlp_clear_cache_on_exit = 0 let g:ctrlp_cache_dir = $VIM.'/cache/ctrlp' " 手動指定搜索的根目錄let g:ctrlp_root_markers = [''] let g:ctrlp_root_markers = ['.root'] " set my root marker for ctrlp "let g:ctrlp_custom_ignore = '\v[\/](build|bin|src\\win32)$' let g:ctrlp_custom_ignore = { \ 'dir': '\v[\/](build|bin|target)$', \ 'file': '\v\.(jar|class)$', \ 'link': 'SOME_BAD_SYMBOLIC_LINKS',} let g:ctrlp_extensions = ['funky'] let g:ctrlp_funky_syntax_highlight = 1 "set bg=light "colorscheme solarized "colorscheme desert "let g:molokai_original=1 colorscheme molokai "colorscheme inkpot "let g:Powerline_colorscheme='solarized256' "let g:Powerline_colorscheme='default' "let g:Powerline_stl_path_style = 'full' "let g:airline#extensions#disable_rtp_load = 1 "let g:airline_section_error = "" "let g:airline_section_warning = "" "let g:airline_detect_modified=0 " " vim-javacomplete2 "autocmd FileType java setlocal omnifunc=javacomplete#Complete
the end.json