Last active
February 24, 2016 12:32
-
-
Save VincentTam/abc1cbd2b2181ad69165 to your computer and use it in GitHub Desktop.
My VIMRC for GVim on M$ Win* 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
" ---END OF DEFAULT SETTINGS --- | |
" Vundle settings | |
"set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=$HOME/vimfiles/bundle/Vundle.vim | |
"call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
call vundle#begin('$HOME/vimfiles/bundle/') | |
" let Vundle manage Vundle, required | |
Plugin 'VundleVim/Vundle.vim' | |
" The following are examples of different formats supported. | |
" Keep Plugin commands between vundle#begin/end. | |
" plugin on GitHub repo | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'brookhong/cscope.vim.git' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'FromtonRouge/OmniCppComplete' | |
Plugin 'tomtom/tlib_vim' | |
Plugin 'MarcWeber/vim-addon-mw-utils' | |
Plugin 'junegunn/vim-easy-align' | |
Plugin 'Lokaltog/vim-easymotion' | |
Plugin 'vim-latex/vim-latex' | |
Plugin 'plasticboy/vim-markdown' | |
Plugin 'xolox/vim-misc' | |
Plugin 'tangledhelix/vim-octopress' | |
Plugin 'tpope/vim-repeat' | |
"Plugin 'xolox/vim-session' | |
Plugin 'garbas/vim-snipmate' | |
Plugin 'honza/vim-snippets' | |
Plugin 'tpope/vim-surround' | |
Plugin 'kana/vim-textobj-lastpat' | |
Plugin 'kana/vim-textobj-user' | |
Plugin 'rbonvall/vim-textobj-latex' | |
Plugin 'tpope/vim-unimpaired' | |
Plugin 'bronson/vim-visual-star-search' | |
Plugin 'mattn/webapi-vim' | |
Plugin 'mattn/gist-vim' | |
Plugin 'sgur/vim-textobj-parameter' | |
Plugin 'thinca/vim-textobj-between' | |
" plugin from http://vim-scripts.org/vim/scripts.html | |
Plugin 'a.vim' | |
Plugin 'c.vim' | |
Plugin 'DrawIt' | |
Plugin 'FuzzyFinder' | |
Plugin 'L9' | |
Plugin 'loremipsum' | |
Plugin 'taglist.vim' | |
Plugin 'visualrepeat' | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
filetype plugin indent on " required | |
" End of Vundle settings | |
" General settings | |
set hlsearch " highlight search | |
set incsearch " incremental search | |
set ignorecase " ignorecase | |
"set linebreak " for soft word wrap (131212: use modeline instead) | |
set smartindent | |
set expandtab " use whitespaces instead of tabs | |
set shiftwidth=4 " indent 4 space char | |
set tabstop=8 " 140228: changing tabstop isn't good | |
set softtabstop=4 " 140228 | |
set encoding=utf-8 | |
set fileformat=unix | |
set history=200 " memory has become much cheaper | |
set mousehide " Hide the mouse when typing text | |
set sessionoptions+=resize,unix,slash | |
set sessionoptions-=options | |
set guifont=Inconsolata:h12 | |
augroup textCompletion | |
au! | |
au Filetype html,markdown,text inoremap <buffer> ( ()<++><Left><Left><Left><Left><Left> | |
au Filetype html,markdown,text inoremap <buffer> (( ( | |
au Filetype html,markdown,text inoremap <buffer> () ()<++><Left><Left><Left><Left><Left> | |
au Filetype html,markdown,text inoremap <buffer> [ []<++><Left><Left><Left><Left><Left> | |
au Filetype html,markdown,text inoremap <buffer> [[ [ | |
au Filetype html,markdown,text inoremap <buffer> [] []<++><Left><Left><Left><Left><Left> | |
au Filetype html,markdown,text inoremap <buffer> { {}<++><Left><Left><Left><Left><Left> | |
au Filetype html,markdown,text inoremap <buffer> {{ { | |
au Filetype html,markdown,text inoremap <buffer> {} {}<++><Left><Left><Left><Left><Left> | |
au Filetype html,markdown,text inoremap <buffer> '' ''<++><Left><Left><Left><Left><Left> | |
au Filetype html,markdown,text inoremap <buffer> "" ""<++><Left><Left><Left><Left><Left> | |
au Filetype html,markdown,text inoremap <buffer> < <<Left><Right>><++><Left><Left><Left><Left><Left> | |
au Filetype html,markdown,text inoremap <buffer> << < | |
au Filetype markdown inoremap <buffer> `` ``<++><Left><Left><Left><Left><Left> | |
au Filetype markdown inoremap <buffer> ** **<++><Left><Left><Left><Left><Left> | |
augroup END | |
augroup specIndent | |
au! | |
au Filetype tex,markdown,css,scss,html,javascript,vim setlocal shiftwidth=2 | |
augroup END | |
nnoremap <F3> :NERDTreeToggle %:p:h<CR> | |
set pastetoggle=<F5> " Practical Vim Tip 63 | |
nnoremap <F12> :TlistToggle<CR> | |
" Press Space to turn off highlighting and clear any message already displayed. | |
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR> | |
" Practical Vim Tip 34: Avoid cursors when rcl'g cmd from hist | |
cnoremap <C-p> <Up> | |
cnoremap <C-n> <Down> | |
" 160221: Fix the space in "C:\Program Files" in the path of Git Bash | |
if match(&shell,' ') > -1 | |
set shell=C:\PROGRA~1\Git\usr\bin\bash.exe | |
endif | |
" C/C++ settings | |
set makeprg=mingw32-make | |
" 131211: Testing OmniCppComplete | |
" http://carl830.pixnet.net/blog/post/67681043-vim-omnicppcomplete%2Bstl-support | |
set tags+=C:/Users/Owner/.vim/tags/cpp | |
" build tags of your own project with Ctrl-F12 | |
" Vim-Wikia: http://vim.wikia.com/wiki/C%2B%2B_code_completion | |
map <C-F12> :!ctags -R --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q .<CR> | |
" OmniCppComplete | |
let OmniCpp_NamespaceSearch = 1 | |
let OmniCpp_GlobalScopeSearch = 1 | |
let OmniCpp_ShowAccess = 1 | |
let OmniCpp_ShowPrototypeInAbbr = 1 " show function parameters | |
let OmniCpp_MayCompleteDot = 1 " autocomplete after . | |
let OmniCpp_MayCompleteArrow = 1 " autocomplete after -> | |
let OmniCpp_MayCompleteScope = 1 " autocomplete after :: | |
let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"] | |
" automatically open and close the popup menu / preview window | |
au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif | |
set completeopt=menuone,menu,longest,preview | |
" C/C++ settings end | |
" LaTeX-Suite settings | |
" REQUIRED. This makes vim invoke Latex-Suite when you open a tex file. | |
"filetype plugin on | |
" IMPORTANT: win32 users will need to have 'shellslash' set so that latex | |
" can be called correctly. | |
set shellslash | |
" IMPORTANT: grep will sometimes skip displaying the file name if you | |
" search in a singe file. This will confuse Latex-Suite. Set your grep | |
" program to always generate a file-name. | |
set grepprg=grep\ -nH\ $* | |
" OPTIONAL: This enables automatic indentation as you type. | |
"filetype indent on | |
" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to | |
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded. | |
" The following changes the default filetype back to 'tex': | |
let g:tex_flavor='latex' | |
" 131001: change default output format | |
" http://superuser.com/questions/186283/compile-tex-files-to-pdf-as-default-in-gvim-with-latexsuite-plugin | |
let g:Tex_DefaultTargetFormat='pdf' | |
let g:Tex_MultipleCompileFormats='pdf' | |
" 131210: switched to a free PDF viewer | |
" Setting full path doesn't work for SumatraPDF, PATH env var needed | |
" Assume that XeLaTeX is used | |
" Setting g:Tex_ViewRuleComplete_dvi doesn't work for SumatraPDF | |
" 131212: add dir to $PATH for runtime to avoid too long $PATH in other prog | |
let $PATH .= ';C:\Program Files\SumatraPDF' | |
let g:Tex_ViewRule_pdf='SumatraPDF' | |
" 131204: For better Chin and Unicode support | |
let g:Tex_CompileRule_pdf='xelatex -interaction=nonstopmode $*' | |
" for Chin. support | |
"let $LANG="zh_TW.UTF-8" | |
"set langmenu=zh_tw.utf-8 | |
"set encoding=utf8 | |
"reload menu with UTF-8 encoding | |
"source $VIMRUNTIME/delmenu.vim | |
"source $VIMRUNTIME/menu.vim | |
" for Chin. support ends | |
"(TEMP) Set vim-latex compile rule for texcount | |
"let g:Tex_CompileRule_pdf='pdflatex --enable-write18 -interaction=nonstopmode $*' | |
" LaTeX-Suite settings end | |
" Gist settings start | |
let g:github_user = 'VincentTam' | |
let g:gist_get_multiplefile = 1 | |
" Gist settings end | |
" vim-easy-algin settings start | |
" Start interactive EasyAlign in visual mode | |
vmap <Enter> <Plug>(EasyAlign) | |
" Start interactive EasyAlign with a Vim movement | |
nmap <Leader>a <Plug>(EasyAlign) | |
" vim-easy-algin settings end | |
" Use the console colors in gvim (source: Vim Wikia) | |
set background=dark | |
hi SpecialKey guifg=Blue | |
hi MoreMsg guifg=Green | |
hi Visual guifg=NONE guibg=NONE | |
hi Folded ctermbg=4 guibg=Blue | |
hi FoldColumn ctermbg=7 | |
hi DiffAdd guibg=Blue | |
hi DiffChange guibg=Magenta | |
hi DiffDelete guibg=Cyan | |
hi Normal guifg=Gray guibg=Black | |
hi Cursor guibg=White | |
hi lCursor guibg=White | |
hi Comment guifg=Cyan | |
hi Constant guifg=Magenta | |
hi Special guifg=Red | |
hi Identifier guifg=Cyan | |
hi Statement guifg=Yellow | |
hi PreProc guifg=Blue | |
hi Type guifg=Green | |
hi Underlined guifg=Blue | |
hi Todo guifg=Black |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment