
liunx系统终端vinifcfg-ens33更改后保存一直显示记录在编辑/etc/inittab之后,按esc,再键入:冒号,再输入wq,就可以了。
vi在编辑文件时不是正常关闭文件时会自动建立一个隐藏的 .swp文件,若要下次正常打开可以将这个文件删除掉 rm var/tmp/delamam.swp。
完全免费:
Linux是一款免费的 *** 作系统,用户可以通过网络或其他途径免费获得,并可以任意修改其源代码。这是其他的 *** 作系统所做不到的。
正是由于这一点,来自全世界的无数程序员参与了Linux的修改、编写工作,程序员可以根据自己的兴趣和灵感对其进行改变,这让Linux吸收了无数程序员的精华,不断壮大。
完全兼容POSIX1.0标准这使得可以在Linux下通过相应的模拟器运行常见的DOS、Windows的程序。这为用户从Windows转到Linux奠定了基础。许多用户在考虑使用Linux时,就想到以前在Windows下常见的程序是否能正常运行,这一点就消除了他们的疑虑。
回答这个问题很蛋疼啊有一部分参考了插件calendar.vm
将下面2个函数放入vimrc或者在plugin文件夹新建一个.vim文件
调用:
:call Reply_Baidu()<cr>
function MY_Calendar(vyear,vmnth)
" get arguments
let vyear = a:vyear
let vmnth = a:vmnth
" start with last 6 month
let vmnth = vmnth - 6
if vmnth <1
let vmnth = 12 - vmnth
let vyear = vyear - 1
endif
" reset display variables
let vmcnt = 0
while vmcnt <12
let vcolumn = 22
let vnweek = -1
"--------------------------------------------------------------
"--- calculating
"--------------------------------------------------------------
" set boundary of the month
if vmnth == 1
let vmdays = 31
let vparam = 1
let vsmnth = 'Jan'
elseif vmnth == 2
let vmdays = 28
let vparam = 32
let vsmnth = 'Feb'
elseif vmnth == 3
let vmdays = 31
let vparam = 60
let vsmnth = 'Mar'
elseif vmnth == 4
let vmdays = 30
let vparam = 91
let vsmnth = 'Apr'
elseif vmnth == 5
let vmdays = 31
let vparam = 121
let vsmnth = 'May'
elseif vmnth == 6
let vmdays = 30
let vparam = 152
let vsmnth = 'Jun'
elseif vmnth == 7
let vmdays = 31
let vparam = 182
let vsmnth = 'Jul'
elseif vmnth == 8
let vmdays = 31
let vparam = 213
let vsmnth = 'Aug'
elseif vmnth == 9
let vmdays = 30
let vparam = 244
let vsmnth = 'Sep'
elseif vmnth == 10
let vmdays = 31
let vparam = 274
let vsmnth = 'Oct'
elseif vmnth == 11
let vmdays = 30
let vparam = 305
let vsmnth = 'Nov'
elseif vmnth == 12
let vmdays = 31
let vparam = 335
let vsmnth = 'Dec'
else
echo 'Invalid Year or Month'
return
endif
if vyear % 400 == 0
if vmnth == 2
let vmdays = 29
elseif vmnth >= 3
let vparam = vparam + 1
endif
elseif vyear % 100 == 0
if vmnth == 2
let vmdays = 28
endif
elseif vyear % 4 == 0
if vmnth == 2
let vmdays = 29
elseif vmnth >= 3
let vparam = vparam + 1
endif
endif
" calc vnweek of the day
if vnweek == -1
let vnweek = ( vyear * 365 ) + vparam
let vnweek = vnweek + ( vyear/4 ) - ( vyear/100 ) + ( vyear/400 )
if vyear % 4 == 0
if vyear % 100 != 0 || vyear % 400 == 0
let vnweek = vnweek - 1
endif
endif
let vnweek = vnweek - 1
endif
" fix Gregorian
if vyear <= 1752
let vnweek = vnweek - 3
endif
let vnweek = vnweek % 7
"--------------------------------------------------------------
"--- displaying
"--------------------------------------------------------------
" build header
let vdisplay2=vyear.'/'.vmnth.'('
let vdisplay2=strpart(" ",
\ 1,(vcolumn-strlen(vdisplay2))/2-2).vdisplay2
let vdisplay2=vdisplay2.vsmnth.')'."\n"
let vwruler = "Su Mo Tu We Th Fr Sa"
let vdisplay2 = vdisplay2.' '.vwruler."\n"
" build calendar
let vinpcur = 0
while (vinpcur <vnweek)
let vdisplay2=vdisplay2.' '
let vinpcur = vinpcur + 1
endwhile
let vdaycur = 1
let vdisplay2 = vdisplay2.' '
while (vdaycur <= vmdays)
if vmnth <10
let vtarget =vyear."0".vmnth
else
let vtarget =vyear.vmnth
endif
if vdaycur <10
let vtarget = vtarget."0".vdaycur
else
let vtarget = vtarget.vdaycur
endif
let vsign = ''
if vdaycur <10
let vdisplay2=vdisplay2.' '
endif
let vdisplay2=vdisplay2.vdaycur
let vdaycur = vdaycur + 1
" fix Gregorian
if vyear == 1752 &&vmnth == 9 &&vdaycur == 3
let vdaycur = 14
endif
let vinpcur = vinpcur + 1
if vinpcur % 7 == 0
let vdisplay2=vdisplay2."\n"
endif
let vdisplay2 = vdisplay2.' '
endwhile
let vmnth = vmnth + 1
let vmcnt = vmcnt + 1
if vmnth >12
let vmnth = 1
let vyear = vyear + 1
endif
silent put =vdisplay2
endwhile
return
endfunction
function Reply_Baidu()
exe "normal ggdG"
"插入日历
call MY_Calendar(2009,7)
exe "w 2009.txt"
"标题变为2009全年日历
call append(1,"\t2009 Calendar")
"每个月的行数
let jan = search("Jan")
let feb = search("Feb")
let mar = search("Mar")
let apr = search("Apr")
let may = search("May")
let jun = search("Jun")
let jul = search("Jul")
let aug = search("Aug")
let sep = search("Sep")
let oct = search("Oct")
let nov = search("Nov")
let dec = search("Dec")
"移动4-6月
let line = apr
while line <jul
call cursor(line,1)
exe ">"
let line = line + 1
endwhile
"删除123 再恢复 这不蛋疼么
let line = apr-jan
call cursor(jan,1)
exe "normal d".line."d"
exe "normal kp"
"7 8 9 移动到最后
let line = oct - jul
call cursor(jul,1)
exe "normal d".line."d"
exe "normal Gp"
"检测30 并删除
let line = 1
echo line('$')
while line <= line('$')
if getline(line) =~ '\<30\>'
if getline(line) =~ '\<31\>' || getline(line+1) =~ '\<31\>'
let line = line + 1
continue
else
call cursor(line,1)
exe "normal f3d$"
endif
endif
let line = line + 1
endwhile
"最后保存
exe "w 2009.txt"
endfunction
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)