Skip to content

Instantly share code, notes, and snippets.

@VincentTam VincentTam/_vimrc
Last active Feb 24, 2016

Embed
What would you like to do?
My VIMRC for GVim on M$ Win* 7
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 ---
" 131022: for pathogen plugin
execute pathogen#infect()
execute pathogen#helptags()
" General settings
"set nocompatible
set hlsearch " highlight search
set incsearch " incremental search
set ignorecase " ignorecase
"set linebreak " for soft word wrap (131212: use modeline instead)
set smartindent
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 sessionoptions+=resize,unix,slash
set sessionoptions-=options
set guifont=Inconsolata:h12
augroup textCompletion
au!
au Filetype html,mkd,text inoremap <buffer> ( ()<++><Left><Left><Left><Left><Left>
au Filetype html,mkd,text inoremap <buffer> (( (
au Filetype html,mkd,text inoremap <buffer> () ()<++><Left><Left><Left><Left><Left>
au Filetype html,mkd,text inoremap <buffer> [ []<++><Left><Left><Left><Left><Left>
au Filetype html,mkd,text inoremap <buffer> [[ [
au Filetype html,mkd,text inoremap <buffer> [] []<++><Left><Left><Left><Left><Left>
au Filetype html,mkd,text inoremap <buffer> { {}<++><Left><Left><Left><Left><Left>
au Filetype html,mkd,text inoremap <buffer> {{ {
au Filetype html,mkd,text inoremap <buffer> {} {}<++><Left><Left><Left><Left><Left>
au Filetype html,mkd,text inoremap <buffer> '' ''<++><Left><Left><Left><Left><Left>
au Filetype html,mkd,text inoremap <buffer> "" ""<++><Left><Left><Left><Left><Left>
au Filetype html,mkd,text inoremap <buffer> < <<Left><Right>><++><Left><Left><Left><Left><Left>
au Filetype html,mkd,text inoremap <buffer> << <
au Filetype mkd inoremap <buffer> `` ``<++><Left><Left><Left><Left><Left>
au Filetype mkd inoremap <buffer> ** **<++><Left><Left><Left><Left><Left>
augroup END
augroup specIndent
au!
au Filetype tex,mkd,css,scss,html,js setlocal shiftwidth=2
augroup END
" 131211: Toogle NERDTree using <F3>
" http://alexanderle.com/blog/2012/my-vimrc.html
nnoremap <F3> :NERDTreeToggle %:p:h<CR>
" 131211: Toogle taglist using <F12>
" http://c9s.blogspot.hk/search?q=taglist
nnoremap <F12> :TlistToggle<CR>
" 131211: maybe this is better
filetype plugin on
" 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 (x86)\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
" Markdown settings
let g:vim_markdown_initial_foldlevel=1
" Markdown 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
You can’t perform that action at this time.