# Comment/uncomment :def com setmark,"0",filt,"sed -e s/^/#/",rtn,gomark,"0" :def uncom setmark,"0",filt,"sed -e s/^#//",rtn,gomark,"0" # line counter :def count setmark,"0",filt,"perl -ne 'BEGIN { $cnt = 1}; s/(.*)/sprintf \"%02d.%s\", $cnt++, $1/e ; print $_'",rtn,gomark,"0" # convert tabs to spaces :def notab setmark,"0",bof,ffirst,"\t",rtn,"r",rtn," ",rtn,"r",gomark,"0" # insert timestamp/date :def stamp insf,"!date \"+%Y%m%d01\"",rtn,nextword,delch :def time insf,"!date \"+%T\"",rtn,nextword :def date insf,"!date",rtn,eol,rtn # UPPERCASE block/word :def uc if,"markv",then,upper,else,psh,nextword,markk,prevword,markb,upper,nextword,pop,endif # LOWERCASE block/word :def lc if,"markv",then,lower,else,psh,nextword,markk,prevword,markb,lower,nextword,pop,endif # SORT block/file :def sort setmark,"0",filt,"sort",rtn,gomark,"0" # UNIX 2 MsDOS conversion :def d setmark,"0",bof,ffirst,"\\n",rtn,"r",rtn,"\x0D\\n",rtn,"r",gomark,"0" # MsDOS 2 UNIX conversion :def u setmark,"0",bof,ffirst,"\r",rtn,"r",rtn,rtn,"r",gomark,"0" # Delete from the current position up to the end of file :def dof psh,markb,eof,markk,blkdel,pop # Delete from the begining of file up to the current position :def dob psh,markk,bof,markb,blkdel,pop # Move line up :def mvlnup bol,psh,markb,dnarw,markk,uparw,uparw,blkmove,pop # Move line down :def mvlndn bol,psh,markb,dnarw,markk,dnarw,blkmove,pop ### Spell check :def spellfile filt,"umask 077; cat >${TMPDIR:-.}/spl.$$ ; aspell check ${TMPDIR:-.}/spl.$$ /dev/tty ; cat ${TMPDIR:-.}/spl.$$; rm -f ${TMPDIR:-.}/{spl.$$,spl.$$.bak}",rtn,retype :def spellword psh,nextword,markk,prevword,markb,filt,"umask 077; cat >${TMPDIR:-.}/spl.$$; aspell check ${TMPDIR:-.}/spl.$$ /dev/tty;tr -d <${TMPDIR:-.}/spl.$$ '\\012' ; rm -f ${TMPDIR:-.}/{spl.$$,spl.$$.bak}",rtn,retype,nextword :def spellfilero filt,"umask 077; cat >${TMPDIR:-.}/spl.$$ ; aspell -l ro check ${TMPDIR:-.}/spl.$$ /dev/tty ; cat ${TMPDIR:-.}/spl.$$; rm -f ${TMPDIR:-.}/{spl.$$,spl.$$.bak}",rtn,retype :def spellwordro psh,nextword,markk,prevword,markb,filt,"umask 077; cat >${TMPDIR:-.}/spl.$$; aspell -l ro check ${TMPDIR:-.}/spl.$$ /dev/tty;tr -d <${TMPDIR:-.}/spl.$$ '\\012' ; rm -f ${TMPDIR:-.}/{spl.$$,spl.$$.bak}",rtn,retype,nextword ### Grep :def grep_find scratch,"*Grep-Log*",rtn,bof,markb,eof," ",markk,blkdel,grep ### RPM # spec file changelog line :def clog setmark,"0",insf,"!date +\"* %a %b %d %Y Marius FERARU - 0-1.n0i.1\"",rtn,dnarw,"- version 0",rtn,gomark,"0" # reform BR to single conditional :def brformat setmark,"0",filt,"perl -pe \'BEGIN {print \"%if %{!?_without_test:1}0\\n\";} END {print \"%endif\\n\"}; s/^[^:]+://; s/}$//\'",rtn,gomark,"0" ### Perl # switch to mason :def mode_mason mode,"ymason",rtn,mode,"i" # filter through 'perltidy' block/file :def perltidy filt,"perltidy",rtn,prevpos :def perltidy2 setmark,"0",filt,"perltidy",rtn,gomark,"0" ### HTML # strip HTML code - LAZY! :def strip_html setmark,"0",filt,"sed -e 's/<[^>]\\+>//g'",rtn,gomark,"0" # make current char HTML accesskey :def accesskey "",rtarw,"" # Generate XML tag :def genxmltag prevword,markb,nextword,markk,filt,"sed \'s@^\\(.*\\)$@<\\1>@\'",rtn,rsrch,"<\x0D" # Tidy HTML :def htmltidy setmark,"0",filt,"tidy --show-body-only yes --show-warnings no --wrap 1000 | grep -v '^$'",rtn,gomark,"0"