Created
July 23, 2013 08:53
-
-
Save danmaispace/6060942 to your computer and use it in GitHub Desktop.
vimrc.local
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
"-------------------------------------------------------------------------- | |
" My Vim Configuration | |
"-------------------------------------------------------------------------- | |
syntax on " Syntax Highlight on | |
set nocompatible " Use vim advance settings | |
set nobackup " No backups | |
set autoread " Re-read if modified | |
set showcmd " Show panding commands | |
set cmdheight=1 " lines for command window | |
set laststatus=2 " Always show status line | |
set backspace=indent,eol,start " Backspace over everyting | |
set history=50 " Save at most 50 commands | |
set visualbell " Use visual bell | |
set noerrorbells " Don't make noise | |
set mouse=nv " Mouse in normal and visual | |
set lazyredraw " Don't redraw on macro execute | |
set diffopt=filler,iwhite " Diff options | |
set nostartofline " Keep cursor column when moving | |
set browsedir=buffer | |
set autochdir | |
set helplang=en " Language of help | |
set encoding=utf-8 | |
set enc=utf-8 | |
set fenc=utf-8 | |
set fencs=utf-8 | |
"set ambiwidth=double " Double width ASCII character | |
"-------------------------------------------------------------------------- | |
" Auto file type and indent | |
"-------------------------------------------------------------------------- | |
filetype on | |
filetype plugin on " Enable plugins | |
filetype indent on " Enable file type indenting | |
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1 | |
set tabstop=4 " Use 4 spaces for tabs | |
set expandtab " Use space instead of tabs | |
autocmd FileType ruby,eruby,yaml,perl set shiftwidth=2 | |
autocmd FileType c,cpp,java,javascript,python,php,xml,xhtml,html,rhtml set shiftwidth=4 | |
"-------------------------------------------------------------------------- | |
" Addition external File Type | |
"-------------------------------------------------------------------------- | |
au BufNewFile,BufRead /etc/nginx/* set ft=nginx | |
au BufNewFile,BufRead *.textile setf textile | |
"-------------------------------------------------------------------------- | |
" Color scheme | |
"-------------------------------------------------------------------------- | |
"colorscheme vibrantink "simulate TextMate color scheme | |
"-------------------------------------------------------------------------- | |
" Other | |
"-------------------------------------------------------------------------- | |
auto BufEnter * let &titlestring = expand("%:p") . " (".&ft.":".&fenc.")" | |
"language messages utf-8 "解决consle输出乱码 | |
"解决gVIM右键菜单乱码 | |
"set encoding=prc | |
"source $VIMRUNTIME/delmenu.vim | |
"source $VIMRUNTIME/menu.vim | |
"-------------------------------------------------------------------------- | |
" Options for Graphic version of VIM | |
"-------------------------------------------------------------------------- | |
set guioptions-=T " No Toolbar | |
set guioptions-=L " No left hand scrollbars | |
set guioptions-=r " No right hand scrollbars | |
"set guioptions-=m " No menu bar | |
"用空格键来开关折叠(说明西方“"”后面的内容为注释,不会被VIM所识别) | |
"set foldenable | |
"set foldmethod=indent | |
"nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR> | |
"-------------------------------------------------------------------------- | |
" Fonts for Graphic version of VIM | |
"-------------------------------------------------------------------------- | |
if has('gui_gtk2') | |
set guifont=Bitstream\ Vera\ Sans\ Mono\ 11 | |
" set lines=50 | |
" set columns=110 | |
elseif has("win32") | |
set guifont=Courier_New:h11:cANSI | |
set guifontwide=MingLiu:h10 | |
"set number "Line numbers | |
"set ai "Auto indent | |
set lines=50 | |
set columns=110 | |
else | |
set guifont=-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1 | |
set lines=50 | |
set columns=110 | |
endif | |
"-------------------------------------------------------------------------- | |
" Plugins map | |
"-------------------------------------------------------------------------- | |
"for FuzzyFinderFile plugin | |
"nnoremap <C-p> :FuzzyFinderFile <C-r>=fnamemodify(getcwd(), ':p')<CR><CR> | |
"nnoremap <C-t> :FufFile <C-r>=expand('%:~:.')[:-1-len(expand('%:~:.:t'))]<CR><CR> | |
let g:fuf_modesDisable = [] | |
let g:fuf_abbrevMap = { | |
\ '^vr:' : map(filter(split(&runtimepath, ','), 'v:val !~ "after$"'), 'v:val . ''/**/'''), | |
\ '^m0:' : [ '/mnt/d/0/', '/mnt/j/0/' ], | |
\ } | |
"let g:fuf_mrufile_maxItem = 300 | |
"let g:fuf_mrucmd_maxItem = 400 | |
nnoremap <silent> <C-n> :FufBuffer<CR> | |
nnoremap <silent> <C-p> :FufFileWithCurrentBufferDir<CR> | |
nnoremap <silent> <C-t> :FufFile<CR> | |
nnoremap <silent> <C-p>d :FufDirWithFullCwd<CR> | |
nnoremap <silent> <C-p>D :FufDir<CR> | |
nnoremap <silent> <C-p><C-f> :FufTaggedFile<CR> | |
nnoremap <silent> <C-p><C-j> :FufJumpList<CR> | |
nnoremap <silent> <C-p><C-g> :FufChangeList<CR> | |
nnoremap <silent> <C-p><C-q> :FufQuickfix<CR> | |
nnoremap <silent> <C-p><C-b> :FufAddBookmark<CR> | |
vnoremap <silent> <C-p><C-b> :FufAddBookmarkAsSelectedText<CR> | |
nnoremap <silent> <C-p><C-e> :FufEditInfo<CR> | |
nnoremap <silent> <C-p><C-r> :FufRenewCache<CR> | |
" for Grep | |
nnoremap <silent> <F3> :Grep<CR> | |
"for lookupfile | |
" 指定英文逗号作为<leader>键 | |
"let mapleader="," | |
" 在指定目录生成filenametags,并使lookupfile将这个文件作为查找源 | |
function SetRootOfTheProject(path) | |
" 进入指定目录 | |
exe 'cd '.a:path | |
" 生成文件标签 | |
exe '!genfiletags' | |
" 获取标签文件的路径 | |
let tagFilePath = genutils#CleanupFileName(a:path.'/filenametags') | |
" 设置LookupFile插件的全局变量,使之以上面生成的标签文件作为查找源 | |
exe "let g:LookupFile_TagExpr='\"".tagFilePath."\"'" | |
endfunction | |
" 设置当前位置为工程的根目录 | |
function SetHereTheRoot() | |
call SetRootOfTheProject('.') | |
endfunction | |
nmap <leader>root :call SetHereTheRoot()<CR> | |
" 从用户的输入获取指定路径,并设置为工程的根目录 | |
function SetSpecifiedPathTheRoot() | |
call SetRootOfTheProject(input('请输入工程根目录的路径:')) | |
endfunction | |
nmap <leader>xroot :call SetSpecifiedPathTheRoot()<CR> | |
" 使用LookupFile打开文件 | |
nmap <leader>o :LookupFile<CR> | |
"F10就會執行檔案內的script | |
autocmd BufRead,BufNewFile *.rb map <F5> :% w !ruby<CR> | |
autocmd BufRead,BufNewFile *.py map <F5> :% w !python<CR> | |
"for minibufexpl.vim | |
let g:miniBufExplMapWindowNavVim = 1 | |
let g:miniBufExplMapWindowNavArrows = 1 | |
let g:miniBufExplMapCTabSwitchBufs = 1 | |
let g:miniBufExplModSelTarget = 1 | |
"for FencView.vim : Autodetect multiple encodings | |
let g:fencview_autodetect = 1 | |
map <F7> :BufExplorer<CR> | |
map <F8> :NERDTree<CR> | |
"开关tag窗口 | |
nnoremap <silent> <F9> :TlistToggle<CR> | |
"使用右侧tag窗口 | |
let Tlist_Use_Right_Window=1 | |
"for Git-vim | |
map <C-g>gd :GitDiff | |
map <C-g>gD :GitDiff --cached | |
map <C-g>gs :GitStatus | |
map <C-g>gl :GitLog | |
map <C-g>ga :GitAdd | |
map <C-g>gA :GitAdd <cfile> | |
map <C-g>gc :GitCommit | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment