Skip to content

Instantly share code, notes, and snippets.

@tinylamb
Last active August 29, 2015 14:02
Show Gist options
  • Save tinylamb/b6e5859ce7c143165bc5 to your computer and use it in GitHub Desktop.
Save tinylamb/b6e5859ce7c143165bc5 to your computer and use it in GitHub Desktop.
vimrc for macvim
""General {{{
set nocompatible
set encoding=utf-8
""set langmenu=zh_CN.UTF-8
""language message zh_CN.UTF-8
set ignorecase
set incsearch
"filetype test
:filetype plugin indent on
set et
set ci
set shiftwidth=4
"text width setting
""}}}
""Visual {{{
syntax on
set number
autocmd ColorScheme * hi LineNr guifg=#636363
set ruler
set mouse=a
set mousehide
set showcmd
autocmd FileType * setlocal textwidth=79 formatoptions+=t
if has('gui_running')
colorscheme desert
set gfn=Consolas:h16
set lines=36 columns=100
winpos 246 73
endif
"auto complete
autocmd ColorScheme * hi Pmenu guifg=#f6f3e8 guibg=#444444 ctermfg=230 ctermbg=238 cterm=none
autocmd ColorScheme * hi PmenuSel guifg=#000000 guibg=#cae682 ctermfg=16 ctermbg=150 cterm=none
"highlight PmenuSbar ctermfg=2 ctermbg=3 guifg=#ff0000 guibg=#00ff00
"highlight PmenuThumb ctermfg=2 ctermbg=3 guifg=#ff0000 guibg=#00ff00
""}}}
""key mapping{{{
inoremap ( ()<LEFT>
inoremap [ []<LEFT>
inoremap { {}<LEFT>
inoremap " ""<LEFT>
inoremap ' ''<LEFT>
"define c function
nmap \df yyGo<ESC>p$cw{<CR>
"fn + F1 open NerdTree
nmap <silent> <F1> :WMToggle<cr>
"fn + F2 to compile
nmap <F2> :call OneFileMake()<CR>
fun! OneFileMake()
if &filetype=="c"
set makeprg=clang\ -W\ -o\ %<\ %
elseif &filetype=="cpp"
set makeprg=clang\ -W\ -o\ %<\ %\ -lstdc++
endif
execute "w"
execute "make"
execute "cw"
endfunc
"fn + F3 to run
nmap <F3> :!./%< <CR>
""}}}
"" Scripts and Plugins {{{
if has('vim_starting')
set nocompatible
filetype off
set runtimepath+=~/.vim/bundle/vundle.vim
endif
"set rtp+=~/.vim/bundle/vundle.vim
call vundle#begin('/Users/tinylamb/.vim/bundle')
" let Vundle manage Vundle,required!
Plugin 'gmarik/Vundle.vim'
" My Bundles here:
" original repos on github
"
Plugin 'Valloric/YouCompleteMe'
"--YCM setting
"add pure c
autocmd FileType c :let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf_c.py'
autocmd FileType cpp :let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf_cpp.py'
let g:ycm_complete_in_comments = 0
let g:ycm_filetype_whitelist = {'c':1 ,'cpp':1 ,'python':1}
nnoremap <leader>\ :YcmCompleter GoToDefinitionElseDeclaration<CR>
Plugin 'scrooloose/nerdtree'
Plugin 'mattn/webapi-vim'
Plugin 'mattn/gist-vim'
"--Gist setting
let g:gist_open_browser_after_post = 1
Plugin 'plasticboy/vim-markdown'
"--vim-markdown
let g:vim_markdown_folding_disabled=1
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'taglist.vim'
"--taglist setting
let Tlist_Ctags_Cmd ='/usr/local/bin/ctags'
let Tlist_Use_Right_Window = 1
"如果taglist是最后一个窗口就退出vim
let Tlist_Exit_OnlyWindow = 1
"只显示当前文件的tag结构
let Tlist_Show_One_File = 1
Plugin 'c.vim'
"--Csupport
let g:C_SourceCodeExtensions = 'c C cpp CPP'
Plugin 'L9'
Plugin 'FuzzyFinder'
Plugin 'winmanager'
"--winmanager setting
let g:NERDTree_title = "[NERDTree]"
function! NERDTree_Start()
exec "NERDTreeToggle"
endfunction
function! NERDTree_IsValid()
return 1
endfunction
let g:winManagerWindowLayout="NERDTree|TagList,BufExplorer"
let g:winManagerWidth = 30
Plugin 'NERD_tree-Project'
Plugin 'bufexplorer.zip'
" git repos on your local machine (i.e. when working on your own plugin)
" Plugin 'file:///home/gmarik/path/to/plugin'
" All of your Plugins must be added before the following line
call vundle#end()
filetype plugin indent on " required!
"
" 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment