背景:
作为一个"代码民工"也得巧干,不然,别以为敲键盘累不死人.我本记得我的.vimrc是很少的几句的,可是一打开,吓坏了,肯定是不知道什么时候拷了别人的东西,而平时也没试着去用,真是浪费呀,现在得好好学学,别让那些好设置白占地方呀.
正文:
set visualbell " Silence the bell, use a flash instead
set cinoptions=:.5s,>1s,p0,t0,(0,g2 " :.5s = indent case statements 1/2 shiftwidth
" >1s = indent 1 shiftwidth
" p0 = indent function definitions 0 spaces
" t0 = indent function return type 0 spaces
" (0 = indent from unclosed parantheses
" g2 = indent C++ scope resolution 2 spaces
set cinwords=if,else,while,do,for,switch,case " Which keywords should indent
set formatoptions=tcqor " t=text, c=comments, q=format with "gq", o,r=autoinsert comment leader
set cindent " indent on cinwords
set shiftwidth=4 " set shiftwidth to 4 spaces
set tabstop=4 " set tab to 4 spaces
set showmatch " Show matching brackets/braces/parantheses.
"set background=dark " set background to dark
set showcmd " Show (partial) command in status line.
set autowrite " Automatically save before commands like :next and :make
set textwidth=98 " My terminal is 98 characters wide
syntax on
set nu
" C Programming
map :execute Clean_up() :source $HOME/.vimrc
map gg:execute License_notice("c_gpl_notice")dd18jO
map ofor(i=0;; i++) {o}kIf;a
map! for(i;; i++) {o}kIf;a
map owhile() {o}kIf(a
map! while() {o}kIf(a
map oif() {o}kf(a
map! if() {o}kf(a
map oswitch() {ocase:break;case:break;default:}6kf(a
map! switch() {ocase:break;case:break;default:}6kf(a
:function! License_notice(file_name)
: let path_file_name = g:VIM_CUSTOM . a:file_name
: :execute 'r ' . path_file_name
:endfunction
" Cleanup
function! Clean_up()
set visualbell&
set cinoptions&
set cinwords&
set formatoptions&
set cindent&
set shiftwidth&
set tabstop&
set showmatch&
set background&
set showcmd&
set autowrite&
set textwidth&
unmap
unmap
unmap
unmap
unmap
endfunction
function Mytitle()
call setline(1,"/**********************************************")
call append(line("."),"作者:自己名字")
call append(line(".")+1,"时间:".strftime("%c"))
call append(line(".")+2,"文件名:".expand("%"))
call append(line(".")+3,"描述:")
call append(line(".")+4,"**********************************************/")
endf
map :call Mytitle():$o
阅读(1715) | 评论(0) | 转发(0) |