"============================================================================== " File : vhdlcase.vim " Author : M A Aziz Ahmed (aziz@123india.com) " Last update : Sat Apr 10 1999 "============================================================================== " :Upcase should convert all the uncommented vhdl keywords in the entire file " to upper case. " Similarly :Lowcase should convert all the uncommented vhdl keywords in the " entire file to low case "============================================================================== command Upcase call ConvertCase(1) command Lowcase call ConvertCase(0) func! ConvertCase(upCase) " Save current position normal mt " Go to first line and place the cursor on first word normal 1G0 "For all words in the file while (EndOfFile()==0) call WordCase(a:upCase) "Move to next word normal w endwhile " Restore position normal `t endfunction " If the argument upCase is 1, convert to upper case else convert to lower case func! WordCase(upCase) let charType = synIDattr(synID(line("."), col("."),1),"name") if ((charType=="vhdlStatement") || (charType=="vhdlOperator") || (charType=="vhdlAttribute")) "make word up case or low case as required if(a:upCase==1) normal gUe else normal gue endif endif endfunction " check for end of file func! EndOfFile() if (line(".")!=line("$")) let retVal=0 else let currCol=col(".") normal l " if column hasn't changed, end of file has been encountered if (currCol==col(".")) let retVal=1 else "Column has changed, restore original column normal h let retVal=0 endif endif return retVal endfunction