Skip to content

Instantly share code, notes, and snippets.

@liancheng
Created August 3, 2012 07:06
Show Gist options
  • Save liancheng/3245281 to your computer and use it in GitHub Desktop.
Save liancheng/3245281 to your computer and use it in GitHub Desktop.
Lian Cheng's .vimrc
" Loads default settings when startup {{{
source $VIMRUNTIME/vimrc_example.vim
if filereadable($HOME . "/.vimpath")
source $HOME/.vimpath
endif
call pathogen#infect()
" }}}
" Sets color scheme {{{
set background=dark
highlight StatusLine term=bold,reverse cterm=NONE ctermfg=White ctermbg=Blue
" }}}
" Sets Vim variables {{{
if version >= 700
set cursorline
endif
if version >= 703
set colorcolumn=+1
endif
if has('unix')
set grepprg=grep\ -nH\ $*
endif
" Encoding settings {{{
set encoding=utf-8
set fileencodings=utf-8,gbk,ucs-bom,ucs-2,latin1
set termencoding=utf-8
if has('win32') || has('win64')
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
source $VIMRUNTIME/mswin.vim
behave mswin
" Cygwin
if has('win32unix') || !has('gui')
set encoding=cp936
set termencoding=gbk
endif
endif
" }}}
language message zh_CN.utf-8
set autoindent
set expandtab
set foldcolumn=1
set foldmethod=marker
set hlsearch
set ignorecase
set incsearch
set laststatus=2
set nobackup
set nocompatible
set nowrap
set noswapfile
set number
set shellslash
set shiftwidth=4
set showmatch
set tabstop=4
set updatetime=1
set virtualedit=block
set whichwrap=b,s,h,l,<,>,~,[,]
set wildmenu
filetype on
filetype indent on
filetype plugin on
syntax on
" }}}
" Taglist settings {{{
let Tlist_Auto_Highlight_Tag=1
let Tlist_Auto_Open=0
let Tlist_Auto_Update=1
let Tlist_Close_On_Select=0
let Tlist_Compact_Format=1
let Tlist_Ctags_Cmd='ctags'
let Tlist_Display_Prototype=0
let Tlist_Display_Tag_Scope=1
let Tlist_Enable_Fold_Column=1
let Tlist_Exit_OnlyWindow=0
let Tlist_File_Fold_Auto_Close=1
let Tlist_GainFocus_On_ToggleOpen=1
let Tlist_Highlight_Tag_On_BufEnter=0
let Tlist_Inc_Winwidth=1
let Tlist_Process_File_Always=0
let Tlist_Show_Menu=1
let Tlist_Use_Right_Window=1
" Updates taglist of the current project
nmap <silent> <F6> :TlistUpdate<CR>
" }}}
" BufExplorer settings {{{
let g:bufExplorerFindActive=1
let g:bufExplorerShowRelativePath=1
let g:bufExplorerSortBy='mru'
let g:bufExplorerSplitBelow=1
let g:bufExplorerSplitHorzSize=15
" Opens buffer manager
nmap <silent> <F5> :BufExplorer<CR>
" }}}
" NERDTree settings {{{
let g:NERDTreeWinSize=35
let g:NERDTreeWinPos='right'
let g:NERDTree_title='NERDTree'
function! NERDTree_Start()
exec 'NERDTree'
endfunction
function! NERDTree_IsValid()
return 1
endfunction
nmap <silent> <leader>nt :NERDTreeToggle<CR>
nmap <silent> <leader>ntf :NERDTreeFind<CR>
nmap <silent> <leader>ntm :NERDTreeMirror<CR>
function! NERDTree_Start()
exec 'NERDTree'
endfunction
function! NERDTree_IsValid()
return 1
endfunction
" }}}
" WinManager settings {{{
let g:persistentBehaviour=0
let g:winManagerWidth=35
let g:winManagerWindowLayout='TagList|FileExplorer'
" Opens the window manager
nmap <silent> <F7> :WMToggle<CR>
" Moves to the first explorer window
nmap <silent> <C-W><C-F> :FirstExplorerWindow<CR>
" Moves to the bottom explorer window
nmap <silent> <C-W><C-B> :BottomExplorerWindow<CR>
" }}}
" snipMate settings {{{
" Reload snipMate snippets
nmap <silent> <F11> :call ReloadAllSnippets()<CR>
" }}}
" FuzzyFinder settings {{{
if has('windows')
let g:fuf_splitPathMatching=1
let g:fuf_fuzzyRefining=1
nmap <silent> <space>b :FufBuffer<CR>
nmap <silent> <space>d :FufDir<CR>
nmap <silent> <space>f :FufFile<CR>
nmap <silent> <space>m :FufMruFile<CR>
nmap <silent> <space>l :FufLine<CR>
nmap <silent> <space>t :FufTag<CR>
nmap <silent> <space>q :FufQuickfix<CR>
nmap <silent> <space>r :FufRenewCache<CR>
nmap <silent> <space><space> :FufCoverageFile<CR>
endif
" }}}
" DirDiff settings {{{
let g:DirDiffDynamicDiffText = 1
" }}}
" hypergit settings {{{
nmap <silent> <leader>st :GitStatus<CR>
" }}}
" Command-T settings {{{
if has('ruby')
let g:CommandTScanDotDirectories=1
let g:CommandTMatchWindowAtTop=0
let g:CommandTMatchWindowReverse=1
nmap <silent> <space><space> :CommandT<CR>
nmap <silent> <space>b :CommandTBuffer<CR>
nmap <silent> <space>j :CommandTJump<CR>
nmap <silent> <space>r :CommandTFlush<CR>
endif
" }}}
" supertab settings {{{
let g:SuperTabDefaultCompletionType="<c-n>"
" }}}
" gundo settings {{{
nmap <silent> <leader>u :GundoToggle<CR>
" }}}
" yankring settings {{{
let yankring_history_file=".yankring_history"
" }}}
" ZenCoding settings {{{
let g:user_zen_settings = {
\ 'html' : {
\ 'indentation' : ' '
\ },
\}
" }}}
" Key mappings {{{
" Opens new tab
nmap <silent> <F2> :tabnew<CR>
" Closes window
nmap <silent> <F3> :close<CR>
" Cleans the search hightlights
nmap <silent> <F4> :set invhlsearch<CR>
" Make
nmap <silent> <F8> :make<CR>
nmap <silent> 2<F8> :make -j2<CR>
nmap <silent> 3<F8> :make -j3<CR>
nmap <silent> 4<F8> :make -j4<CR>
" Toggles compilation error window
nmap <silent> <F9> :copen<CR>
" Toggles paste mode
nmap <silent> <F10> :set invpaste<CR>
" Generates ctags database
nmap <silent> <leader>t :!ctags -R .<CR>
" Vimrc file settings
nmap <silent> <leader>ve :e $MYVIMRC<CR>
nmap <silent> <leader>vl :source $MYVIMRC<CR>
" Delete trailing spaces
nmap <silent> <leader>ds :%s/\s\+$//g<CR>
" Wrapping
nmap <silent> <leader>w :set invwrap<CR>
" Reloading
nmap <silent> <leader>r :e<CR>
" Window operations
nmap <silent> <space>h :wincmd h<CR>
nmap <silent> <space>l :wincmd l<CR>
nmap <silent> <space>j :wincmd j<CR>
nmap <silent> <space>k :wincmd k<CR>
" VST
nmap <silent> <leader>vf :Vst fold<CR>
" }}}
初始只需安装Pathogen,其余所有插件从vim-scripts.org上查询再git clone到.vim/bundle下。
.vim
autoload
bundle
bufexplorer
coffee-script
command-t
dirdiff
fuzzyfinder
gundo
hypergit
l9
markdown
matchit
nerdtree
numbers
snipmate
supertab
surround
vimgdb
vst-with-syn
winmanager
yaifa
yankring
zencoding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment