为了表示对Ruchee的感谢,首先这是Ruchee的个人网站:http://www.ruchee.com/index.html,他的以前很多的代码都放到Git里面了,里面有链接。
看了整整一天,刚开始学习vim的时候就是用的Ruchee的vimrc脚本,现在终于可以自己写一点了,又认真看了一下Ruchee原来的脚本,虽然还有一些不太懂,但还是赶脚好腻害的样子。
然后自己又加了一点自己东西:——适用于mac, linux平台
1 "Copyright 2013 Xueyang Liu, all rights reserved. 2 "www.cnblogs.com/liuxueyang/ 3 "Hunan University 4 5 6 " ********************SET******************** 7 color lucius 8 "color desert 9 set nocompatible 10 set guifont=Monaco:h16 11 set lines=30 columns=94 12 set nu numberwidth=5 13 set cindent 14 set ai 15 set tabstop=2 16 set shiftwidth=2 17 set mouse=a 18 set autochdir 19 se hlsearch incsearch 20 se ruler 21 set laststatus=2 22 set cmdheight=2 23 syntax on 24 syntax enable 25 filetype plugin indent on 26 filetype indent on 27 filetype plugin on 28 "filetype on 29 "set bg=dark 30 31 " ********************MAP******************** 32 let mapleader="," 33 noremap <space> ve 34 nnoremap <leader>ev :vsplit $MYVIMRC<cr> 35 nnoremap <leader>sv :source $MYVIMRC<cr> 36 nnoremap wt :WMToggle<cr> 37 nnoremap <c-t> :NERDTree<cr> 38 nnoremap <c-a> :Tlist<cr> 39 "在某个单词上加上引号,括号 40 nnoremap <leader>" viw<esc>a"<esc>hbi"<esc>lel 41 nnoremap <leader>' viw<esc>a'<esc>hbi'<esc>lel 42 nnoremap <leader>< viw<esc>a><esc>'<i<<esc>lw 43 "~~~~~~~~~~~~~~~大风歌~~~~~~~~~~~~~~~ 44 vnoremap \ U 45 inoremap <c-d> <esc>ddi 46 inoremap <c-u> <esc>veU 47 inoremap jk <esc> 48 inoremap <esc> <nop> 49 "括号,引号自动补全 50 inoremap ( ()<esc>i 51 inoremap ) <c-r>=ClosePair(')')<cr> 52 inoremap { {}<esc>i 53 inoremap } <c-r>=ClosePair('}')<cr> 54 inoremap [ []<esc>i 55 inoremap ] <c-r>=ClosePair(']')<cr> 56 inoremap " ""<esc>i 57 inoremap ' ''<esc>i 58 onoremap p i( 59 onoremap b /return<cr> 60 61 " ********************OTHER******************** 62 iabbrev @@ www.cnblogs.com/liuxueyang/ 63 iabbrev ccopy Copyright 2013 Xueyang Liu, all rights reserved. 64 autocmd BufWritePre *.html :normal gg=G 65 "下面这些autocmd还没有学会=_= 66 "autocmd FileType C++ nnoremap <buffer> <localleader>c I//<esc> 67 "autocmd FileType javascript nnoremap <buffer> <localleader>c I//<esc> 68 "autocmd FileType javascript :iabbrev <buffer> iff if()<left> 69 "autocmd FileType python nnoremap <buffer> <localleader>c I#<esc> 70 "autocmd FileType python : iabbrev <buffer> iff if:<left> 71 "echo ">^.^<" 72 73 " ********************编译 && 运行******************** 74 " Compile 75 func! CompileCode() 76 exec "w" 77 if &filetype == "c" 78 exec "!gcc -Wall -std=c99 %<.c -o %<" 79 elseif &filetype == "cpp" 80 exec "!g++ -Wall -std=c++98 %<.cpp -o %<" 81 elseif &filetype == "python" 82 exec "!python %<.py" 83 endif 84 endfunc 85 "Run 86 func! RunCode() 87 exec "w" 88 if &filetype == "c" || &filetype == "cpp" 89 exec "! ./%<" 90 elseif &filetype == "python" 91 exec "!python %<.py" 92 endif 93 endfunc 94 "<c-c> OneKey ComplieAndSave 95 nnoremap <c-c> :call CompileCode()<cr> 96 inoremap <c-c> <esc>:call CompileCode()<cr> 97 vnoremap <c-c> <esc>:call CompileCode()<cr> 98 "<c-r> OneKey RunAndSave 99 nnoremap <c-r> :call RunCode()<cr> 100 inoremap <c-r> <esc>:call RunCode()<cr> 101 vnoremap <c-r> <esc>:call RunCode()<cr> 102 "pathogen{ 103 execute pathogen#infect() 104 call pathogen#infect() 105 "} 106 "taglist{ 107 let Tlist_Show_One_File = 1 "只显示当前文件的taglist,默认是显示多个 108 let Tlist_Exit_OnlyWindow = 1 "如果taglist是最后一个窗口,则退出vim 109 let Tlist_Use_Right_Window = 1 "在右侧窗口中显示taglist 110 let Tlist_GainFocus_On_ToggleOpen = 1 "打开taglist时,光标保留在taglist窗口 111 let Tlist_Ctags_Cmd='/opt/local/bin/ctags' "设置ctags命令的位置 112 nnoremap <leader>tl : Tlist<CR> "设置关闭和打开taglist窗口的快捷键 113 "} 114 autocmd BufEnter * call DoWordComplete()
主要部分是抄的Ruchee的=_=