From bfe8019b3402338d9bb06ab8f412155d7a582c70 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Tue, 7 Jul 2020 11:50:43 +0200 Subject: [PATCH 01/53] replace "appearances" with "references" in doc --- README.md | 2 +- doc/rapid.txt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0715089..ed83389 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ A: rapid-for-vim will not override existing mappings unless the corresponding Disable override existing mapping and Vim's default with let g:rapidGoDefinitionKeyMap = 0 - u List all significant appearances of word under cursor. + u List all significant references of word under cursor. Override existing mapping with let g:rapidListUsageKeyMap = 1 diff --git a/doc/rapid.txt b/doc/rapid.txt index e5277a5..bc685db 100644 --- a/doc/rapid.txt +++ b/doc/rapid.txt @@ -1,4 +1,4 @@ -*rapid.txt* Abb Rapid Command for Vim version 7.4 Last change: 20. Feb 2020 +*rapid.txt* Abb Rapid Command for Vim version 7.4 Last change: 10. Jun 2020 VIM REFERENCE MANUAL by Patrick Meiser-Knosowski @@ -121,7 +121,7 @@ A: rapid-for-vim will not override existing mappings unless the corresponding Disable override existing mapping and Vim's default with let g:rapidGoDefinitionKeyMap = 0 - u List all significant appearances of word under cursor. + u List all significant references of word under cursor. Override existing mapping with let g:rapidListUsageKeyMap = 1 @@ -209,7 +209,7 @@ Exceptions may be |g:rapidCompleteCustom| and |g:rapidPathToBodyFiles|. Also see these options for alternative mappings. |g:rapidConcealStructKeyMap| `` - `` change concealing of structure values |g:rapidGoDefinitionKeyMap| `gd` to see declaration of word under cursor -|g:rapidListUsageKeyMap| `u` lists all appearances of current word +|g:rapidListUsageKeyMap| `u` lists all references of current word |g:rapidListDefKeyMap| `f` lists PROC/TRAP/... of current file |g:rapidMoveAroundKeyMap| `[[`, `]]` ... jumps around PROC/TRAP/... |g:rapidFunctionTextObject| `if`, `af` and `aF` def/deffct text objects @@ -445,7 +445,7 @@ Index: |rapid-index| g:rapidListUsageKeyMap: ----------------------- - `u`: List all appearances, outside of enum declarations and comments + `u`: List all references, outside of enum declarations and comments of the word under the cursor in the |quickfix-window|. To force this mapping if `u` is already mapped: > From 889bcf4e56f6082645187538389ae6b21c241d8f Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Tue, 7 Jul 2020 12:01:22 +0200 Subject: [PATCH 02/53] Updt to RW6.10; add missing commands, functions and data types --- syntax/rapid.vim | 57 ++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index cc95992..6c578ad 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -1,8 +1,8 @@ " ABB Rapid Command syntax file for Vim " Language: ABB Rapid Command " Maintainer: Patrick Meiser-Knosowski -" Version: 2.2.0 -" Last Change: 06. Apr 2020 +" Version: 2.2.2 +" Last Change: 26. Jun 2020 " Credits: Thanks for beta testing to Thomas Baginski " " Suggestions of improvement are very welcome. Please email me! @@ -142,15 +142,15 @@ else " syn match rapidAnyType /\v^\s*(global\s+|task\s+|local\s+)?(alias|pers|var|const|func)\s+\w+>/ contains=rapidStorageClass,rapidType,rapidTypeDef " highlight default link rapidAnyType Type syn keyword rapidType aiotrigg bool btnres busstate buttondata byte - syn keyword rapidType cameradev cameratarget cfgdomain clock confdata corrdescr datapos dionum dir dnum + syn keyword rapidType cfgdomain clock confdata corrdescr datapos dionum dir dnum syn keyword rapidType egmframetype egmident egm_minmax egmstate egmstopmode errdomain errnum errstr errtype event_type exec_level extjoint handler_type syn keyword rapidType icondata identno intnum iodev iounit_state jointtarget syn keyword rapidType listitem loaddata loadidnum loadsession mecunit motsetdata syn keyword rapidType num - syn keyword rapidType opcalc opnum orient paridnum paridvalidnum pathrecid pos pose progdisp o_jointtarget o_robtarget + syn keyword rapidType opcalc opnum orient paridnum paridvalidnum pathrecid pnpdata pos pose progdisp o_jointtarget o_robtarget syn keyword rapidType rawbytes restartdata rmqheader rmqmessage rmqslot robjoint robtarget - syn keyword rapidType sensor sensorstate shapedata signalorigin signalai signalao signaldi signaldo signalgi signalgo socketdev socketstatus speeddata stoppointdata string stringdig switch symnum syncident - syn keyword rapidType taskid tasks testsignal tooldata tpnum trapdata triggdata triggios triggiosdnum triggmode triggstrgo tunetype + syn keyword rapidType sensor sensorstate sensorvardata shapedata signalorigin signalai signalao signaldi signaldo signalgi signalgo socketdev socketstatus speeddata stoppointdata string stringdig switch symnum syncident + syn keyword rapidType taskid tasks testsignal tooldata tpnum trapdata triggdata triggios triggiosdnum triggmode triggstrgo tsp_status tunetype syn keyword rapidType uishownum wobjdata wzstationary wztemporary zonedata " SoftMove data types syn keyword rapidType css_offset_dir css_soft_dir cssframe @@ -167,7 +167,7 @@ else " Spot data types syn keyword rapidType gundata spotdata forcedata simdata smeqdata " Continuous Application Platform data types - syn keyword rapidType capdata caplatrackdata capspeeddata captrackdata capweavedata flypointdata processtimes restartblkdata supervtimeouts weavestartdata + syn keyword rapidType capaptrreferencedata capdata caplatrackdata capspeeddata capspeeddata capstopmode captrackdata capweavedata flypointdata processtimes restartblkdata supervtimeouts weavestartdata " Bulls Eye data types syn keyword rapidType be_device be_scan be_tooldesign " Force Control data types @@ -220,19 +220,19 @@ else syn match rapidLabel /\c\v^\s*\a\w*\:\ze%([^=]|$)/ contains=rapidConditional,rapidOperator highlight default link rapidLabel Label " Keyword - syn keyword rapidKeyword AccSet ActEventBuffer ActUnit Add AliasIO AliasIOReset BitClear BitSet BookErrNo BrakeCheck - syn keyword rapidKeyword CallByVar CancelLoad CheckProgRef CirPathMode Clear ClearIOBuff ClearPath ClearRawBytes ClkReset ClkStart ClkStop Close CloseDir ConfJ ConfL CONNECT CopyFile CopyRawBytes CorrClear CorrCon CorrDiscon CorrWrite + syn keyword rapidKeyword AccSet ActEventBuffer ActUnit Add AliasCamera AliasIO AliasIOReset BitClear BitSet BookErrNo BrakeCheck + syn keyword rapidKeyword CallByVar CancelLoad CheckProgRef CirPathMode Clear ClearIOBuff ClearPath ClearRawBytes ClkReset ClkStart ClkStop Close CloseDir ConfJ ConfL CONNECT CopyFile CopyRawBytes CornerPathWarning CorrClear CorrCon CorrDiscon CorrWrite syn keyword rapidKeyword CSSAct CSSForceOffsetAct CSSForceOffsetDeact CSSOffsetTuneCSSOffsetTune syn keyword rapidKeyword DeactEventBuffer DeactUnit Decr DitherAct DitherDeact DropSensor syn keyword rapidKeyword EGMActJoint EGMActMove EGMActPose EGMGetId EGMReset EGMSetupAI EGMSetupAO EGMSetupGI EGMSetupLTAPP EGMSetupUC EOffsOff EOffsOn EOffsSet EraseModule ErrLog ErrWrite - syn keyword rapidKeyword FricIdInit FricIdEvaluate FricIdSetFricLevels - syn keyword rapidKeyword GetDataVal GetJointData GetSysData GetTrapData GripLoad HollowWristReset IDelete IDisable IEnable IError Incr IndReset InvertDO IOBusStart IOBusState IODisable IOEnable IPers IRMQMessage ISignalAI ISignalAO ISignalDI ISignalDO ISignalGI ISignalGO ISleep ITimer IVarValue IWatch - syn keyword rapidKeyword Load LoadId MatrixSVD MatrixSolve MatrixSolveQR MakeDir ManLoadIdProc MechUnitLoad MotionProcessModeSet MotionSup MToolRotCalib MToolTCPCalib Open OpenDir - syn keyword rapidKeyword PackDNHeader PackRawBytes PathAccLim PathRecStart PathRecStop PathResol PDispOff PDispOn PDispSet ProcerrRecovery PrxActivAndStoreRecord PrxActivRecord PrxDbgStoreRecord PrxDeactRecord PrxResetPos PrxResetRecords PrxSetPosOffset PrxSetRecordSampleTime PrxSetSyncalarm PrxStartRecord PrxStopRecord PrxStoreRecord PrxUseFileRecord PulseDO - syn keyword rapidKeyword ReadAnyBin ReadBlock ReadCfgData ReadErrData ReadRawBytes RemoveAllCyclicBool RemoveCyclicBool RemoveDir RemoveFile RenameFile Reset ResetAxisMoveTime ResetPPMoved ResetRetryCount RestoPath Rewind RMQEmptyQueue RMQFindSlot RMQGetMessage RMQGetMsgData RMQGetMsgHeader RMQReadWait RMQSendMessage RMQSendWait - syn keyword rapidKeyword SafetyControllerSyncRequest Save SaveCfgData SCWrite SenDevice Set SetAllDataVal SetAO SetDataSearch SetDataVal SetDO SetGO SetLeadThrough SetSysData SetupCyclicBool SiConnect SiClose SiGetCyclic SingArea SiSetCyclic SkipWarn SocketAccept SocketBind SocketClose SocketConnect SocketCreate SocketListen SocketReceive SocketReceiveFrom SocketSend SocketSendTo SoftAct SoftDeact SpeedLimAxis SpeedLimCheckPoint SpeedRefresh SpyStart SpyStop StartLoad STCalib STClose STIndGun STIndGunReset SToolRotCalib SToolTCPCalib STOpen StorePath STTune STTuneReset SupSyncSensorOff SupSyncSensorOn SyncMoveOff SyncMoveOn SyncMoveResume SyncMoveSuspend SyncMoveUndo SyncToSensor SystemStopAction + syn keyword rapidKeyword FitCircle FricIdInit FricIdEvaluate FricIdSetFricLevels + syn keyword rapidKeyword GetDataVal GetGroupSignalInfo GetJointData GetSysData GetTorqueMargin GetTrapData GripLoad HollowWristReset IDelete IDisable IEnable IError Incr IndReset InvertDO IOBusStart IOBusState IODisable IOEnable IPers IRMQMessage ISignalAI ISignalAO ISignalDI ISignalDO ISignalGI ISignalGO ISleep ITimer IVarValue IWatch + syn keyword rapidKeyword Load LoadId MakeDir ManLoadIdProc MatrixSolve MatrixSolveQR MatrixSVD MechUnitLoad MotionProcessModeSet MotionSup MToolRotCalib MToolTCPCalib Open OpenDir + syn keyword rapidKeyword PackDNHeader PackRawBytes PathAccLim PathLengthReset PathLengthStart PathLengthStop PathRecStart PathRecStop PathResol PDispOff PDispOn PDispSet ProcerrRecovery PrxActivAndStoreRecord PrxActivRecord PrxDbgStoreRecord PrxDeactRecord PrxResetPos PrxResetRecords PrxSetPosOffset PrxSetRecordSampleTime PrxSetSyncalarm PrxStartRecord PrxStopRecord PrxStoreRecord PrxUseFileRecord PulseDO + syn keyword rapidKeyword ReadAnyBin ReadBlock ReadCfgData ReadErrData ReadRawBytes ReadVarArr RemoveAllCyclicBool RemoveCyclicBool RemoveDir RemoveFile RenameFile Reset ResetAxisDistance ResetAxisMoveTime ResetPPMoved ResetRetryCount ResetTorqueMargin RestoPath Rewind RMQEmptyQueue RMQFindSlot RMQGetMessage RMQGetMsgData RMQGetMsgHeader RMQReadWait RMQSendMessage RMQSendWait + syn keyword rapidKeyword SafetyControllerSyncRequest Save SaveCfgData SCWrite SenDevice Set SetAllDataVal SetAO SetDataSearch SetDataVal SetDO SetGO SetLeadThrough SetSysData SetupCyclicBool SiConnect SiClose SiGetCyclic SingArea SiSetCyclic SkipWarn SocketAccept SocketBind SocketClose SocketConnect SocketCreate SocketListen SocketReceive SocketReceiveFrom SocketSend SocketSendTo SoftAct SoftDeact SoftElbow SpeedLimAxis SpeedLimCheckPoint SpeedRefresh SpyStart SpyStop StartLoad STCalib STClose STIndGun STIndGunReset SToolRotCalib SToolTCPCalib STOpen StorePath STTune STTuneReset SupSyncSensorOff SupSyncSensorOn SyncMoveOff SyncMoveOn SyncMoveResume SyncMoveSuspend SyncMoveUndo SyncToSensor SystemStopAction syn keyword rapidKeyword TestSignDefine TestSignReset TextTabInstall TPErase TPReadDnum TPReadFK TPReadNum TPShow TPWrite TriggCheckIO TriggDataCopy TriggDataReset TriggEquip TriggInt TriggIO TriggRampAO TriggSpeed TriggStopProc TryInt TuneReset TuneServo - syn keyword rapidKeyword UIMsgBox UIMsgWrite UIMsgWriteAbort UIShow UnLoad UnpackRawBytes VelSet WaitAI WaitAO WaitDI WaitDO WaitGI WaitGO WaitLoad WaitRob WaitSensor WaitSyncTask WaitTestAndSet WaitTime WaitUntil WarmStart WITH WorldAccLim Write WriteAnyBin WriteBin WriteBlock WriteCfgData WriteRawBytes WriteStrBin WriteVar WZBoxDef WZCylDef WZDisable WZDOSet WZEnable WZFree WZHomeJointDef WZLimJointDef WZLimSup WZSphDef + syn keyword rapidKeyword UIMsgBox UIMsgWrite UIMsgWriteAbort UIShow UnLoad UnpackRawBytes VelSet WaitAI WaitAO WaitDI WaitDO WaitGI WaitGO WaitLoad WaitRob WaitSensor WaitSyncTask WaitTestAndSet WaitTime WaitUntil WarmStart WITH WorldAccLim Write WriteAnyBin WriteBin WriteBlock WriteCfgData WriteRawBytes WriteStrBin WriteVar WriteVarArr WZBoxDef WZCylDef WZDisable WZDOSet WZEnable WZFree WZHomeJointDef WZLimJointDef WZLimSup WZSphDef " arc instructions syn keyword rapidKeyword ArcRefresh RecoveryMenu RecoveryMenuWR RecoveryPosSet RecoveryPosReset SetWRProcName " conveyor tracking instructions @@ -242,13 +242,13 @@ else " arc Weldguide and MultiPass instructions syn keyword rapidKeyword MPSavePath MPLoadPath MPReadInPath MPOffsEaxOnPath " Paint instructions - syn keyword rapidKeyword SetBrush SetBrushFac + syn keyword rapidKeyword IndexLookup IpsCommand IpsGetParam IpsSetParam PaintCommand PntProdUserLog PntQueueExtraGet PntQueueExtraSet PntQueuePeek SetBrush SetBrushFac " Spot instructions syn keyword rapidKeyword SetForce Calibrate ReCalcTCP IndGunMove IndGunMoveReset OpenHighLift CloseHighLift SwSetIntSpotData SwSetIntForceData SwSetIntGunData SwSetIntSimData SwGetCalibData SwGetFixTipData " dispense instructions - syn keyword rapidKeyword SetTmSignal + syn keyword rapidKeyword SetTmSignal SyncWWObj " Continuous Application Platform instructions - syn keyword rapidKeyword CapAPTrSetup CapCondSetDO CapEquiDist CapLATrSetup CapNoProcess CapRefresh CapWeaveSync ICap InitSuperv IPathPos RemoveSuperv SetupSuperv + syn keyword rapidKeyword CapAPTrSetup CapAPTrSetupAI CapAPTrSetupAO CapAPTrSetupPERS CapCondSetDO CapEquiDist CapNoProcess CapRefresh CAPSetStopMode CapWeaveSync ICap InitSuperv IPathPos RemoveSuperv SetupSuperv " Bulls Eye instructions syn keyword rapidKeyword BECheckTcp BEDebugState BERefPointer BESetupToolJ BETcpExtend BEUpdateTcp " Force Control instructions @@ -272,16 +272,17 @@ else syn keyword rapidMovement ArcRepL ArcAdaptLStart ArcAdaptL ArcAdaptC ArcAdaptLEnd ArcAdaptCEnd ArcCalcLStart ArcCalcL ArcCalcC ArcCalcLEnd ArcCalcCEnd ArcAdaptRepL syn keyword rapidMovement Break " Continuous Application Platform instructions - syn keyword rapidMovement CapC CapL CSSDeactMoveL ContactL + syn keyword rapidMovement CapC CapL CapLATrSetup CSSDeactMoveL ContactL " dispense instructions syn keyword rapidMovement DispL DispC syn keyword rapidMovement EGMMoveC EGMMoveL EGMRunJoint EGMRunPose EGMStop syn keyword rapidMovement IndAMove IndCMove IndDMove IndRMove syn keyword rapidMovement MoveAbsJ MoveC MoveExtJ MoveJ MoveL syn keyword rapidMovement MoveCAO MoveCDO MoveCGO MoveCSync MoveJAO MoveJDO MoveJGO MoveJSync MoveLAO MoveLDO MoveLGO MoveLSync + syn keyword rapidMovement MovePnP syn keyword rapidMovement NutL NutJ syn keyword rapidMovement PathRecMoveBwd PathRecMoveFwd - syn keyword rapidMovement PaintL PaintC + syn keyword rapidMovement PaintL PaintLDO PaintC syn keyword rapidMovement StartMove StartMoveRetry StepBwdPath StopMove StopMoveReset " Spot instructions syn keyword rapidMovement SpotL SpotJ SpotML SpotMJ CalibL CalibJ MeasureWearL @@ -308,27 +309,27 @@ else " BuildInFunction {{{ " dispense functions - syn keyword rapidBuildInFunction contained GetSignal + syn keyword rapidBuildInFunction contained GetSignal GetSignalDnum " Integrated Vision Platform functions syn keyword rapidBuildInFunction contained CamGetExposure CamGetLoadedJob CamGetName CamNumberOfResults " Continuous Application Platform functions syn keyword rapidBuildInFunction contained CapGetFailSigs syn keyword rapidBuildInFunction contained Abs AbsDnum ACos ACosDnum AInput AOutput ArgName ASin ASinDnum ATan ATanDnum ATan2 ATan2Dnum syn keyword rapidBuildInFunction contained BitAnd BitAndDnum BitCheck BitCheckDnum BitLSh BitLShDnum BitNeg BitNegDnum BitOr BitOrDnum BitRSh BitRShDnum BitXOr BitXOrDnum ByteToStr - syn keyword rapidBuildInFunction contained CalcJointT CalcRobT CalcRotAxFrameZ CalcRotAxisFrame CamGetExposure CamGetLoadedJob CamGetName CamNumberOfResults CDate CJointT ClkRead CorrRead Cos CosDnum CPos CRobT CSpeedOverride CTime CTool CWObj + syn keyword rapidBuildInFunction contained CalcJointT CalcRobT CalcRotAxFrameZ CalcRotAxisFrame CDate CJointT ClkRead CorrRead Cos CosDnum CPos CRobT CrossProd CSpeedOverride CTime CTool CWObj syn keyword rapidBuildInFunction contained DecToHex DefAccFrame DefDFrame DefFrame Dim DInput Distance DnumToNum DnumToStr DotProd DOutput syn keyword rapidBuildInFunction contained EGMGetState EulerZYX EventType ExecHandler ExecLevel Exp syn keyword rapidBuildInFunction contained FileSize FileTime FileTimeDnum FSSize - syn keyword rapidBuildInFunction contained GetMaxNumberOfCyclicBool GetMecUnitName GetModalPayLoadMode GetMotorTorque GetNextCyclicBool GetNextMechUnit GetNextSym GetNumberOfCyclicBool GetServiceInfo GetSignalOrigin GetSysInfo GetTaskName GetTime GInput GInputDnum GOutput GOutputDnum + syn keyword rapidBuildInFunction contained GetAxisDistance GetAxisMoveTime GetMaxNumberOfCyclicBool GetMecUnitName GetModalPayLoadMode GetMotorTorque GetNextCyclicBool GetNextMechUnit GetNextSym GetNumberOfCyclicBool GetServiceInfo GetSignalOrigin GetSysInfo GetTaskName GetTime GetTSPStatus GetUASUserName GInput GInputDnum GOutput GOutputDnum syn keyword rapidBuildInFunction contained HexToDec - syn keyword rapidBuildInFunction contained IndInpos IndSpeed IOUnitState IsCyclicBool IsFile IsLeadThrough IsMechUnitActive IsPers IsStopMoveAct IsStopStateEvent IsSyncMoveOn IsSysId IsVar - syn keyword rapidBuildInFunction contained MaxRobSpeed MirPos ModExist ModTime ModTimeDnum MotionPlannerNo + syn keyword rapidBuildInFunction contained IndInpos IndSpeed IOUnitState IsBrakeCheckActive IsCyclicBool IsFile IsLeadThrough IsMechUnitActive IsPers IsStopMoveAct IsStopStateEvent IsSyncMoveOn IsSysId IsVar + syn keyword rapidBuildInFunction contained Max MaxExtLinearSpeed MaxExtReorientSpeed MaxRobReorientSpeed MaxRobSpeed Min MirPos ModExist ModTime ModTimeDnum MotionPlannerNo syn keyword rapidBuildInFunction contained NonMotionMode NOrient NumToDnum NumToStr syn keyword rapidBuildInFunction contained Offs OpMode OrientZYX ORobT - syn keyword rapidBuildInFunction contained ParIdPosValid ParIdRobValid PathLevel PathRecValidBwd PathRecValidFwd PFRestart PoseInv PoseMult PoseVect Pow PowDnum PPMovedInManMode Present ProgMemFree PrxGetMaxRecordpos + syn keyword rapidBuildInFunction contained ParIdPosValid ParIdRobValid PathLengthGet PathLevel PathRecValidBwd PathRecValidFwd PFRestart PoseInv PoseMult PoseVect Pow PowDnum PPMovedInManMode Present ProgMemFree PrxGetMaxRecordpos syn keyword rapidBuildInFunction contained RawBytesLen ReadBin ReadDir ReadMotor ReadNum ReadStr ReadStrBin ReadVar RelTool RemainingRetries RMQGetSlotName RobName RobOS Round RoundDnum RunMode syn keyword rapidBuildInFunction contained SafetyControllerGetChecksum SafetyControllerGetOpModePinCode SafetyControllerGetSWVersion SafetyControllerGetUserChecksum Sin SinDnum SocketGetStatus SocketPeek Sqrt SqrtDnum STCalcForce STCalcTorque STIsCalib STIsClosed STIsIndGun STIsOpen StrDigCalc StrDigCmp StrFind StrLen StrMap StrMatch StrMemb StrOrder StrPart StrToByte StrToVal - syn keyword rapidBuildInFunction contained Tan TanDnum TaskRunMec TaskRunRob TasksInSync TestAndSet TestDI TestSignRead TextGet TextTabFreeToUse TextTabGet TriggDataValid Trunc TruncDnum Type + syn keyword rapidBuildInFunction contained Tan TanDnum TaskRunMec TaskRunRob TasksInSync TaskIsActive TaskIsExecuting TestAndSet TestDI TestSignRead TextGet TextTabFreeToUse TextTabGet TriggDataValid Trunc TruncDnum Type syn keyword rapidBuildInFunction contained UIAlphaEntry UIClientExist UIDnumEntry UIDnumTune UIListView UIMessageBox UINumEntry UINumTune syn keyword rapidBuildInFunction contained ValidIO ValToStr Vectmagn " Bulls Eye functions From 1ea70549a863b9c92948e7e52f530a4356ecc961 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Tue, 7 Jul 2020 12:10:38 +0200 Subject: [PATCH 03/53] add missing Continuous Application Platform constants --- syntax/rapid.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index 6c578ad..d380160 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -498,6 +498,8 @@ else syn keyword rapidConstant PW_EQUIP_ERR " Bulls Eye syn keyword rapidConstant BESuccess BENoOverwrite BENoNameMatch BENoBEDataMod BEArrayFull BEToolNotFound BEInvalidSignal BEAliasSet BERangeLimFail BERangeSingFail BERangeTiltFail BEScanPlaneErr BEBFrameNotRead BEScanRadZero BEHeightSrchErr BEBeamNotFound BEBeamSpinErr BESrchErrInBeam BESrchErrNoDet BENumOfScansErr BEDiaZeroOrLess BESliceCountErr BEGetNewTcpMax BEBeamOriFail BEGetTcpDelErr BERefPosSetErr BERefToolSetErr BERefBeamSetErr BEBFrameDefErr BESetupAlready BERefResetErr BESetupFailed BEToolNotSet BEStartChanged BEBeamMoveErr BECheckTcp BECheckErr BESkipUpdate BEStrtningErr BEAllNotSet BEQuikRefNotDef BEConvergErr BEInstFwdErr BEGetGantryErr BEUnknownErr + " Continuous Application Platform constants + syn keyword rapidConstant CAP_START START_PRE PRE_STARTED START_MAIN MAIN_STARTED STOP_WEAVESTART WEAVESTART_REGAIN MOTION_DELAY STARTSPEED_TIME MAIN_MOTION MOVE_STARTED RESTART NEW_INSTR AT_POINT AT_RESTARTPOINT LAST_SEGMENT PROCESS_END_POINT END_MAIN MAIN_ENDED PATH_END_POINT PROCESS_ENDED END_POST1 POST1_ENDED END_POST2 POST2_ENDED CAP_STOP CAP_PF_RESTART EQUIDIST AT_ERRORPOINT FLY_START FLY_END LAST_INSTR_ENDED END_PRE PRE_ENDED START_POST1 POST1_STARTED START_POST2 POST2_STARTED " Machine Tending grppos syn keyword rapidConstant gsOpen gsVacuumOff gsBackward gsClose gsVacuumOn gsForward gsReset " Machine Tending grpaction From 736db1adb9cf61a8febf1b0b9b693517b3171286 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Wed, 8 Jul 2020 13:49:52 +0200 Subject: [PATCH 04/53] Fix error/string/char code highlight; restructure --- syntax/rapid.vim | 218 ++++++++++++++++++++++++----------------------- 1 file changed, 111 insertions(+), 107 deletions(-) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index d380160..c6afa1d 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -2,7 +2,7 @@ " Language: ABB Rapid Command " Maintainer: Patrick Meiser-Knosowski " Version: 2.2.2 -" Last Change: 26. Jun 2020 +" Last Change: 08. Jul 2020 " Credits: Thanks for beta testing to Thomas Baginski " " Suggestions of improvement are very welcome. Please email me! @@ -63,50 +63,73 @@ endif syn case ignore " }}} init -" {{{ highlighting for *.cfg -if bufname("%") =~ '\c\.cfg$' +" common highlighting {{{ + +" Error {{{ +if get(g:,'rapidShowError',1) + " + " This error must be defined befor rapidCharCode and rapidEscapedBackSlash + " a string containing a single \ which is not a char code + syn match rapidErrorSingleBackslash /\\/ contained + highlight default link rapidErrorSingleBackslash Error + " +endif +" }}} Error - " Constant values - " Boolean - syn keyword rapidBoolean True False Edge High Low - highlight default link rapidBoolean Boolean - " Float (num) - syn match rapidFloat /\v%(\W|_)@1<=[+-]?\d+\.?\d*%(\s*[eE][+-]?\d+)?/ - highlight default link rapidFloat Float - " character code in string - syn match rapidCharCode /[^\\]\zs\\\d\{1,3}/ contained - highlight default link rapidCharCode SpecialChar - " String. Note: Don't rename group rapidString. Indent depend on this - syn region rapidString start=/"/ end=/"/ contains=rapidCharCode - highlight default link rapidString String - " --- +" Constant values {{{ +" Boolean +syn keyword rapidBoolean True False Edge High Low +highlight default link rapidBoolean Boolean +" Float (num) +syn match rapidFloat /\v%(\W|_)@1<=[+-]?\d+\.?\d*%(\s*[eE][+-]?\d+)?/ +highlight default link rapidFloat Float +" String. Note: Don't rename group rapidString. Indent depend on this +syn region rapidString matchgroup=rapidString start=/"/ skip=/""/ end=/"/ contains=rapidCharCode,rapidEscapedBackSlash,rapidStringDoubleQuote,rapidErrorSingleBackslash,rapidErrorStringTooLong +highlight default link rapidString String +" two adjacent "" in string for one double quote +syn match rapidStringDoubleQuote /""/ contained +highlight default link rapidStringDoubleQuote SpecialChar +" character code in string +syn match rapidCharCode /\\\x\x/ contained +highlight default link rapidCharCode SpecialChar +" escaped \ in string +syn match rapidEscapedBackSlash /\\\\/ contained +highlight default link rapidEscapedBackSlash SpecialChar +" }}} Constant values - " special chars +" }}} common highlighting + +if bufname("%") =~ '\c\.cfg$' +" {{{ highlighting for *.cfg + + " special chars {{{ syn match rapidOperator /:\|[+-]\|\*\|\/\|\\/ syn match rapidOperator /^#/ highlight default link rapidOperator Operator - " --- + " }}} special chars - " sections + " sections {{{ syn match rapidException /^\w\+/ syn match rapidException /CFG\ze_/ highlight default link rapidException Exception - " --- + " }}} sections - " Error + " Error {{{ if get(g:,'rapidShowError',1) - syn match rapidError11 /[^"]\{80}\zs[^"]\+/ containedin=rapidString - highlight default link rapidError11 Error - syn match rapidError12 /-Name "[^"]\{33,}"/ - highlight default link rapidError12 Error + " + " This error must be defined after rapidString + " Any Name longer than 32 chars + syn match rapidErrorNameTooLong /-Name "[^"]\{33,}"/ + highlight default link rapidErrorNameTooLong Error + " endif - " --- -else -" }}} highlighting for *.cfg + " }}} Error -" highlighting for *.mod, *.sys and *.prg + " }}} highlighting for *.cfg +else + " highlighting for *.mod, *.sys and *.prg {{{ -" Comment {{{ + " Comment {{{ " TODO Comment syn match rapidTodoComment contained /\\|\\|\/ highlight default link rapidTodoComment Todo @@ -116,14 +139,14 @@ else " Line comment syn match rapidComment /!.*$/ contains=rapidTodoComment,rapidDebugComment highlight default link rapidComment Comment -" }}} Comment + " }}} Comment -" Header {{{ + " Header {{{ syn match rapidHeader /^%%%/ highlight default link rapidHeader PreProc -" }}} Header + " }}} Header -" Operator {{{ + " Operator {{{ " Boolean operator syn keyword rapidOperator and or xor not div mod " Arithmetic and compare operator @@ -131,9 +154,9 @@ else " conditional argument syn match rapidOperator /?/ highlight default link rapidOperator Operator -" }}} Operator + " }}} Operator -" Type, StorageClass and Typedef {{{ + " Type, StorageClass and Typedef {{{ " anytype (preceded by 'alias|pers|var|const|func' " TODO: still missing are userdefined types which are part of a parameter: " proc message( mystring msMessagePart1{}, @@ -182,29 +205,14 @@ else " structures or strorage classes syn keyword rapidTypeDef MODULE ENDMODULE PROC ERROR UNDO BACKWARD ENDPROC RECORD ENDRECORD TRAP ENDTRAP FUNC ENDFUNC highlight default link rapidTypeDef TypeDef -" }}} Type, StorageClass and Typedef + " }}} Type, StorageClass and Typedef -" Delimiter {{{ + " Delimiter {{{ syn match rapidDelimiter /[\\(){},;|\[\]]/ highlight default link rapidDelimiter Delimiter -" }}} Delimiter - -" Constant values {{{ - " Boolean - syn keyword rapidBoolean True False Edge High Low - highlight default link rapidBoolean Boolean - " Float (num) - syn match rapidFloat /\v\W@1<=[+-]?\d+\.?\d*%(\s*[eE][+-]?\d+)?/ - highlight default link rapidFloat Float - " String. Note: Don't rename group rapidString. Indent depend on this - syn region rapidString start=/"/ end=/"/ contains=rapidCharCode - highlight default link rapidString String - " character code in string - syn match rapidCharCode /[^\\]\zs\\\d\{1,3}/ contained - highlight default link rapidCharCode SpecialChar -" }}} Constant values + " }}} Delimiter -" Statements, keywords et al {{{ + " Statements, keywords et al {{{ " syn keyword rapidStatement " highlight default link rapidStatement Statement " Conditional @@ -262,9 +270,9 @@ else syn keyword rapidException Exit ErrRaise ExitCycle Raise RaiseToUser Retry Return TryNext syn match rapidException /^\s*Stop\s*[\\;]/me=e-1 highlight default link rapidException Exception -" }}} Statements, keywords et al + " }}} Statements, keywords et al -" special keyword for move command {{{ + " special keyword for move command {{{ " arc instructions syn keyword rapidMovement ArcC ArcC1 ArcC2 ArcCEnd ArcC1End ArcC2End ArcCStart ArcC1Start ArcC2Start syn keyword rapidMovement ArcL ArcL1 ArcL2 ArcLEnd ArcL1End ArcL2End ArcLStart ArcL1Start ArcL2Start ArcMoveExtJ @@ -296,18 +304,18 @@ else else highlight default link rapidMovement Special endif -" }}} special keyword for move command + " }}} special keyword for move command -" Structure value {{{ + " Structure value {{{ syn match rapidNames /[a-zA-Z_][.a-zA-Z0-9_]*/ " highlight default link rapidNames None " rapid structrure values. added to be able to conceal them - syn region rapidConcealableString start=/"/ end=/"/ contained contains=rapidCharCode conceal + syn region rapidConcealableString start=/"/ end=/"/ contained contains=rapidCharCode,rapidEscapedBackSlash,rapidErrorSingleBackslash,rapidErrorStringTooLong conceal highlight default link rapidConcealableString String syn region rapidStructVal matchgroup=rapidDelimiter start=/\[/ end=/\]/ contains=ALLBUT,rapidString keepend extend conceal cchar=* -" }}} Structure value + " }}} Structure value -" BuildInFunction {{{ + " BuildInFunction {{{ " dispense functions syn keyword rapidBuildInFunction contained GetSignal GetSignalDnum " Integrated Vision Platform functions @@ -347,16 +355,16 @@ else else highlight default link rapidBuildInFunction Function endif -" }}} + " }}} -" Function {{{ + " Function {{{ syn match rapidFunction contains=rapidBuildInFunction /\v\c%(<(proc|module)\s+)@1032 chars are not possible in rapid. a234567890123456789012345 - syn match rapidError0 /\w\{33,}/ containedin=rapidFunction,rapidNames,rapidLabel - " - " a string containing a single \ which is not a char code - syn match rapidError1 contained containedin=rapidString /\c\v[^\\]\zs\\\ze[^\\0-9]/ + syn match rapidErrorIdentifierNameTooLong /\w\{33,}/ containedin=rapidFunction,rapidNames,rapidLabel + highlight default link rapidErrorIdentifierNameTooLong Error " - " WaitUntil a==b ok - " || - syn match rapidError4 /\c\v%(^\s*%(Return|WaitUntil)>[^!\\]+[^!<>])@<=%(\=|:)\=/ - syn match rapidError5 /\c\v%(^\s*if>[^!\\]+[^!<>])@<=%(\=|:)\=\ze[^!]*then/ - syn match rapidError6 /\c\v%(^\s*while>[^!\\]+[^!<>])@<=%(\=|:)\=\ze[^!]*do/ + " a == b + 1 + syn match rapidErrorShouldBeColonEqual /\c\v%(^\s*%(%(global\s+|task\s+|local\s+)?%(var|pers|const)\s+\w+\s+)?\w+%(\w|\{|,|\}|\+|\-|\*|\/|\.)*\s*)@<=\=/ + highlight default link rapidErrorShouldBeColonEqual Error " - " WaitUntil a=>b ok - " || - syn match rapidError7 /\c\v%(^\s*%(Return|WaitUntil|if|while)>[^!]+[^!<>])@<=\=[><]/ + " WaitUntil a==b + syn match rapidErrorShouldBeEqual /\c\v%(^\s*(Return|WaitUntil|if|elseif|while)>[^!\\]+[^!<>])@<=%(\=|:)\=/ + highlight default link rapidErrorShouldBeEqual Error " - " WaitUntil a>\s*\b + syn match rapidErrorShoudBeLessOrGreaterEqual /\c\v%(^\s*%(Return|WaitUntil|if|elseif|while)>[^!]+[^!<>])@<=\=[><]/ + highlight default link rapidErrorShoudBeLessOrGreaterEqual Error " - " if (a==5) (b==6) ok - " ||| - syn match rapidError9 /\c\v%(^\s*%(Return|WaitUntil|if|while)[^!]+[^!])@<=\)\s*\(/ + " WaitUntil a>\s*\ Date: Wed, 8 Jul 2020 16:51:22 +0200 Subject: [PATCH 05/53] fix false positive of rapidErrorShouldBeEqual in compact if --- syntax/rapid.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index c6afa1d..d3b5296 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -541,7 +541,8 @@ else highlight default link rapidErrorShouldBeColonEqual Error " " WaitUntil a==b - syn match rapidErrorShouldBeEqual /\c\v%(^\s*(Return|WaitUntil|if|elseif|while)>[^!\\]+[^!<>])@<=%(\=|:)\=/ + syn match rapidErrorShouldBeEqual /\c\v%(^\s*(Return|WaitUntil|while)>[^!\\]+[^!<>])@<=%(\=|:)\=/ + syn match rapidErrorShouldBeEqual /\c\v%(^\s*(if|elseif)>[^!\\]+[^!<>])@<=%(\=|:)\=\ze[^!\\]+/ highlight default link rapidErrorShouldBeEqual Error " " WaitUntil a=>b From 4cb09a74b7395453fee2a56ab7050935d6c958d0 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Thu, 9 Jul 2020 01:15:56 +0200 Subject: [PATCH 06/53] simplify patterns; may be regression --- indent/rapid.vim | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/indent/rapid.vim b/indent/rapid.vim index 24b1e8d..2838547 100644 --- a/indent/rapid.vim +++ b/indent/rapid.vim @@ -1,8 +1,8 @@ " ABB Rapid Command indent file for Vim " Language: ABB Rapid Command " Maintainer: Patrick Meiser-Knosowski -" Version: 2.0.1 -" Last Change: 11. Feb 2020 +" Version: 2.2.2 +" Last Change: 09. Jul 2020 " Credits: Based on indent/vim.vim " " Suggestions of improvement are very welcome. Please email me! @@ -90,31 +90,33 @@ function s:GetRapidIndentIntern() \|trap\s+\w \) \|[^!]*\s*(!.*)?$ - \|else\s*(!.*)?$ + \|else> \|[^!]*\s*(!.*)?$ - \|[^!]*[^!]+: - \|[^!"]*\s*: + \|case>[^!]+: + \|default>\s*: \)' \) if l:i >= 0 let l:ind += &sw endif - let l:i = match(l:preNoneBlankLine, '\c\v^\s*(backward|error|undo)\s*(!.*)?$') + let l:i = match(l:preNoneBlankLine, '\c\v^\s*(backward|error|undo)>') if l:i >= 0 let l:ind += &sw endif " Subtract a 'shiftwidth' if l:currentLine =~ '\c\v^\s* - \(end(module|record|proc|func|trap|if|for|while|test)\s*(!.*)?$ - \|[^!]*else\s*(!.*)?$ - \|[^!]*elseif>(\W|$) - \|[^!]*[^!]+: - \|[^!]*\s*: + \( + \end(module|record|proc|func|trap)> + \|end(if|for|while|test)> + \|else> + \|elseif> + \|case>[^!]+: + \|default>\s*: \)' let l:ind -= &sw endif - if l:currentLine =~ '\c\v^\s*(backward|error|undo)\s*(!.*)?$' + if l:currentLine =~ '\c\v^\s*(backward|error|undo)>' let l:ind -= &sw endif From 9e97a37b5cff435ffa184cd8cece4a1aae339906 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Thu, 9 Jul 2020 01:24:20 +0200 Subject: [PATCH 07/53] add s:RapidLenTilStr() to simplify s:RapidLoneParen() and for later use --- indent/rapid.vim | 86 +++++++++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 37 deletions(-) diff --git a/indent/rapid.vim b/indent/rapid.vim index 2838547..03d6fe0 100644 --- a/indent/rapid.vim +++ b/indent/rapid.vim @@ -137,16 +137,45 @@ function s:GetRapidIndentIntern() return l:ind endfunction -function s:RapidLoneParen(lnum,lchar) - " init +" Returns the length of the line until a:str is found outside a string or +" comment. Search start at a:start +" Note: rapidTodoComment and rapidDebugComment are not taken into account +function s:RapidLenTilStr(lnum,str,start) let s:line = getline(a:lnum) + let s:len = strlen(s:line) - if s:len == 0 - return 0 - endif - let s:opnParen = 0 - let s:clsParen = 0 - " + " if s:len >= 4096 + " return 4096 " line too long; ignored + " endif + + let s:i = a:start + while s:i < s:len + let s:i = stridx(s:line, a:str, s:i) + if s:i >= 0 + \&& synIDattr(synID(a:lnum,s:i+1,0),"name") != "rapidString" + \&& synIDattr(synID(a:lnum,s:i+1,0),"name") != "rapidConcealableString" + \&& (synIDattr(synID(a:lnum,s:i+1,0),"name") != "rapidComment" || a:str =~ '^!') + " a:str found outside string or line comment + return s:i + elseif s:i == a:start + " a:str found at search start + return a:start + else + " a:str not found, return full length + return s:len + endif + " a:str is part of string or line comment + let s:i += 1 " continue search for a:str + endwhile + + " a:str not found or a:start>=s:len, return full length + return s:len +endfunction + +" a:lchar shoud be one of (, ), [, ], { or } +" returns the number of opening/closing parenthesise which have no +" closing/opening match in getline(a:lnum) +function s:RapidLoneParen(lnum,lchar) if a:lchar == "(" || a:lchar == ")" let s:opnParChar = "(" let s:clsParChar = ")" @@ -160,37 +189,18 @@ function s:RapidLoneParen(lnum,lchar) return 0 endif - " find first ! which is not part of a string - let s:i = stridx(s:line, "!", 0) - if s:i > 0 - " ! found - let s:i = 0 - while s:i < s:len - let s:i = stridx(s:line, "!", s:i) - if s:i >= 0 - if synIDattr(synID(a:lnum,s:i+1,0),"name") == "rapidString" - \|| synIDattr(synID(a:lnum,s:i+1,0),"name") == "rapidConcealableString" - " ! is part of string - let s:i += 1 " continue search for ! - else - " ! is start of line comment - let s:len = s:i " len = start of line comment - endif - else - " no start of line comment found - let s:i = s:len " finish - endif - endwhile - elseif s:i == 0 - " first char is ! - return 0 - endif + let s:line = getline(a:lnum) - " too long lines are ignored - if s:len > 4096 - return 0 + " look for the first ! which is not part of a string + let s:len = s:RapidLenTilStr(a:lnum,"!",0) + if s:len == 0 + return 0 " first char is !; ignored endif + " if s:len >= 4096 + " return 0 " line too long; ignored + " endif + let s:opnParen = 0 " count opening brakets let s:i = 0 while s:i < s:len @@ -208,6 +218,7 @@ function s:RapidLoneParen(lnum,lchar) let s:i += 1 endwhile + let s:clsParen = 0 " count closing brakets let s:i = 0 while s:i < s:len @@ -234,8 +245,9 @@ function s:RapidLoneParen(lnum,lchar) return 0 endfunction +" This function works almost like prevnonblank() but handles %%%-headers and +" comments like blank lines function s:RapidPreNoneBlank(lnum) - " this function handles &foo-headers and comments like blank lines let nPreNoneBlank = prevnonblank(a:lnum) " At the start of the file use zero indent. if nPreNoneBlank == 0 From 4c3593a94a9350c970fd8bbee5b12d92a3a063f1 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Thu, 9 Jul 2020 02:24:33 +0200 Subject: [PATCH 08/53] fix s:RapidLenTilStr(); also add abort argument to functions --- indent/rapid.vim | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/indent/rapid.vim b/indent/rapid.vim index 03d6fe0..d1deccd 100644 --- a/indent/rapid.vim +++ b/indent/rapid.vim @@ -63,7 +63,7 @@ function GetRapidIndent() endtry endfunction -function s:GetRapidIndentIntern() +function s:GetRapidIndentIntern() abort let l:currentLine = getline(v:lnum) if l:currentLine =~ '^!' && !get(g:,'rapidCommentIndent',0) " if first char is ! line comment, do not change indent @@ -137,10 +137,10 @@ function s:GetRapidIndentIntern() return l:ind endfunction -" Returns the length of the line until a:str is found outside a string or -" comment. Search start at a:start +" Returns the length of the line until a:str occur outside a string or +" comment. Search starts at a:start " Note: rapidTodoComment and rapidDebugComment are not taken into account -function s:RapidLenTilStr(lnum,str,start) +function s:RapidLenTilStr(lnum,str,start) abort let s:line = getline(a:lnum) let s:len = strlen(s:line) @@ -151,18 +151,14 @@ function s:RapidLenTilStr(lnum,str,start) let s:i = a:start while s:i < s:len let s:i = stridx(s:line, a:str, s:i) - if s:i >= 0 - \&& synIDattr(synID(a:lnum,s:i+1,0),"name") != "rapidString" - \&& synIDattr(synID(a:lnum,s:i+1,0),"name") != "rapidConcealableString" + if s:i < 0 + " a:str not found, return full length + return s:len + elseif synIDattr(synID(a:lnum,s:i+1,0),"name") != "rapidString" + \&& synIDattr(synID(a:lnum,s:i+1,0),"name") != "rapidConcealableString" \&& (synIDattr(synID(a:lnum,s:i+1,0),"name") != "rapidComment" || a:str =~ '^!') " a:str found outside string or line comment return s:i - elseif s:i == a:start - " a:str found at search start - return a:start - else - " a:str not found, return full length - return s:len endif " a:str is part of string or line comment let s:i += 1 " continue search for a:str @@ -175,7 +171,7 @@ endfunction " a:lchar shoud be one of (, ), [, ], { or } " returns the number of opening/closing parenthesise which have no " closing/opening match in getline(a:lnum) -function s:RapidLoneParen(lnum,lchar) +function s:RapidLoneParen(lnum,lchar) abort if a:lchar == "(" || a:lchar == ")" let s:opnParChar = "(" let s:clsParChar = ")" @@ -247,7 +243,7 @@ endfunction " This function works almost like prevnonblank() but handles %%%-headers and " comments like blank lines -function s:RapidPreNoneBlank(lnum) +function s:RapidPreNoneBlank(lnum) abort let nPreNoneBlank = prevnonblank(a:lnum) " At the start of the file use zero indent. if nPreNoneBlank == 0 From 318a66523cc54f0b875aa51a03f9124b7af56a09 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Thu, 9 Jul 2020 02:46:19 +0200 Subject: [PATCH 09/53] use s:RapidLenTilStr() in s:RapidLoneParen() --- indent/rapid.vim | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/indent/rapid.vim b/indent/rapid.vim index d1deccd..27d1ee5 100644 --- a/indent/rapid.vim +++ b/indent/rapid.vim @@ -200,16 +200,9 @@ function s:RapidLoneParen(lnum,lchar) abort " count opening brakets let s:i = 0 while s:i < s:len - let s:i = stridx(s:line, s:opnParChar, s:i) - if s:i >= 0 && s:i <= s:len - " brakets that are part of a strings or comment are ignored - if synIDattr(synID(a:lnum,s:i+1,0),"name") != "rapidString" - \&& synIDattr(synID(a:lnum,s:i+1,0),"name") != "rapidConcealableString" - \&& synIDattr(synID(a:lnum,s:i+1,0),"name") != "rapidComment" - let s:opnParen += 1 - endif - else - let s:i = s:len + let s:i = s:RapidLenTilStr(a:lnum, s:opnParChar, s:i) + if s:i < s:len + let s:opnParen += 1 endif let s:i += 1 endwhile @@ -218,16 +211,9 @@ function s:RapidLoneParen(lnum,lchar) abort " count closing brakets let s:i = 0 while s:i < s:len - let s:i = stridx(s:line, s:clsParChar, s:i) - if s:i >= 0 && s:i <= s:len - " brakets that are part of a strings or comment are ignored - if synIDattr(synID(a:lnum,s:i+1,0),"name") != "rapidString" - \&& synIDattr(synID(a:lnum,s:i+1,0),"name") != "rapidConcealableString" - \&& synIDattr(synID(a:lnum,s:i+1,0),"name") != "rapidComment" - let s:clsParen += 1 - endif - else - let s:i = s:len + let s:i = s:RapidLenTilStr(a:lnum, s:clsParChar, s:i) + if s:i < s:len + let s:clsParen += 1 endif let s:i += 1 endwhile From e1f88d2bc9df72d34c1bab67102ba170bf35b7d9 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Thu, 9 Jul 2020 02:57:31 +0200 Subject: [PATCH 10/53] optimize s:RapidLenTilStr() --- indent/rapid.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/indent/rapid.vim b/indent/rapid.vim index 27d1ee5..8c71aec 100644 --- a/indent/rapid.vim +++ b/indent/rapid.vim @@ -154,9 +154,11 @@ function s:RapidLenTilStr(lnum,str,start) abort if s:i < 0 " a:str not found, return full length return s:len - elseif synIDattr(synID(a:lnum,s:i+1,0),"name") != "rapidString" - \&& synIDattr(synID(a:lnum,s:i+1,0),"name") != "rapidConcealableString" - \&& (synIDattr(synID(a:lnum,s:i+1,0),"name") != "rapidComment" || a:str =~ '^!') + endif + let s:synName = synIDattr(synID(a:lnum,s:i+1,0),"name") + if s:synName != "rapidString" + \&& s:synName != "rapidConcealableString" + \&& (s:synName != "rapidComment" || a:str =~ '^!') " a:str found outside string or line comment return s:i endif From 1ca0494937011ff828ae404bae4b8c7bd98bb20b Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Fri, 17 Jul 2020 02:04:25 +0200 Subject: [PATCH 11/53] add todo comments --- ftplugin/rapid.vim | 4 ++++ syntax/rapid.vim | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ftplugin/rapid.vim b/ftplugin/rapid.vim index 2eb1779..584d2ae 100644 --- a/ftplugin/rapid.vim +++ b/ftplugin/rapid.vim @@ -8,6 +8,10 @@ " " Suggestions of improvement are very welcome. Please email me! " +" TODO: - set buftype=nofile bufhidden=delete instead of temp file for altered +" quick fix +" - proper altering of quickfix: see :help quickfix-window then /filled +" " ToDo's {{{ " TODO - make file search case insensitive " - make [[, [], ][ and ]] text objects diff --git a/syntax/rapid.vim b/syntax/rapid.vim index d3b5296..c132599 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -2,7 +2,7 @@ " Language: ABB Rapid Command " Maintainer: Patrick Meiser-Knosowski " Version: 2.2.2 -" Last Change: 08. Jul 2020 +" Last Change: 13. Jul 2020 " Credits: Thanks for beta testing to Thomas Baginski " " Suggestions of improvement are very welcome. Please email me! @@ -20,6 +20,7 @@ " " TODO: - highlight rapid constants and maybe constants from common " technology packages +" - optimize rapidErrorStringTooLong " Init {{{ " Remove any old syntax stuff that was loaded (5.x) or quit when a syntax file From 3a3d40f802e059248657a4bdb5cf0cd7045730b5 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Fri, 17 Jul 2020 02:06:33 +0200 Subject: [PATCH 12/53] clearify that indentation depends on syntax on --- doc/rapid.txt | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/doc/rapid.txt b/doc/rapid.txt index bc685db..2810202 100644 --- a/doc/rapid.txt +++ b/doc/rapid.txt @@ -1,4 +1,4 @@ -*rapid.txt* Abb Rapid Command for Vim version 7.4 Last change: 10. Jun 2020 +*rapid.txt* Abb Rapid Command for Vim version 7.4 Last change: 13. Jul 2020 VIM REFERENCE MANUAL by Patrick Meiser-Knosowski @@ -156,11 +156,18 @@ A: rapid-for-vim will not override existing mappings unless the corresponding Override existing mapping with let g:rapidAutoFormKeyMap = 1 -Q: Does rapid-for-vim provide a mapping for indenting a complete file? +Q: When I switch syntax off I get false indentation sometimes? +A: Indentation partly depends on `syntax on` . If you have strings with ! or + keywords in it Indentation may get confused without syntax on. It should + do fine for the most part of your editing. See next question. + +Q: Does rapid-for-vim provide a mapping for indenting the whole file? A: No, but you may put the following in your .vimrc or `~/.vim/after/ftplugin/rapid.vim`: > - nnoremap ANYKEY gg=G``zz + nnoremap mzgg=G`z +or if you don't use syntax highlighting > + nnoremap :syntax onnormal mzgg=G`z:syntax off Q: Scrolling feels sluggish. What can I do? A: Switch error highlighting off: > @@ -309,6 +316,15 @@ colorscheme tortus or tortusless which makes use of these groups: Index: |rapid-index| ============================================================================== *rapid-indent* + +Note: rapid-for-vim indentation works best with |syn-on|. +You may map > + nnoremap mzgg=G`z +or if you don't use syntax highlighting > + nnoremap :syntax onnormal mzgg=G'z:syntax off +to indent the whole file with one key stroke. + +Index: |rapid-index| *g:rapidSpaceIndent* g:rapidSpaceIndent: ------------------- @@ -502,7 +518,8 @@ Note: These mappings overshadow the default Vim commands To force these mappings off and make Vims default available: > let g:rapidMoveAroundKeyMap = 0 -Note that |g:rapidFunctionTextObject| depend on these mappings. +Note that |g:rapidFunctionTextObject| and |g:rapidCommentTextObject| depend on +this feature. Index: |rapid-index| From 72aa88eb9ed344b2a43d36ec0bda66e512852a8f Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Fri, 17 Jul 2020 02:14:47 +0200 Subject: [PATCH 13/53] clearify that indentation depends on syntax on --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ed83389..43d3121 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ A: Disable stuff in your `vimrc`, see [rapid-options][6] for details: > Q: Which keys get mapped to what? Will that override my own mappings? A: rapid-for-vim will not override existing mappings unless the corresponding option is explicitly set. To use different key bindings use the - ``mapping. Otherwise rapid-for-vim create the followin mappings: > + ``mapping. Otherwise rapid-for-vim create the followin mappings: > Show all structure values Show structure values at cursorline @@ -143,11 +143,18 @@ A: rapid-for-vim will not override existing mappings unless the corresponding Override existing mapping with let g:rapidAutoFormKeyMap = 1 -Q: Does rapid-for-vim provide a mapping for indenting a complete file? +Q: When I switch syntax off I get false indentation sometimes? +A: Indentation partly depends on `syntax on` . If you have strings with ! or + keywords in it Indentation may get confused without syntax on. It should + do fine for the most part of your editing. See next question. + +Q: Does rapid-for-vim provide a mapping for indenting the whole file? A: No, but you may put the following in your .vimrc or ~/.vim/after/ftplugin/rapid.vim: > - nnoremap ANYKEY gg=G``zz + nnoremap mzgg=G`z +or if you don't use syntax highlighting > + nnoremap :syntax onnormal mzgg=G`z:syntax off Q: Scrolling feels sluggish. What can I do? A: Switch error highlighting off: > From 8b62dfbfaca05f55e1276b0b297c3c7b19254c78 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Fri, 17 Jul 2020 02:17:44 +0200 Subject: [PATCH 14/53] reworked whole indent file --- indent/rapid.vim | 221 ++++++++++++++++++++++------------------------- 1 file changed, 103 insertions(+), 118 deletions(-) diff --git a/indent/rapid.vim b/indent/rapid.vim index 8c71aec..c42ab6d 100644 --- a/indent/rapid.vim +++ b/indent/rapid.vim @@ -2,7 +2,7 @@ " Language: ABB Rapid Command " Maintainer: Patrick Meiser-Knosowski " Version: 2.2.2 -" Last Change: 09. Jul 2020 +" Last Change: 17. Jul 2020 " Credits: Based on indent/vim.vim " " Suggestions of improvement are very welcome. Please email me! @@ -23,7 +23,7 @@ if exists("g:rapidNoSpaceIndent") endif " Only load this indent file when no other was loaded. -if exists("b:did_indent") || exists("g:rapidNoIndent") && g:rapidNoIndent==1 +if exists("b:did_indent") || get(g:,'rapidNoIndent',0) finish endif let b:did_indent = 1 @@ -36,8 +36,8 @@ setlocal indentkeys=!^F,o,O,0=~endmodule,0=~error,0=~undo,0=~backward,0=~endproc let b:undo_indent="setlocal lisp< si< ai< inde< indk<" if get(g:,'rapidSpaceIndent',1) - " use spaces for indention, 2 is enough, more or even tabs are looking awful - " on the teach pendant + " Use spaces for indention, 2 is enough. + " More or even tabs wastes space on the teach pendant. setlocal softtabstop=2 setlocal shiftwidth=2 setlocal expandtab @@ -64,64 +64,63 @@ function GetRapidIndent() endfunction function s:GetRapidIndentIntern() abort - let l:currentLine = getline(v:lnum) + + let l:currentLineNum = v:lnum + let l:currentLine = getline(l:currentLineNum) + if l:currentLine =~ '^!' && !get(g:,'rapidCommentIndent',0) - " if first char is ! line comment, do not change indent - " this may be usefull if code did get commented out at the first column + " If current line is ! line comment, do not change indent + " This may be usefull if code is commented out at the first column. return 0 endif + " Find a non-blank line above the current line. let l:preNoneBlankLineNum = s:RapidPreNoneBlank(v:lnum - 1) if l:preNoneBlankLineNum == 0 " At the start of the file use zero indent. return 0 endif + let l:preNoneBlankLine = getline(l:preNoneBlankLineNum) let l:ind = indent(l:preNoneBlankLineNum) - " Add a 'shiftwidth' - let l:i = match(l:preNoneBlankLine, '\c\v^\s* - \( - \((local|task|global)\s+)? - \(module\s+\w - \|record\s+\w - \|proc\s+\w - \|func\s+\w - \|trap\s+\w - \) - \|[^!]*\s*(!.*)?$ - \|else> - \|[^!]*\s*(!.*)?$ - \|case>[^!]+: - \|default>\s*: - \)' - \) - if l:i >= 0 - let l:ind += &sw - endif - let l:i = match(l:preNoneBlankLine, '\c\v^\s*(backward|error|undo)>') - if l:i >= 0 + " Define add a 'shiftwidth' pattern + let l:addShiftwidthPattern = '\c\v^\s*(' + let l:addShiftwidthPattern .= '((local|task)\s+)?(module|record|proc|func|trap)\s+\w' + let l:addShiftwidthPattern .= '|(backward|error|undo)>' + let l:addShiftwidthPattern .= ')' + " + " Define Subtract 'shiftwidth' pattern + let l:subtractShiftwidthPattern = '\c\v^\s*(' + let l:subtractShiftwidthPattern .= 'end(module|record|proc|func|trap)>' + let l:subtractShiftwidthPattern .= '|(backward|error|undo)>' + let l:subtractShiftwidthPattern .= ')' + + " Add shiftwidth + if l:preNoneBlankLine =~ l:addShiftwidthPattern + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "then", 0)>0 + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "else", 0)>0 + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "do", 0)>0 + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "case", 0)>0 + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "default", 0)>0 let l:ind += &sw endif - " Subtract a 'shiftwidth' - if l:currentLine =~ '\c\v^\s* - \( - \end(module|record|proc|func|trap)> - \|end(if|for|while|test)> - \|else> - \|elseif> - \|case>[^!]+: - \|default>\s*: - \)' - let l:ind -= &sw - endif - if l:currentLine =~ '\c\v^\s*(backward|error|undo)>' - let l:ind -= &sw + " Subtract shiftwidth + if l:currentLine =~ l:subtractShiftwidthPattern + \|| s:RapidLenTilStr(l:currentLineNum, "endif", 0)>0 + \|| s:RapidLenTilStr(l:currentLineNum, "endfor", 0)>0 + \|| s:RapidLenTilStr(l:currentLineNum, "endwhile", 0)>0 + \|| s:RapidLenTilStr(l:currentLineNum, "endtest", 0)>0 + \|| s:RapidLenTilStr(l:currentLineNum, "else", 0)>0 + \|| s:RapidLenTilStr(l:currentLineNum, "elseif", 0)>0 + \|| s:RapidLenTilStr(l:currentLineNum, "case", 0)>0 + \|| s:RapidLenTilStr(l:currentLineNum, "default", 0)>0 + let l:ind = l:ind - &sw endif - " first case after a test - if l:currentLine =~ '\c\v^\s*case>' && l:preNoneBlankLine =~ '\c\v^\s*test>' + " First case after a test gets the indent of the test. + if s:RapidLenTilStr(l:currentLineNum, "case", 0)>0 && s:RapidLenTilStr(l:preNoneBlankLineNum, "test", 0)>0 let l:ind += &sw endif @@ -138,36 +137,39 @@ function s:GetRapidIndentIntern() abort endfunction " Returns the length of the line until a:str occur outside a string or -" comment. Search starts at a:start -" Note: rapidTodoComment and rapidDebugComment are not taken into account -function s:RapidLenTilStr(lnum,str,start) abort - let s:line = getline(a:lnum) - - let s:len = strlen(s:line) - " if s:len >= 4096 - " return 4096 " line too long; ignored - " endif - - let s:i = a:start - while s:i < s:len - let s:i = stridx(s:line, a:str, s:i) - if s:i < 0 - " a:str not found, return full length - return s:len +" comment. Search starts at string index a:startIdx. +" If a:str is a word also add word bounderies and case insesitivity. +" Note: rapidTodoComment and rapidDebugComment are not taken into account. +function s:RapidLenTilStr(lnum, str, startIdx) abort + + let l:line = getline(a:lnum) + let l:len = strlen(l:line) + let l:idx = a:startIdx + if a:str =~ '^\w\+$' + let l:str = '\c\<' . a:str . '\>' + else + let l:str = a:str + endif + + while l:len > l:idx + let l:idx = match(l:line, l:str, l:idx) + if l:idx < 0 + " a:str not found + return -1 endif - let s:synName = synIDattr(synID(a:lnum,s:i+1,0),"name") - if s:synName != "rapidString" - \&& s:synName != "rapidConcealableString" - \&& (s:synName != "rapidComment" || a:str =~ '^!') + let l:synName = synIDattr(synID(a:lnum,l:idx+1,0),"name") + if l:synName != "rapidString" + \&& l:synName != "rapidConcealableString" + \&& (l:synName != "rapidComment" || l:str =~ '^!') " a:str found outside string or line comment - return s:i + return l:idx endif " a:str is part of string or line comment - let s:i += 1 " continue search for a:str + let l:idx += 1 " continue search for a:str endwhile - - " a:str not found or a:start>=s:len, return full length - return s:len + + " a:str not found or l:len <= a:startIdx + return -1 endfunction " a:lchar shoud be one of (, ), [, ], { or } @@ -175,55 +177,52 @@ endfunction " closing/opening match in getline(a:lnum) function s:RapidLoneParen(lnum,lchar) abort if a:lchar == "(" || a:lchar == ")" - let s:opnParChar = "(" - let s:clsParChar = ")" + let l:opnParChar = "(" + let l:clsParChar = ")" elseif a:lchar == "[" || a:lchar == "]" - let s:opnParChar = "[" - let s:clsParChar = "]" + let l:opnParChar = "[" + let l:clsParChar = "]" elseif a:lchar == "{" || a:lchar == "}" - let s:opnParChar = "{" - let s:clsParChar = "}" + let l:opnParChar = "{" + let l:clsParChar = "}" else return 0 endif - let s:line = getline(a:lnum) + let l:line = getline(a:lnum) " look for the first ! which is not part of a string - let s:len = s:RapidLenTilStr(a:lnum,"!",0) - if s:len == 0 + let l:len = s:RapidLenTilStr(a:lnum,"!",0) + if l:len == 0 return 0 " first char is !; ignored endif - " if s:len >= 4096 - " return 0 " line too long; ignored - " endif - let s:opnParen = 0 + let l:opnParen = 0 " count opening brakets - let s:i = 0 - while s:i < s:len - let s:i = s:RapidLenTilStr(a:lnum, s:opnParChar, s:i) - if s:i < s:len - let s:opnParen += 1 + let l:i = 0 + while l:i >= 0 + let l:i = s:RapidLenTilStr(a:lnum, l:opnParChar, l:i) + if l:i >= 0 + let l:opnParen += 1 + let l:i += 1 endif - let s:i += 1 endwhile - let s:clsParen = 0 + let l:clsParen = 0 " count closing brakets - let s:i = 0 - while s:i < s:len - let s:i = s:RapidLenTilStr(a:lnum, s:clsParChar, s:i) - if s:i < s:len - let s:clsParen += 1 + let l:i = 0 + while l:i >= 0 + let l:i = s:RapidLenTilStr(a:lnum, l:clsParChar, l:i) + if l:i >= 0 + let l:clsParen += 1 + let l:i += 1 endif - let s:i += 1 endwhile - if (a:lchar == "(" || a:lchar == "[" || a:lchar == "{") && s:opnParen>s:clsParen - return (s:opnParen-s:clsParen) - elseif (a:lchar == ")" || a:lchar == "]" || a:lchar == "}") && s:clsParen>s:opnParen - return (s:clsParen-s:opnParen) + if (a:lchar == "(" || a:lchar == "[" || a:lchar == "{") && l:opnParen>l:clsParen + return (l:opnParen-l:clsParen) + elseif (a:lchar == ")" || a:lchar == "]" || a:lchar == "}") && l:clsParen>l:opnParen + return (l:clsParen-l:opnParen) endif return 0 @@ -232,26 +231,12 @@ endfunction " This function works almost like prevnonblank() but handles %%%-headers and " comments like blank lines function s:RapidPreNoneBlank(lnum) abort + let nPreNoneBlank = prevnonblank(a:lnum) - " At the start of the file use zero indent. - if nPreNoneBlank == 0 - return 0 - endif - let l:i=1 - while l:i>=1 && nPreNoneBlank>=0 - if getline(nPreNoneBlank) =~ '\v\c^\s* - \(\%\%\%.*$ - \|(!.*)?$ - \)' - let nPreNoneBlank = prevnonblank(nPreNoneBlank - 1) - " At the start of the file use zero indent. - if nPreNoneBlank == 0 - return 0 - endif - else - let l:i=0 - endif + while nPreNoneBlank>0 && getline(nPreNoneBlank) =~ '\v\c^\s*(\%\%\%|!)' + " Previouse none blank line irrelevant. Look further aback. + let nPreNoneBlank = prevnonblank(nPreNoneBlank - 1) endwhile return nPreNoneBlank From b5f1bdeaee99d48e0547eeb459e4d2ee254ff357 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Fri, 17 Jul 2020 02:43:16 +0200 Subject: [PATCH 15/53] fix highlight of indent mapping --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 43d3121..b4bb356 100644 --- a/README.md +++ b/README.md @@ -154,6 +154,7 @@ A: No, but you may put the following in your .vimrc or nnoremap mzgg=G`z or if you don't use syntax highlighting > + nnoremap :syntax onnormal mzgg=G`z:syntax off Q: Scrolling feels sluggish. What can I do? From 589650f1ba6a608f71536bd5bf953c6b6a27d695 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Tue, 29 Sep 2020 13:19:11 +0200 Subject: [PATCH 16/53] use abort argument for all function definitions --- ftdetect/rapid.vim | 4 +-- ftplugin/rapid.vim | 70 +++++++++++++++++++++++----------------------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/ftdetect/rapid.vim b/ftdetect/rapid.vim index 7234566..5d3dbfb 100644 --- a/ftdetect/rapid.vim +++ b/ftdetect/rapid.vim @@ -2,7 +2,7 @@ " Language: ABB Rapid Command " Maintainer: Patrick Meiser-Knosowski " Version: 2.0.0 -" Last Change: 11. Apr 2019 +" Last Change: 17. Sep 2020 " Credits: " " Suggestions of improvement are very welcome. Please email me! @@ -23,7 +23,7 @@ augroup rapidftdetect au! filetypedetect BufRead *.cfg,*.Cfg,*.CFG if getline(1) =~ '^\w\+:CFG' | call RapidAutoCorrCfgLineEnding() | endif augroup END if !exists("*RapidAutoCorrCfgLineEnding()") - function RapidAutoCorrCfgLineEnding() + function RapidAutoCorrCfgLineEnding() abort setf rapid if get(g:,'rapidAutoCorrCfgLineEnd',1) silent! %s/\r// diff --git a/ftplugin/rapid.vim b/ftplugin/rapid.vim index 584d2ae..e047ad4 100644 --- a/ftplugin/rapid.vim +++ b/ftplugin/rapid.vim @@ -2,7 +2,7 @@ " Language: ABB Rapid Command " Maintainer: Patrick Meiser-Knosowski " Version: 2.2.1 -" Last Change: 08. Apr 2020 +" Last Change: 25. Sep 2020 " Credits: Peter Oddings (KnopUniqueListItems/xolox#misc#list#unique) " Thanks for beta testing to Thomas Baginski " @@ -93,7 +93,7 @@ if !exists("*s:KnopVerboseEcho()") unlet g:knopVerboseMsg echomsg "Switch verbose messages off with \":let g:knopVerbose=0\" any time. You may put this in your .vimrc" endif - function s:KnopVerboseEcho(msg, ...) + function s:KnopVerboseEcho(msg, ...) abort if get(g:,'knopVerbose',0) if type(a:msg) == v:t_list let l:msg = a:msg @@ -113,14 +113,14 @@ if !exists("*s:KnopVerboseEcho()") endif endfunction " s:KnopVerboseEcho() - function s:KnopDirExists(in) + function s:KnopDirExists(in) abort if finddir( substitute(a:in,'\\','','g') )!='' return 1 endif return 0 endfunction " s:KnopDirExists - function s:KnopFnameescape4Path(in) + function s:KnopFnameescape4Path(in) abort " escape a path for use as 'execute "set path=" . s:KnopFnameescape4Path(mypath)' " use / (not \) as a separator for the input parameter let l:out = fnameescape( a:in ) @@ -132,14 +132,14 @@ if !exists("*s:KnopVerboseEcho()") return l:out endfunction - function s:knopCompleteEnbMsg() + function s:knopCompleteEnbMsg() abort if exists("g:knopCompleteMsg") unlet g:knopCompleteMsg call s:KnopVerboseEcho("Add the following files to 'complete'.\n Try and to complete words from there:") endif endfunction " s:knopCompleteEnbMsg - function s:KnopSplitAndUnescapeCommaSeparatedPathStr(commaSeparatedPathStr) + function s:KnopSplitAndUnescapeCommaSeparatedPathStr(commaSeparatedPathStr) abort let l:pathList = [] for l:pathItem in split(a:commaSeparatedPathStr,'\\\@1KnopNTimesSearch(nCount,sSearchPattern,sFlags) + function KnopNTimesSearch(nCount,sSearchPattern,sFlags) abort let l:nCount=a:nCount let l:sFlags=a:sFlags while l:nCount>0 @@ -315,7 +315,7 @@ if !exists("*s:KnopVerboseEcho()") " Rapid Helper {{{ - function RapidCleanBufferList() + function RapidCleanBufferList() abort if exists("g:knopTmpFile") let l:knopTmpFile = substitute(g:knopTmpFile,'.*[\\/]\(VI\w\+\.tmp\)','\1','') endif @@ -349,7 +349,7 @@ if !exists("*s:KnopVerboseEcho()") augroup END endfunction " RapidCleanBufferList() - function s:RapidCurrentWordIs() + function s:RapidCurrentWordIs() abort " returns the string "" depending on the word under the cursor " let l:numLine = line(".") @@ -432,7 +432,7 @@ if !exists("*s:KnopVerboseEcho()") return "none" endfunction " s:RapidCurrentWordIs() - function s:RapidPutCursorOnModuleAndReturnEndmoduleline() + function s:RapidPutCursorOnModuleAndReturnEndmoduleline() abort if search('\c^\s*module\s','bcW') let l:numEndmodule = search('\v\c^\s*endmodule>','nW') if l:numEndmodule <= 0 @@ -452,7 +452,7 @@ if !exists("*s:KnopVerboseEcho()") " Go Definition {{{ - function s:RapidSearchUserDefined(declPrefix,currentWord) + function s:RapidSearchUserDefined(declPrefix,currentWord) abort " let l:numSearchStartLine = line(".") let l:numSearchStartColumn = col(".") @@ -676,7 +676,7 @@ if !exists("*s:KnopVerboseEcho()") return -1 endfunction " s:RapidSearchUserDefined() - function RapidGoDefinition() + function RapidGoDefinition() abort augroup RapidCleanBufferList " work around where buffer list is not cleaned if knopVerbose is enabled autocmd! @@ -734,7 +734,7 @@ if !exists("*s:KnopVerboseEcho()") " Auto Form {{{ - function s:RapidGetGlobal(sAction) + function s:RapidGetGlobal(sAction) abort if a:sAction=~'^[lg]' let l:sGlobal = a:sAction else @@ -748,7 +748,7 @@ if !exists("*s:KnopVerboseEcho()") return '' endfunction " s:RapidGetGlobal() - function s:RapidGetType(sAction) + function s:RapidGetType(sAction) abort if a:sAction =~ '^.[pftr]' let l:sType = substitute(a:sAction,'^.\(\w\).','\1','') else @@ -766,7 +766,7 @@ if !exists("*s:KnopVerboseEcho()") return '' endfunction " s:RapidGetType() - function s:RapidGetName() + function s:RapidGetName() abort let l:sName = substitute(input("\nName?\n Type for word under cursor.\n> "),'[^ 0-9a-zA-Z_]*','','g') if l:sName=="" return '' @@ -777,7 +777,7 @@ if !exists("*s:KnopVerboseEcho()") return l:sName endfunction " s:RapidGetName() - function s:RapidGetDataType(sAction) + function s:RapidGetDataType(sAction) abort if a:sAction=~'..[bndsprjtw]' let l:sDataType = substitute(a:sAction,'..\(\w\)','\1','') else @@ -807,7 +807,7 @@ if !exists("*s:KnopVerboseEcho()") return substitute(l:sDataType,'[^0-9a-zA-Z_{}]*','','g') endfunction " s:RapidGetDataType() - function s:RapidGetReturnVar(sDataType) + function s:RapidGetReturnVar(sDataType) abort if a:sDataType=~'\c^bool\>' return "bResult" elseif a:sDataType=~'\c^num\>' @@ -830,7 +830,7 @@ if !exists("*s:KnopVerboseEcho()") return substitute(a:sDataType,'^\(..\).*','\l\1','')."Result" endfunction " s:RapidGetReturnVar() - function s:RapidPositionForEdit(sType) + function s:RapidPositionForEdit(sType) abort let l:commentline = '^\s*!' " empty file if line('$')==1 && getline('.')=='' | return | endif @@ -875,7 +875,7 @@ if !exists("*s:KnopVerboseEcho()") endif endfunction " s:RapidPositionForEdit() - function s:RapidPositionForRead(sType) + function s:RapidPositionForRead(sType) abort call s:RapidPositionForEdit(a:sType) if getline('.')=~'^\s*$' \&& line('.')!=line('$') @@ -883,7 +883,7 @@ if !exists("*s:KnopVerboseEcho()") endif endfunction " s:RapidPositionForRead() - function s:RapidReadBody(sBodyFile,sType,sName,sGlobal,sDataType,sReturnVar) + function s:RapidReadBody(sBodyFile,sType,sName,sGlobal,sDataType,sReturnVar) abort let l:sBodyFile = glob(fnameescape(g:rapidPathToBodyFiles)).a:sBodyFile if !filereadable(glob(l:sBodyFile)) call s:KnopVerboseEcho([l:sBodyFile,": Body file not readable."],1) @@ -918,7 +918,7 @@ if !exists("*s:KnopVerboseEcho()") endif endfunction " s:RapidReadBody() - function s:RapidDefaultBody(sType,sName,sGlobal,sDataType,sReturnVar) + function s:RapidDefaultBody(sType,sName,sGlobal,sDataType,sReturnVar) abort call s:RapidPositionForEdit(a:sType) call setline('.',a:sGlobal . a:sType . " " . a:sDataType . " " . a:sName . '()') if a:sType =~ '\v\c(trap|record)' | silent substitute/()// | endif @@ -954,7 +954,7 @@ if !exists("*s:KnopVerboseEcho()") call search('^\s*!','eW',l:end) endfunction " s:RapidDefaultBody() - function RapidAutoForm(sAction) + function RapidAutoForm(sAction) abort " check input if a:sAction !~ '^[ gl][ pftr][ bndsprjtw]$' | return | endif " @@ -1003,7 +1003,7 @@ if !exists("*s:KnopVerboseEcho()") " List Def/Usage {{{ - function RapidListDefinition() + function RapidListDefinition() abort augroup RapidCleanBufferList " work around where buffer list is not cleaned if knopVerbose is enabled autocmd! @@ -1041,7 +1041,7 @@ if !exists("*s:KnopVerboseEcho()") endif endfunction " RapidListDefinition() - function RapidListUsage() + function RapidListUsage() abort augroup RapidCleanBufferList " work around where buffer list is not cleaned if knopVerbose is enabled autocmd! @@ -1107,7 +1107,7 @@ if !exists("*s:KnopVerboseEcho()") " Function Text Object {{{ if get(g:,'rapidMoveAroundKeyMap',1) " depends on move around key mappings - function RapidFunctionTextObject(inner,withcomment) + function RapidFunctionTextObject(inner,withcomment) abort if a:inner==1 let l:n = 1 else @@ -1139,7 +1139,7 @@ if !exists("*s:KnopVerboseEcho()") " Comment Text Object {{{ if get(g:,'rapidMoveAroundKeyMap',1) " depends on move around key mappings - function RapidCommentTextObject(around) + function RapidCommentTextObject(around) abort if getline('.')!~'^\s*!' && !search('^\s*!',"sW") return endif @@ -1270,7 +1270,7 @@ unlet s:pathToCurrentFile if get(g:,'rapidConcealStructs',1) if !exists("*RapidConcealLevel") - function RapidConcealLevel(lvl) + function RapidConcealLevel(lvl) abort " g:rapidConcealStructs may be used as input for a:lvl From c1d42440169757b8b95290acc3d523973ebf969c Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Tue, 29 Sep 2020 13:21:33 +0200 Subject: [PATCH 17/53] fix use of s:RapidLenTilStr(), 0 is a valid return value --- indent/rapid.vim | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/indent/rapid.vim b/indent/rapid.vim index c42ab6d..374977d 100644 --- a/indent/rapid.vim +++ b/indent/rapid.vim @@ -2,7 +2,7 @@ " Language: ABB Rapid Command " Maintainer: Patrick Meiser-Knosowski " Version: 2.2.2 -" Last Change: 17. Jul 2020 +" Last Change: 25. Sep 2020 " Credits: Based on indent/vim.vim " " Suggestions of improvement are very welcome. Please email me! @@ -98,29 +98,29 @@ function s:GetRapidIndentIntern() abort " Add shiftwidth if l:preNoneBlankLine =~ l:addShiftwidthPattern - \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "then", 0)>0 - \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "else", 0)>0 - \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "do", 0)>0 - \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "case", 0)>0 - \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "default", 0)>0 + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "then", 0)>=0 + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "else", 0)>=0 + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "do", 0)>=0 + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "case", 0)>=0 + \|| s:RapidLenTilStr(l:preNoneBlankLineNum, "default", 0)>=0 let l:ind += &sw endif " Subtract shiftwidth if l:currentLine =~ l:subtractShiftwidthPattern - \|| s:RapidLenTilStr(l:currentLineNum, "endif", 0)>0 - \|| s:RapidLenTilStr(l:currentLineNum, "endfor", 0)>0 - \|| s:RapidLenTilStr(l:currentLineNum, "endwhile", 0)>0 - \|| s:RapidLenTilStr(l:currentLineNum, "endtest", 0)>0 - \|| s:RapidLenTilStr(l:currentLineNum, "else", 0)>0 - \|| s:RapidLenTilStr(l:currentLineNum, "elseif", 0)>0 - \|| s:RapidLenTilStr(l:currentLineNum, "case", 0)>0 - \|| s:RapidLenTilStr(l:currentLineNum, "default", 0)>0 + \|| s:RapidLenTilStr(l:currentLineNum, "endif", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "endfor", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "endwhile", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "endtest", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "else", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "elseif", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "case", 0)>=0 + \|| s:RapidLenTilStr(l:currentLineNum, "default", 0)>=0 let l:ind = l:ind - &sw endif " First case after a test gets the indent of the test. - if s:RapidLenTilStr(l:currentLineNum, "case", 0)>0 && s:RapidLenTilStr(l:preNoneBlankLineNum, "test", 0)>0 + if s:RapidLenTilStr(l:currentLineNum, "case", 0)>=0 && s:RapidLenTilStr(l:preNoneBlankLineNum, "test", 0)>=0 let l:ind += &sw endif From e6aeef20bd88df8e30e3dd1449b86334bffe12e1 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Tue, 29 Sep 2020 13:28:52 +0200 Subject: [PATCH 18/53] fix use of s:KnopUniqueListItems() in s:KnopSearchPathForPatternNTimes() --- ftplugin/rapid.vim | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ftplugin/rapid.vim b/ftplugin/rapid.vim index e047ad4..59172d4 100644 --- a/ftplugin/rapid.vim +++ b/ftplugin/rapid.vim @@ -289,9 +289,7 @@ if !exists("*s:KnopVerboseEcho()") call s:KnopVerboseEcho(":vimgrep stopped with E683. No match found") return -1 endtry - if a:n == 1 - call setqflist(s:KnopUniqueListItems(getqflist())) - endif + call setqflist(s:KnopUniqueListItems(getqflist())) if s:KnopOpenQf(a:useSyntax)==-1 call s:KnopVerboseEcho("No match found") return -1 From f4e28ef4e72809c86d5ab184c4035080170f51a8 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Tue, 29 Sep 2020 14:54:34 +0200 Subject: [PATCH 19/53] fix RapidCleanBufferList() --- ftplugin/rapid.vim | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ftplugin/rapid.vim b/ftplugin/rapid.vim index 59172d4..00084e8 100644 --- a/ftplugin/rapid.vim +++ b/ftplugin/rapid.vim @@ -11,6 +11,8 @@ " TODO: - set buftype=nofile bufhidden=delete instead of temp file for altered " quick fix " - proper altering of quickfix: see :help quickfix-window then /filled +" - [[,]]... mappings for jumping from section to section in .cfg files +" - test compatiblity with quickfix-reflector " " ToDo's {{{ " TODO - make file search case insensitive @@ -334,10 +336,7 @@ if !exists("*s:KnopVerboseEcho()") call setbufvar(l:b["bufnr"],"&buflisted",0) endif " delete those strange empty unnamed buffers - if l:b["name"]=="" " not named - \&& l:b["windows"]==[] " not shown in any window - \&& !l:b["hidden"] " not hidden - \&& !l:b["changed"] " not modified + if l:b['name']=='' && l:b['windows']==[] && !l:b['changed'] execute "silent bwipeout! " . l:b["bufnr"] endif endfor @@ -1502,13 +1501,16 @@ endif " mappings {{{ " Go Definition -nnoremap RapidGoDef :call RapidGoDefinition():call RapidCleanBufferList() +" nnoremap RapidGoDef :call RapidGoDefinition():call RapidCleanBufferList() +nnoremap RapidGoDef :call RapidGoDefinition() " list all PROCs of current file -nnoremap RapidListDef :call RapidListDefinition():call RapidCleanBufferList() +" nnoremap RapidListDef :call RapidListDefinition():call RapidCleanBufferList() +nnoremap RapidListDef :call RapidListDefinition() " list usage -nnoremap RapidListUse :call RapidListUsage():call RapidCleanBufferList() +" nnoremap RapidListUse :call RapidListUsage():call RapidCleanBufferList() +nnoremap RapidListUse :call RapidListUsage() " auto form nnoremap RapidAutoForm :call RapidAutoForm(" ") From 3aa059527c339d89ebfd149dd79349d41fa3c3bf Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Wed, 25 Nov 2020 10:52:42 +0100 Subject: [PATCH 20/53] remove GLOBAL from rapidStorageClass --- syntax/rapid.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index c132599..97b6e5b 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -200,7 +200,7 @@ else syn keyword rapidType dadescapp dadescprc daintdata highlight default link rapidType Type " Storage class - syn keyword rapidStorageClass LOCAL TASK GLOBAL VAR PERS CONST ALIAS NOVIEW NOSTEPIN VIEWONLY READONLY SYSMODULE INOUT + syn keyword rapidStorageClass LOCAL TASK VAR PERS CONST ALIAS NOVIEW NOSTEPIN VIEWONLY READONLY SYSMODULE INOUT highlight default link rapidStorageClass StorageClass " Not a typedef but I like to have those highlighted different then types, " structures or strorage classes From ad81d1fe259091eaa0dae1a4e1597f4df24fca14 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Wed, 25 Nov 2020 10:53:16 +0100 Subject: [PATCH 21/53] use upper case for TRUE/FALSE --- syntax/rapid.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index 97b6e5b..cb192f0 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -79,7 +79,7 @@ endif " Constant values {{{ " Boolean -syn keyword rapidBoolean True False Edge High Low +syn keyword rapidBoolean TRUE FALSE Edge High Low highlight default link rapidBoolean Boolean " Float (num) syn match rapidFloat /\v%(\W|_)@1<=[+-]?\d+\.?\d*%(\s*[eE][+-]?\d+)?/ From e277f5600727d8d2d1128c8c63fc024fb5f18ec1 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Wed, 25 Nov 2020 10:54:09 +0100 Subject: [PATCH 22/53] add Homepos-Running instructions --- syntax/rapid.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index cb192f0..92c6bb3 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -2,7 +2,7 @@ " Language: ABB Rapid Command " Maintainer: Patrick Meiser-Knosowski " Version: 2.2.2 -" Last Change: 13. Jul 2020 +" Last Change: 25. Oct 2020 " Credits: Thanks for beta testing to Thomas Baginski " " Suggestions of improvement are very welcome. Please email me! @@ -21,6 +21,7 @@ " TODO: - highlight rapid constants and maybe constants from common " technology packages " - optimize rapidErrorStringTooLong +" - error highlight for missing 2nd point in MoveCirc et al " Init {{{ " Remove any old syntax stuff that was loaded (5.x) or quit when a syntax file @@ -266,6 +267,8 @@ else syn keyword rapidKeyword DaActProc DaDeactAllProc DaDeactProc DaDefExtSig DaDefProcData DaDefProcSig DaDefUserData DaGetCurrData DaSetCurrData DaSetupAppBehav DaStartManAction DaGetAppDescr DaGetAppIndex DaGetNumOfProcs DaGetNumOfRob DaGetPrcDescr " Production Manager instructions syn keyword rapidKeyword ExecEngine PMgrGetNextPart PMgrSetNextPart PMgrRunMenu + " Homepos-Running instructions + syn keyword rapidKeyword HR_Exit HR_ExitCycle HR_SavePos HR_SetMoveToStartPos HR_SetTypeDIndex HR_SetTypeIndex highlight default link rapidKeyword Keyword " Exception syn keyword rapidException Exit ErrRaise ExitCycle Raise RaiseToUser Retry Return TryNext From e85d2876c957e4f6b00ae1ae7132dcc09c50e6e1 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Wed, 25 Nov 2020 11:03:50 +0100 Subject: [PATCH 23/53] add some comments --- syntax/rapid.vim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index 92c6bb3..5b55ecc 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -277,27 +277,30 @@ else " }}} Statements, keywords et al " special keyword for move command {{{ - " arc instructions + " Arc instructions syn keyword rapidMovement ArcC ArcC1 ArcC2 ArcCEnd ArcC1End ArcC2End ArcCStart ArcC1Start ArcC2Start syn keyword rapidMovement ArcL ArcL1 ArcL2 ArcLEnd ArcL1End ArcL2End ArcLStart ArcL1Start ArcL2Start ArcMoveExtJ - " arc Weldguide and MultiPass instructions + " Arc Weldguide and MultiPass instructions syn keyword rapidMovement ArcRepL ArcAdaptLStart ArcAdaptL ArcAdaptC ArcAdaptLEnd ArcAdaptCEnd ArcCalcLStart ArcCalcL ArcCalcC ArcCalcLEnd ArcCalcCEnd ArcAdaptRepL syn keyword rapidMovement Break " Continuous Application Platform instructions syn keyword rapidMovement CapC CapL CapLATrSetup CSSDeactMoveL ContactL - " dispense instructions + " Dispense instructions syn keyword rapidMovement DispL DispC syn keyword rapidMovement EGMMoveC EGMMoveL EGMRunJoint EGMRunPose EGMStop syn keyword rapidMovement IndAMove IndCMove IndDMove IndRMove syn keyword rapidMovement MoveAbsJ MoveC MoveExtJ MoveJ MoveL syn keyword rapidMovement MoveCAO MoveCDO MoveCGO MoveCSync MoveJAO MoveJDO MoveJGO MoveJSync MoveLAO MoveLDO MoveLGO MoveLSync syn keyword rapidMovement MovePnP + " Nut instructions" syn keyword rapidMovement NutL NutJ syn keyword rapidMovement PathRecMoveBwd PathRecMoveFwd + " Paint instructions" syn keyword rapidMovement PaintL PaintLDO PaintC syn keyword rapidMovement StartMove StartMoveRetry StepBwdPath StopMove StopMoveReset " Spot instructions syn keyword rapidMovement SpotL SpotJ SpotML SpotMJ CalibL CalibJ MeasureWearL + " Homepos-Running instructions syn keyword rapidMovement SMoveJ SMoveJDO SMoveJGO SMoveJSync SMoveL SMoveLDO SMoveLGO SMoveLSync SSearchL STriggJ STriggL syn keyword rapidMovement SearchC SearchExtJ SearchL syn keyword rapidMovement TriggC TriggJ TriggL TriggJIOs TriggLIOs From c1492b3f6c01472f1978ca02808369efc377cf4f Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Wed, 25 Nov 2020 11:05:04 +0100 Subject: [PATCH 24/53] add more Continuous Application Platform constants --- syntax/rapid.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index 5b55ecc..ea0598b 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -515,6 +515,7 @@ else syn keyword rapidConstant BESuccess BENoOverwrite BENoNameMatch BENoBEDataMod BEArrayFull BEToolNotFound BEInvalidSignal BEAliasSet BERangeLimFail BERangeSingFail BERangeTiltFail BEScanPlaneErr BEBFrameNotRead BEScanRadZero BEHeightSrchErr BEBeamNotFound BEBeamSpinErr BESrchErrInBeam BESrchErrNoDet BENumOfScansErr BEDiaZeroOrLess BESliceCountErr BEGetNewTcpMax BEBeamOriFail BEGetTcpDelErr BERefPosSetErr BERefToolSetErr BERefBeamSetErr BEBFrameDefErr BESetupAlready BERefResetErr BESetupFailed BEToolNotSet BEStartChanged BEBeamMoveErr BECheckTcp BECheckErr BESkipUpdate BEStrtningErr BEAllNotSet BEQuikRefNotDef BEConvergErr BEInstFwdErr BEGetGantryErr BEUnknownErr " Continuous Application Platform constants syn keyword rapidConstant CAP_START START_PRE PRE_STARTED START_MAIN MAIN_STARTED STOP_WEAVESTART WEAVESTART_REGAIN MOTION_DELAY STARTSPEED_TIME MAIN_MOTION MOVE_STARTED RESTART NEW_INSTR AT_POINT AT_RESTARTPOINT LAST_SEGMENT PROCESS_END_POINT END_MAIN MAIN_ENDED PATH_END_POINT PROCESS_ENDED END_POST1 POST1_ENDED END_POST2 POST2_ENDED CAP_STOP CAP_PF_RESTART EQUIDIST AT_ERRORPOINT FLY_START FLY_END LAST_INSTR_ENDED END_PRE PRE_ENDED START_POST1 POST1_STARTED START_POST2 POST2_STARTED + syn keyword rapidConstant CAP_PRE_ERR CAP_PRESTART_ERR CAP_END_PRE_ERR CAP_START_ERR CAP_MAIN_ERR CAP_ENDMAIN_ERR CAP_START_POST1_ERR CAP_POST1_ERR CAP_POST1END_ERR CAP_START_POST2_ERR CAP_POST2_ERR CAP_POST2END_ERR CAP_TRACK_ERR CAP_TRACKSTA_ERR CAP_TRACKCOR_ERR CAP_TRACKCOM_ERR CAP_TRACKPFR_ERR CAP_SEN_NO_MEAS CAP_SEN_NOREADY CAP_SEN_GENERRO CAP_SEN_BUSY CAP_SEN_UNKNOWN CAP_SEN_ILLEGAL CAP_SEN_EXALARM CAP_SEN_CAALARM CAP_SEN_TEMP CAP_SEN_VALUE CAP_SEN_CAMCHECK CAP_SEN_TIMEOUT " Machine Tending grppos syn keyword rapidConstant gsOpen gsVacuumOff gsBackward gsClose gsVacuumOn gsForward gsReset " Machine Tending grpaction From b75f39decd06f3009955b9cddbfac6732741fed0 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Wed, 25 Nov 2020 11:05:55 +0100 Subject: [PATCH 25/53] remove duplicate constants --- syntax/rapid.vim | 2 -- 1 file changed, 2 deletions(-) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index ea0598b..37217a6 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -475,8 +475,6 @@ else syn keyword rapidConstant OP_UNDEF OP_AUTO OP_MAN_PROG OP_MAN_TEST " symnum of RunMode() syn keyword rapidConstant RUN_UNDEF RUN_CONT_CYCLE RUN_INSTR_FWD RUN_INSTR_BWD RUN_SIM RUN_STEP_MOVE - " opcalc - syn keyword rapidConstant OpAdd OpSub OpMult OpDiv OpMod " event_type of EventType() syn keyword rapidConstant EVENT_NONE EVENT_POWERON EVENT_START EVENT_STOP EVENT_QSTOP EVENT_RESTART EVENT_RESET EVENT_STEP " handler_type of ExecHandler() From 986b7a7d55c05628a4efed499c2667522bce4b6e Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Wed, 25 Nov 2020 11:06:22 +0100 Subject: [PATCH 26/53] add more tsp_status constants --- syntax/rapid.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index 37217a6..40f8dd3 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -507,6 +507,8 @@ else syn keyword rapidConstant BUSSTATE_ERROR BUSSTATE_HALTED BUSSTATE_INIT BUSSTATE_RUN BUSSTATE_STARTUP " SoftMove syn keyword rapidConstant CSS_POSX CSS_NEGX CSS_POSY CSS_NEGY CSS_POSZ CSS_NEGZ CSS_X CSS_Y CSS_Z CSS_XY CSS_XZ CSS_YZ CSS_XYZ CSS_XYRZ CSS_ARM_ANGLE CSS_REFFRAME_TOOL CSS_REFFRAME_WOBJ + " tsp_status + syn keyword rapidConstant TSP_STATUS_NOT_NORMAL_TASK TSP_STATUS_DEACT TSP_STATUS_DEACT_SERV_ROUT TSP_STATUS_ACT TSP_UNCHECKED_RUN_SERV_ROUT TSP_NORMAL_UNCHECKED TSP_STATIC_UNCHECKED TSP_SEMISTATIC_UNCHECKED TSP_NORMAL_CHECKED TSP_STATIC_CHECKED TSP_SEMISTATIC_CHECKED " IRC5P (paint controller) syn keyword rapidConstant PW_EQUIP_ERR " Bulls Eye From e171afc85621a4ba042a4403e4c5dc2aa1e35488 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Wed, 25 Nov 2020 11:06:55 +0100 Subject: [PATCH 27/53] add EGM egmframetype constants --- syntax/rapid.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index 40f8dd3..0abd3eb 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -435,6 +435,8 @@ else syn keyword rapidConstant LONG_JMP_ALL_ERR " Arc and Arc sensor syn keyword rapidConstant AW_IGNI_ERR AW_EQIP_ERR AW_START_ERR AW_STOP_ERR AW_TRACK_ERR AW_TRACKCORR_ERR AW_TRACKSTA_ERR AW_USERSIG_ERR AW_WELD_ERR AW_WIRE_ERR + " EGM egmframetype + syn keyword rapidConstant EGM_FRAME_BASE EGM_FRAME_TOOL EGM_FRAME_WOBJ EGM_FRAME_WORLD EGM_FRAME_JOINT " Events syn keyword rapidConstant EE_START EE_CYCLE_START EE_PROC_START EE_PRE_PROD EE_CLOSE_JIG EE_INDEX EE_PRE_PART EE_POST_PART EE_OPEN_JIG EE_SERVICE EE_POST_PROD EE_ABORT EE_WAIT_ORDER EE_POST_PROC syn keyword rapidConstant EE_POWERON EE_POWERON_OR_START EE_RESTART EE_START_OR_RESTART EE_STOP EE_QSTOP EE_STOP_OR_QSTOP EE_RESET EE_STEP EE_STEP_FWD EE_STEP_BCK EE_BEFORE_INIT EE_AFTER_INIT EE_BEFORE_PROD EE_AFTER_PROD EE_BEFORE_MENU EE_AFTER_MENU From b852263d4aa9e12995290fcb2499950785abf4e3 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Wed, 25 Nov 2020 11:07:37 +0100 Subject: [PATCH 28/53] add EGM ERR_TP_PERSBOOLBREAK constant --- syntax/rapid.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index 0abd3eb..6a0d975 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -420,7 +420,7 @@ else syn keyword rapidConstant ERR_SPEEDLIM_VALUE ERR_SPEED_REFRESH_LIM syn keyword rapidConstant ERR_STARTMOVE ERR_STORE_PROF ERR_STRTOOLNG ERR_SYMBOL_TYPE ERR_SYM_ACCESS ERR_SYNCMOVEOFF ERR_SYNCMOVEON ERR_SYNTAX syn keyword rapidConstant ERR_TASKNAME - syn keyword rapidConstant ERR_TP_DIBREAK ERR_TP_DOBREAK ERR_TP_MAXTIME ERR_TP_NO_CLIENT + syn keyword rapidConstant ERR_TP_DIBREAK ERR_TP_DOBREAK ERR_TP_MAXTIME ERR_TP_NO_CLIENT ERR_TP_PERSBOOLBREAK syn keyword rapidConstant ERR_TRUSTLEVEL ERR_TXTNOEXIST ERR_UDPUC_COMM syn keyword rapidConstant ERR_UISHOW_FATAL ERR_UISHOW_FULL ERR_UI_INITVALUE ERR_UI_MAXMIN ERR_UI_NOTINT syn keyword rapidConstant ERR_UNIT_PAR ERR_UNKINO ERR_UNKPROC ERR_UNLOAD ERR_USE_PROF From c440bc5019f11a31d2ad83adaf0a3fd4917e2c4b Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Wed, 25 Nov 2020 11:08:22 +0100 Subject: [PATCH 29/53] add Homepos-Running functions --- syntax/rapid.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index 6a0d975..55684f5 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -357,6 +357,8 @@ else syn keyword rapidBuildInFunction contained PMgrAtSafe PMgrAtService PMgrAtState PMgrAtStation PMgrNextStation PMgrTaskNumber PMgrTaskName " Spot functions syn keyword rapidBuildInFunction contained SwGetCurrTargetName SwGetCurrSpotName + " Homepos-Running functions + syn keyword rapidBuildInFunction contained HR_RobotInHome HR_GetTypeDIndex HR_GetTypeIndex if g:rapidGroupName highlight default link rapidBuildInFunction BuildInFunction else From 4021405b12f204c1f66547d9240b2f0e651f61bd Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Wed, 25 Nov 2020 11:10:03 +0100 Subject: [PATCH 30/53] reorganize some move commands --- syntax/rapid.vim | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index 55684f5..fdec90d 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -277,6 +277,15 @@ else " }}} Statements, keywords et al " special keyword for move command {{{ + " uncategorized yet + syn keyword rapidMovement MovePnP + syn keyword rapidMovement EGMMoveC EGMMoveL EGMRunJoint EGMRunPose EGMStop + syn keyword rapidMovement IndAMove IndCMove IndDMove IndRMove + " common instructions + syn keyword rapidMovement MoveAbsJ MoveC MoveExtJ MoveJ MoveL + syn keyword rapidMovement MoveCAO MoveCDO MoveCGO MoveCSync MoveJAO MoveJDO MoveJGO MoveJSync MoveLAO MoveLDO MoveLGO MoveLSync + syn keyword rapidMovement SearchC SearchExtJ SearchL + syn keyword rapidMovement TriggC TriggJ TriggL TriggJIOs TriggLIOs " Arc instructions syn keyword rapidMovement ArcC ArcC1 ArcC2 ArcCEnd ArcC1End ArcC2End ArcCStart ArcC1Start ArcC2Start syn keyword rapidMovement ArcL ArcL1 ArcL2 ArcLEnd ArcL1End ArcL2End ArcLStart ArcL1Start ArcL2Start ArcMoveExtJ @@ -287,11 +296,6 @@ else syn keyword rapidMovement CapC CapL CapLATrSetup CSSDeactMoveL ContactL " Dispense instructions syn keyword rapidMovement DispL DispC - syn keyword rapidMovement EGMMoveC EGMMoveL EGMRunJoint EGMRunPose EGMStop - syn keyword rapidMovement IndAMove IndCMove IndDMove IndRMove - syn keyword rapidMovement MoveAbsJ MoveC MoveExtJ MoveJ MoveL - syn keyword rapidMovement MoveCAO MoveCDO MoveCGO MoveCSync MoveJAO MoveJDO MoveJGO MoveJSync MoveLAO MoveLDO MoveLGO MoveLSync - syn keyword rapidMovement MovePnP " Nut instructions" syn keyword rapidMovement NutL NutJ syn keyword rapidMovement PathRecMoveBwd PathRecMoveFwd @@ -302,8 +306,6 @@ else syn keyword rapidMovement SpotL SpotJ SpotML SpotMJ CalibL CalibJ MeasureWearL " Homepos-Running instructions syn keyword rapidMovement SMoveJ SMoveJDO SMoveJGO SMoveJSync SMoveL SMoveLDO SMoveLGO SMoveLSync SSearchL STriggJ STriggL - syn keyword rapidMovement SearchC SearchExtJ SearchL - syn keyword rapidMovement TriggC TriggJ TriggL TriggJIOs TriggLIOs " Discrete application platform instructions syn keyword rapidMovement DaProcML DaProcMJ if g:rapidGroupName From 2fc3c0b1ef0ece8abb5da2b8c73a6dc9504ca1d6 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Wed, 25 Nov 2020 11:11:43 +0100 Subject: [PATCH 31/53] fix rapidErrorShouldBeColonEqual --- syntax/rapid.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index fdec90d..42f9f70 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -375,7 +375,7 @@ else highlight default link rapidCallByVar Function " }}} Function - " Rapid Constants {{{ + " Constants {{{ " standard rapid constants syn keyword rapidConstant pi stEmpty syn keyword rapidConstant STR_DIGIT STR_LOWER STR_UPPER STR_WHITE @@ -551,7 +551,7 @@ else highlight default link rapidErrorIdentifierNameTooLong Error " " a == b + 1 - syn match rapidErrorShouldBeColonEqual /\c\v%(^\s*%(%(global\s+|task\s+|local\s+)?%(var|pers|const)\s+\w+\s+)?\w+%(\w|\{|,|\}|\+|\-|\*|\/|\.)*\s*)@<=\=/ + syn match rapidErrorShouldBeColonEqual /\c\v%(^\s*%(%(TASK\s+|LOCAL\s+)?%(VAR|PERS|CONST)\s+\w+\s+)?\w+%(\w|\{|,|\}|\+|\-|\*|\/|\.)*\s*)@<=\=/ highlight default link rapidErrorShouldBeColonEqual Error " " WaitUntil a==b From a62447c727a4566411f25ed381ec91439061b671 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Wed, 25 Nov 2020 11:22:43 +0100 Subject: [PATCH 32/53] add Homepos-Running move instructions Some of those may be mor of a regular instruction, however all of them start a movement, so they get the rapidMovement highlight. --- syntax/rapid.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index 42f9f70..902f428 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -306,6 +306,7 @@ else syn keyword rapidMovement SpotL SpotJ SpotML SpotMJ CalibL CalibJ MeasureWearL " Homepos-Running instructions syn keyword rapidMovement SMoveJ SMoveJDO SMoveJGO SMoveJSync SMoveL SMoveLDO SMoveLGO SMoveLSync SSearchL STriggJ STriggL + syn keyword rapidMovement HR_ContMove HR_MoveBack HR_MoveRoutine HR_MoveTo HR_MoveToHome SCSSDeactMoveL " Discrete application platform instructions syn keyword rapidMovement DaProcML DaProcMJ if g:rapidGroupName From 0cf8c073860b0727211bfa7b06a312cd9ca1c751 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Mon, 30 Nov 2020 22:07:12 +0100 Subject: [PATCH 33/53] endwise: use upper case automatically, no config option anymore --- doc/rapid.txt | 16 +--------------- ftplugin/rapid.vim | 17 ++++++++++------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/doc/rapid.txt b/doc/rapid.txt index 2810202..7111570 100644 --- a/doc/rapid.txt +++ b/doc/rapid.txt @@ -1,4 +1,4 @@ -*rapid.txt* Abb Rapid Command for Vim version 7.4 Last change: 13. Jul 2020 +*rapid.txt* Abb Rapid Command for Vim version 7.4 Last change: 30. Nov 2020 VIM REFERENCE MANUAL by Patrick Meiser-Knosowski @@ -251,9 +251,6 @@ Also see these options for alternative mappings. |g:rapidCompleteStd| Disable standard 'complete' setting |g:rapidCompleteCustom| Enable custom 'complete' setting -*rapid-endwise-options* -|g:rapidEndwiseUpperCase| Use upper case for `vim-endwise` - *rapid-auto-correct-cfg* |g:rapidAutoCorrCfgLineEnd| Auto correct mixed unix/dos line endings in *.cfg @@ -676,17 +673,6 @@ See also |rapid-complete|. If omitted or set to 0 no custom files get added to complete. -Index: |rapid-index| -============================================================================== - *g:rapidEndwiseUpperCase* -g:rapidEndwiseUpperCase: ------------------------- - -Insert upper case `ENDIF` etc. instead of lower case when `vim-endwise` -triggers: > - let g:rapidEndwiseUpperCase = 1 - - Index: |rapid-index| ============================================================================== *rapid-debug* diff --git a/ftplugin/rapid.vim b/ftplugin/rapid.vim index 00084e8..ce90112 100644 --- a/ftplugin/rapid.vim +++ b/ftplugin/rapid.vim @@ -2,7 +2,7 @@ " Language: ABB Rapid Command " Maintainer: Patrick Meiser-Knosowski " Version: 2.2.1 -" Last Change: 25. Sep 2020 +" Last Change: 30. Nov 2020 " Credits: Peter Oddings (KnopUniqueListItems/xolox#misc#list#unique) " Thanks for beta testing to Thomas Baginski " @@ -1302,13 +1302,16 @@ endif " get(g:,'rapidConcealStructs',1) " endwise support if exists("loaded_endwise") - if get(g:,'rapidEndwiseUpperCase',0) - let b:endwise_addition = '\=submatch(0)=~"CASE" ? "ENDTEST" : submatch(0)=~"IF" ? "ENDIF" : "END" . submatch(0)' - else - let b:endwise_addition = '\=submatch(0)=~"case" ? "endtest" : submatch(0)=~"if" ? "endif" : "end" . submatch(0)' - endif + let b:endwise_addition = '\=submatch(0)=~#"CASE" ? "ENDTEST" ' + let b:endwise_addition .= ': submatch(0)=~#"DEFAULT" ? "ENDTEST" ' + let b:endwise_addition .= ': submatch(0)=~#"IF" ? "ENDIF" ' + let b:endwise_addition .= ': submatch(0)=~"case" ? "endtest" ' + let b:endwise_addition .= ': submatch(0)=~"default" ? "endtest" ' + let b:endwise_addition .= ': submatch(0)=~"if" ? "endif" ' + let b:endwise_addition .= ': submatch(0)=~"\\u" ? "END" . toupper(submatch(0)) ' + let b:endwise_addition .= ': "end" . tolower(submatch(0))' let b:endwise_words = 'proc,func,trap,record,then,do,:' - let b:endwise_pattern = '^\s*\(local\s\+\)\?\zs\(proc\|func\|trap\|record\|if[^!]*\\ze' + let b:endwise_pattern = '^\s*\(local\s\+\)\?\zs\(proc\|func\|trap\|record\|module\|if[^!]*\\ze' let b:endwise_syngroups = 'rapidTypeDef,rapidRepeat,rapidConditional' endif From 8424f105363f7c06b56e98297463ef935661bc67 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Mon, 30 Nov 2020 22:08:42 +0100 Subject: [PATCH 34/53] fix: Make mappings for conceal structs work if g:rapidConcealStructs=0 This commit defines RapidConcealLevel() independent of g:rapidConcealStructs. If g:rapidConcealStructs was 0 at the start of an editing session the mappings (eg. F2-F3) for concealing structure values were generated, but the called function did not exist. --- ftplugin/rapid.vim | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/ftplugin/rapid.vim b/ftplugin/rapid.vim index ce90112..92bbea9 100644 --- a/ftplugin/rapid.vim +++ b/ftplugin/rapid.vim @@ -1264,37 +1264,33 @@ unlet s:pathList unlet s:pathToCurrentFile " conceal structure values (for MoveJ * v2500,z100...) -if get(g:,'rapidConcealStructs',1) +if !exists("*RapidConcealLevel") + function RapidConcealLevel(lvl) abort + " g:rapidConcealStructs may be used as input for a:lvl - if !exists("*RapidConcealLevel") - function RapidConcealLevel(lvl) abort - " g:rapidConcealStructs may be used as input for a:lvl + if a:lvl == 2 + " conceal all structure values + setlocal conceallevel=2 concealcursor=nc + return - if a:lvl == 2 - " conceal all structure values - setlocal conceallevel=2 concealcursor=nc - return - - elseif a:lvl == 1 - " conceal less structure values - setlocal conceallevel=2 concealcursor= - return - - endif + elseif a:lvl == 1 + " conceal less structure values + setlocal conceallevel=2 concealcursor= + return - " conceal no structure values - setlocal conceallevel=0 concealcursor= + endif - endfunction " RapidConcealLevel(lvl) + " conceal no structure values + setlocal conceallevel=0 concealcursor= - endif " !exists("*RapidConcealLevel") + endfunction " RapidConcealLevel(lvl) - call RapidConcealLevel(get(g:,'rapidConcealStructs',1)) +endif " !exists("*RapidConcealLevel") - let b:undo_ftplugin = b:undo_ftplugin." cole< cocu<" +call RapidConcealLevel(get(g:,'rapidConcealStructs',1)) -endif " get(g:,'rapidConcealStructs',1) +let b:undo_ftplugin = b:undo_ftplugin." cole< cocu<" " }}} Vim Settings From 0f166432d723d8a37227862129955731334ac6a6 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Tue, 1 Dec 2020 00:31:03 +0100 Subject: [PATCH 35/53] fix indent of DEFAULT which follows a TEST without any CASE --- indent/rapid.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indent/rapid.vim b/indent/rapid.vim index 374977d..a7f01a6 100644 --- a/indent/rapid.vim +++ b/indent/rapid.vim @@ -2,7 +2,7 @@ " Language: ABB Rapid Command " Maintainer: Patrick Meiser-Knosowski " Version: 2.2.2 -" Last Change: 25. Sep 2020 +" Last Change: 01. Dec 2020 " Credits: Based on indent/vim.vim " " Suggestions of improvement are very welcome. Please email me! @@ -119,8 +119,8 @@ function s:GetRapidIndentIntern() abort let l:ind = l:ind - &sw endif - " First case after a test gets the indent of the test. - if s:RapidLenTilStr(l:currentLineNum, "case", 0)>=0 && s:RapidLenTilStr(l:preNoneBlankLineNum, "test", 0)>=0 + " First case (or default) after a test gets the indent of the test. + if (s:RapidLenTilStr(l:currentLineNum, "case", 0)>=0 || s:RapidLenTilStr(l:currentLineNum, "default", 0)>=0) && s:RapidLenTilStr(l:preNoneBlankLineNum, "test", 0)>=0 let l:ind += &sw endif From b6bd3cde4332a99510f3c67a1a164d524385773a Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Tue, 1 Dec 2020 00:35:58 +0100 Subject: [PATCH 36/53] fix custom complete not found in same directory Outside of the regular Backup structure a file configured with g:rapidCompleteCustom was not found even though it is present in the same directory as the current file. This commit also allows keyword chars as module name (and therefore file name). --- ftplugin/rapid.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftplugin/rapid.vim b/ftplugin/rapid.vim index 92bbea9..8b0702a 100644 --- a/ftplugin/rapid.vim +++ b/ftplugin/rapid.vim @@ -2,7 +2,7 @@ " Language: ABB Rapid Command " Maintainer: Patrick Meiser-Knosowski " Version: 2.2.1 -" Last Change: 30. Nov 2020 +" Last Change: 01. Dec 2020 " Credits: Peter Oddings (KnopUniqueListItems/xolox#misc#list#unique) " Thanks for beta testing to Thomas Baginski " @@ -1223,7 +1223,7 @@ let s:pathToCurrentFile = substitute(expand("%:p:h"),'\\','/','g') " complete custom files if exists('g:rapidCompleteCustom') for s:customCompleteAdditions in g:rapidCompleteCustom - let s:file = substitute(s:customCompleteAdditions,'^.*[\\/]\(\w\+\.\)\(src\|sub\|dat\)$','\1\2','') + let s:file = substitute(s:customCompleteAdditions,'^.*[\\/]\(\k\+\.\)\(\w\+\)$','\1\2','') call s:KnopAddFileToCompleteOption(s:customCompleteAdditions,s:pathList,s:pathToCurrentFile.'/'.s:file,) endfor endif From fd6fbcbf29e10b0d7c7435837ca1363843840cfa Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Tue, 1 Dec 2020 00:44:30 +0100 Subject: [PATCH 37/53] style indentation --- ftplugin/rapid.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftplugin/rapid.vim b/ftplugin/rapid.vim index 8b0702a..01fde42 100644 --- a/ftplugin/rapid.vim +++ b/ftplugin/rapid.vim @@ -1223,7 +1223,7 @@ let s:pathToCurrentFile = substitute(expand("%:p:h"),'\\','/','g') " complete custom files if exists('g:rapidCompleteCustom') for s:customCompleteAdditions in g:rapidCompleteCustom - let s:file = substitute(s:customCompleteAdditions,'^.*[\\/]\(\k\+\.\)\(\w\+\)$','\1\2','') + let s:file = substitute(s:customCompleteAdditions,'^.*[\\/]\(\k\+\.\)\(\w\+\)$','\1\2','') call s:KnopAddFileToCompleteOption(s:customCompleteAdditions,s:pathList,s:pathToCurrentFile.'/'.s:file,) endfor endif From 8e6602b6d3945e82a00202e30ca02ac3f203a0c0 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Tue, 1 Dec 2020 00:58:11 +0100 Subject: [PATCH 38/53] indent after proc/func/trap/record/module with umlauts --- indent/rapid.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indent/rapid.vim b/indent/rapid.vim index a7f01a6..058e9a4 100644 --- a/indent/rapid.vim +++ b/indent/rapid.vim @@ -86,7 +86,7 @@ function s:GetRapidIndentIntern() abort " Define add a 'shiftwidth' pattern let l:addShiftwidthPattern = '\c\v^\s*(' - let l:addShiftwidthPattern .= '((local|task)\s+)?(module|record|proc|func|trap)\s+\w' + let l:addShiftwidthPattern .= '((local|task)\s+)?(module|record|proc|func|trap)\s+\k' let l:addShiftwidthPattern .= '|(backward|error|undo)>' let l:addShiftwidthPattern .= ')' " @@ -145,7 +145,7 @@ function s:RapidLenTilStr(lnum, str, startIdx) abort let l:line = getline(a:lnum) let l:len = strlen(l:line) let l:idx = a:startIdx - if a:str =~ '^\w\+$' + if a:str =~ '^\k\+$' let l:str = '\c\<' . a:str . '\>' else let l:str = a:str From 4545cff1d8f3a435a036b371642431bdc3ac5771 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Thu, 10 Dec 2020 16:00:10 +0100 Subject: [PATCH 39/53] feature: set 'fileencoding' = latin1 --- ftplugin/rapid.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ftplugin/rapid.vim b/ftplugin/rapid.vim index 01fde42..10b021c 100644 --- a/ftplugin/rapid.vim +++ b/ftplugin/rapid.vim @@ -2,7 +2,7 @@ " Language: ABB Rapid Command " Maintainer: Patrick Meiser-Knosowski " Version: 2.2.1 -" Last Change: 01. Dec 2020 +" Last Change: 10. Dec 2020 " Credits: Peter Oddings (KnopUniqueListItems/xolox#misc#list#unique) " Thanks for beta testing to Thomas Baginski " @@ -1193,6 +1193,9 @@ if get(g:,'rapidFormatComments',1) endif endif " format comments +setlocal fileencoding=latin1 +let b:undo_ftplugin = b:undo_ftplugin." fenc<" + " path for gf, :find etc if get(g:,'rapidPath',1) From 436c7b245eb481e5a77050da8340b14459fc4f79 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Thu, 10 Dec 2020 16:01:55 +0100 Subject: [PATCH 40/53] feature: support ]],[[... for .cfg files --- ftplugin/rapid.vim | 137 +++++++++++++++++++++++++-------------------- 1 file changed, 76 insertions(+), 61 deletions(-) diff --git a/ftplugin/rapid.vim b/ftplugin/rapid.vim index 10b021c..a778f9d 100644 --- a/ftplugin/rapid.vim +++ b/ftplugin/rapid.vim @@ -1334,67 +1334,82 @@ endif " Move Around and Function Text Object key mappings {{{ if get(g:,'rapidMoveAroundKeyMap',1) - " Move around functions - nnoremap [[ :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*(global\s+\|local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>', 'bs') unlet b:knopCount:normal! zt - onoremap [[ :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*(global\s+\|local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>.*\n\zs', 'bsW')unlet b:knopCount - xnoremap [[ :let b:knopCount=v:count1exe "normal! gv" call KnopNTimesSearch(b:knopCount, '\c\v^\s*(global\s+\|local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>', 'bsW') unlet b:knopCount - nnoremap ]] :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*(global\s+\|local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>', 's') unlet b:knopCount:normal! zt - onoremap ]] :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*(global\s+\|local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>', 'sW') unlet b:knopCount - xnoremap ]] :let b:knopCount=v:count1exe "normal! gv" call KnopNTimesSearch(b:knopCount, '\c\v^\s*(global\s+\|local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>.*\n', 'seWz')unlet b:knopCount - nnoremap [] :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*end(proc\|func\|trap\|record\|module)>', 'bs') unlet b:knopCount:normal! zb - onoremap [] :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*end(proc\|func\|trap\|record\|module)>\n^(.\|\n)', 'bseW') unlet b:knopCount - xnoremap [] :let b:knopCount=v:count1exe "normal! gv" call KnopNTimesSearch(b:knopCount, '\c\v^\s*end(proc\|func\|trap\|record\|module)>', 'bsW') unlet b:knopCount - nnoremap ][ :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*end(proc\|func\|trap\|record\|module)>', 's') unlet b:knopCount:normal! zb - onoremap ][ :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v\ze^\s*end(proc\|func\|trap\|record\|module)>', 'sW') unlet b:knopCount - xnoremap ][ :let b:knopCount=v:count1exe "normal! gv" call KnopNTimesSearch(b:knopCount, '\c\v^\s*end(proc\|func\|trap\|record\|module)>(\n)?', 'seWz') unlet b:knopCount - " Move around comments - nnoremap [; :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\v(^\s*!.*\n)@unlet b:knopCount - onoremap [; :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\v(^\s*!.*\n)@unlet b:knopCount - xnoremap [; :let b:knopCount=v:count1exe "normal! gv"call KnopNTimesSearch(b:knopCount, '\v(^\s*!.*\n)@unlet b:knopCount - nnoremap ]; :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\v^\s*!.*\n\s*([^!\t ]\|$)', 's')unlet b:knopCount - onoremap ]; :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\v^\s*!.*\n(\s*[^!\t ]\|$)', 'seW')normal! ==unlet b:knopCount - xnoremap ]; :let b:knopCount=v:count1exe "normal! gv"call KnopNTimesSearch(b:knopCount, '\v^\s*!.*\n\ze\s*([^!\t ]\|$)', 'seW')unlet b:knopCount - " inner and around function text objects - if get(g:,'rapidFunctionTextObject',0) - \|| mapcheck("aF","x")=="" && !hasmapto('RapidTxtObjAroundFuncInclCo','x') - xmap aF RapidTxtObjAroundFuncInclCo - endif - if get(g:,'rapidFunctionTextObject',0) - \|| mapcheck("af","x")=="" && !hasmapto('RapidTxtObjAroundFuncExclCo','x') - xmap af RapidTxtObjAroundFuncExclCo - endif - if get(g:,'rapidFunctionTextObject',0) - \|| mapcheck("if","x")=="" && !hasmapto('RapidTxtObjInnerFunc','x') - xmap if RapidTxtObjInnerFunc - endif - if get(g:,'rapidFunctionTextObject',0) - \|| mapcheck("aF","o")=="" && !hasmapto('RapidTxtObjAroundFuncInclCo','o') - omap aF RapidTxtObjAroundFuncInclCo - endif - if get(g:,'rapidFunctionTextObject',0) - \|| mapcheck("af","o")=="" && !hasmapto('RapidTxtObjAroundFuncExclCo','o') - omap af RapidTxtObjAroundFuncExclCo - endif - if get(g:,'rapidFunctionTextObject',0) - \|| mapcheck("if","o")=="" && !hasmapto('RapidTxtObjInnerFunc','o') - omap if RapidTxtObjInnerFunc - endif - " inner and around comment text objects - if get(g:,'rapidCommentTextObject',0) - \|| mapcheck("ac","x")=="" && !hasmapto('RapidTxtObjAroundComment','x') - xmap ac RapidTxtObjAroundComment - endif - if get(g:,'rapidCommentTextObject',0) - \|| mapcheck("ic","x")=="" && !hasmapto('RapidTxtObjInnerComment','x') - xmap ic RapidTxtObjInnerComment - endif - if get(g:,'rapidCommentTextObject',0) - \|| mapcheck("ac","o")=="" && !hasmapto('RapidTxtObjAroundComment','o') - omap ac RapidTxtObjAroundComment - endif - if get(g:,'rapidCommentTextObject',0) - \|| mapcheck("ic","o")=="" && !hasmapto('RapidTxtObjInnerComment','o') - omap ic RapidTxtObjInnerComment + if bufname("%") =~ '\c\.cfg$' + nnoremap ]] :call search('^#','sw') + nnoremap [[ :call search('^#','bsw') + nnoremap ][ :call search('.*\(\n#\\|\%$\)','sw') + nnoremap [] :call search('^#\n\w\+:\n\n','besw') + xnoremap ]] :exe "normal! gv"call search('\(^#\\|\%$\)','sW') + xnoremap [[ :exe "normal! gv"call search('^#','bsW') + xnoremap ][ :exe "normal! gv"call search('\(\n#\\|\%$\)','sW') + xnoremap [] :exe "normal! gv"call search('^#\n\w\+:\n\n','besW') + onoremap ]] :exe "normal! v"call search('\(\ze\n#\\|\%$\)','eW') + onoremap [[ :call search('^#','bW') + onoremap ][ :exe "normal! v"call search('\(\n#\\|\%$\)','sW') + onoremap [] :exe "normal! V"call search('^#\n\w\+:\n\n','besW') + else + " Move around functions + nnoremap [[ :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*(global\s+\|local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>', 'bs') unlet b:knopCount:normal! zt + onoremap [[ :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*(global\s+\|local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>.*\n\zs', 'bsW')unlet b:knopCount + xnoremap [[ :let b:knopCount=v:count1exe "normal! gv" call KnopNTimesSearch(b:knopCount, '\c\v^\s*(global\s+\|local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>', 'bsW') unlet b:knopCount + nnoremap ]] :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*(global\s+\|local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>', 's') unlet b:knopCount:normal! zt + onoremap ]] :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*(global\s+\|local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>', 'sW') unlet b:knopCount + xnoremap ]] :let b:knopCount=v:count1exe "normal! gv" call KnopNTimesSearch(b:knopCount, '\c\v^\s*(global\s+\|local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>.*\n', 'seWz')unlet b:knopCount + nnoremap [] :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*end(proc\|func\|trap\|record\|module)>', 'bs') unlet b:knopCount:normal! zb + onoremap [] :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*end(proc\|func\|trap\|record\|module)>\n^(.\|\n)', 'bseW') unlet b:knopCount + xnoremap [] :let b:knopCount=v:count1exe "normal! gv" call KnopNTimesSearch(b:knopCount, '\c\v^\s*end(proc\|func\|trap\|record\|module)>', 'bsW') unlet b:knopCount + nnoremap ][ :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*end(proc\|func\|trap\|record\|module)>', 's') unlet b:knopCount:normal! zb + onoremap ][ :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v\ze^\s*end(proc\|func\|trap\|record\|module)>', 'sW') unlet b:knopCount + xnoremap ][ :let b:knopCount=v:count1exe "normal! gv" call KnopNTimesSearch(b:knopCount, '\c\v^\s*end(proc\|func\|trap\|record\|module)>(\n)?', 'seWz') unlet b:knopCount + " Move around comments + nnoremap [; :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\v(^\s*!.*\n)@unlet b:knopCount + onoremap [; :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\v(^\s*!.*\n)@unlet b:knopCount + xnoremap [; :let b:knopCount=v:count1exe "normal! gv"call KnopNTimesSearch(b:knopCount, '\v(^\s*!.*\n)@unlet b:knopCount + nnoremap ]; :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\v^\s*!.*\n\s*([^!\t ]\|$)', 's')unlet b:knopCount + onoremap ]; :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\v^\s*!.*\n(\s*[^!\t ]\|$)', 'seW')normal! ==unlet b:knopCount + xnoremap ]; :let b:knopCount=v:count1exe "normal! gv"call KnopNTimesSearch(b:knopCount, '\v^\s*!.*\n\ze\s*([^!\t ]\|$)', 'seW')unlet b:knopCount + " inner and around function text objects + if get(g:,'rapidFunctionTextObject',0) + \|| mapcheck("aF","x")=="" && !hasmapto('RapidTxtObjAroundFuncInclCo','x') + xmap aF RapidTxtObjAroundFuncInclCo + endif + if get(g:,'rapidFunctionTextObject',0) + \|| mapcheck("af","x")=="" && !hasmapto('RapidTxtObjAroundFuncExclCo','x') + xmap af RapidTxtObjAroundFuncExclCo + endif + if get(g:,'rapidFunctionTextObject',0) + \|| mapcheck("if","x")=="" && !hasmapto('RapidTxtObjInnerFunc','x') + xmap if RapidTxtObjInnerFunc + endif + if get(g:,'rapidFunctionTextObject',0) + \|| mapcheck("aF","o")=="" && !hasmapto('RapidTxtObjAroundFuncInclCo','o') + omap aF RapidTxtObjAroundFuncInclCo + endif + if get(g:,'rapidFunctionTextObject',0) + \|| mapcheck("af","o")=="" && !hasmapto('RapidTxtObjAroundFuncExclCo','o') + omap af RapidTxtObjAroundFuncExclCo + endif + if get(g:,'rapidFunctionTextObject',0) + \|| mapcheck("if","o")=="" && !hasmapto('RapidTxtObjInnerFunc','o') + omap if RapidTxtObjInnerFunc + endif + " inner and around comment text objects + if get(g:,'rapidCommentTextObject',0) + \|| mapcheck("ac","x")=="" && !hasmapto('RapidTxtObjAroundComment','x') + xmap ac RapidTxtObjAroundComment + endif + if get(g:,'rapidCommentTextObject',0) + \|| mapcheck("ic","x")=="" && !hasmapto('RapidTxtObjInnerComment','x') + xmap ic RapidTxtObjInnerComment + endif + if get(g:,'rapidCommentTextObject',0) + \|| mapcheck("ac","o")=="" && !hasmapto('RapidTxtObjAroundComment','o') + omap ac RapidTxtObjAroundComment + endif + if get(g:,'rapidCommentTextObject',0) + \|| mapcheck("ic","o")=="" && !hasmapto('RapidTxtObjInnerComment','o') + omap ic RapidTxtObjInnerComment + endif endif endif From a2ad4b83a094f56c9f19700f42b272a817e99026 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Thu, 17 Dec 2020 12:25:04 +0100 Subject: [PATCH 41/53] add a logo to README.md --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index b4bb356..b941ac1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,33 @@ +``` + ____ _____ _____ _____ ____ + | | | | | | |_ _| | \ + | _ | | _ | | _ | | | | _ | + | | ||_ | | | | | | | | | | | | | | + | |_| | | |_| | | |_| | | | | | | | + | __ | | _ | | _ _| _| |_ | |_| | + |_| \_| |_| |_| |_| |_____| |____/ + + for Vim + _ _______ + /.\\ / ___ \_________ _ + \_/ \ | / \ ____ \/ | _____ + \ \ | | O | _________/\_| / | o\ + \--\ | \___/ / _/ _/ / + | o | \ \ /\ /.\ / | | + /--/ \ \\ \ \/\ \_// | | + / / \ \\ \ \ \ / | + _/ / \ _ \ \-\ | o\_ + / \ / | /.\ | |o| /_____\ + | o |_ _____/ \_/ | /-/ | | + \_/__|__ |____ ______/ / / |_____| + |___ ___\ | \_____ | / | + | \__ | \___________/ | o \__ + |______| | | \______\ + | | | | + |___________| |_____| + + industrial robot programming +``` # rapid-for-vim **READ [FAQ][2] FIRST** if you want more than just syntax highlight and From fcc9cbf1ba7c4da6068926825d333032b72d7d3f Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Fri, 18 Dec 2020 04:13:15 +0100 Subject: [PATCH 42/53] change logo text a bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b941ac1..5876d74 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ ``` ____ _____ _____ _____ ____ - | | | | | | |_ _| | \ + | \ / \ | \ |_ _| | \ | _ | | _ | | _ | | | | _ | | | ||_ | | | | | | | | | | | | | | - | |_| | | |_| | | |_| | | | | | | | + | |_| \ | |_| | | |_| | | | | | | | | __ | | _ | | _ _| _| |_ | |_| | |_| \_| |_| |_| |_| |_____| |____/ From afd5ce919ed45343b4470acac59eba80ed5e1540 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Fri, 18 Dec 2020 04:18:02 +0100 Subject: [PATCH 43/53] change logo text a bit --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5876d74..e97d42a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ ``` - ____ _____ _____ _____ ____ - | \ / \ | \ |_ _| | \ + ___ ___ ____ _____ ____ + | \ / \ | \ |_ _| | \ | _ | | _ | | _ | | | | _ | - | | ||_ | | | | | | | | | | | | | | - | |_| \ | |_| | | |_| | | | | | | | + | | || | | | | | | | | | | | | | | + | |_| \ | |_| | | |_| | | | | | | | | __ | | _ | | _ _| _| |_ | |_| | |_| \_| |_| |_| |_| |_____| |____/ From 5f290175adf6e65f2d4c51aac8c841edcc9e4b85 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Fri, 18 Dec 2020 04:39:40 +0100 Subject: [PATCH 44/53] align logo text --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e97d42a..c83f87f 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ ``` - ___ ___ ____ _____ ____ - | \ / \ | \ |_ _| | \ - | _ | | _ | | _ | | | | _ | - | | || | | | | | | | | | | | | | | - | |_| \ | |_| | | |_| | | | | | | | - | __ | | _ | | _ _| _| |_ | |_| | - |_| \_| |_| |_| |_| |_____| |____/ - - for Vim + ___ ___ ____ _____ ____ + | \ / \ | \ |_ _| | \ + | _ | | _ | | _ | | | | _ | + | | || | | | | | | | | | | | | | | + | |_| \ | |_| | | |_| | | | | | | | + | __ | | _ | | _ _| _| |_ | |_| | + |_| \_| |_| |_| |_| |_____| |____/ + + for Vim _ _______ /.\\ / ___ \_________ _ \_/ \ | / \ ____ \/ | _____ @@ -25,7 +25,7 @@ |______| | | \______\ | | | | |___________| |_____| - + industrial robot programming ``` # rapid-for-vim From d020d558e051666d93e78f47407820445e480950 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Sat, 19 Dec 2020 22:54:47 +0100 Subject: [PATCH 45/53] rearrange text in logo --- README.md | 45 +++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index c83f87f..aee4585 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,21 @@ ``` - ___ ___ ____ _____ ____ - | \ / \ | \ |_ _| | \ - | _ | | _ | | _ | | | | _ | - | | || | | | | | | | | | | | | | | - | |_| \ | |_| | | |_| | | | | | | | - | __ | | _ | | _ _| _| |_ | |_| | - |_| \_| |_| |_| |_| |_____| |____/ - - for Vim - _ _______ - /.\\ / ___ \_________ _ - \_/ \ | / \ ____ \/ | _____ - \ \ | | O | _________/\_| / | o\ - \--\ | \___/ / _/ _/ / - | o | \ \ /\ /.\ / | | - /--/ \ \\ \ \/\ \_// | | - / / \ \\ \ \ \ / | - _/ / \ _ \ \-\ | o\_ - / \ / | /.\ | |o| /_____\ - | o |_ _____/ \_/ | /-/ | | - \_/__|__ |____ ______/ / / |_____| - |___ ___\ | \_____ | / | - | \__ | \___________/ | o \__ - |______| | | \______\ - | | | | - |___________| |_____| - - industrial robot programming + _ _______ + /.\\ / ___ \_________ _ + ___ ___ ____ _____ ____ \_/ \ | / \ ____ \/ | _____ +| \ / \ | \ |_ _| | \ \ \ | | O | _________/\_| / | o\ +| _ | | _ | | _ | | | | _ | \--\ | \___/ / _/ _/ / +| | || | | | | | | | | | | | | | | | o | \ \ /\ /.\ / | | +| |_| \ | |_| | | |_| | | | | |_| | /--/ \ \\ \ \/\ \_// | | +| __ | | _ | | ___| _| |_ | | / / \ \\ \ \ \ / | +|_| \_| |_| |_| |_| |_____| |____/ _/ / \ _ \ \-\ | o\_ + / \ / | /.\ | |o| /_____\ + for Vim | o |_ _____/ \_/ | /-/ | | + by Knosowski \_/__|__ |____ ______/ / / |_____| + |___ ___\ | \_____ | / | + | \__ | \___________/ | o \__ + |______| | | \______\ + industrial robot programming | | | | + |___________| |_____| ``` # rapid-for-vim From 011fd39785c862b8162467bf5ef0463601f1e99d Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Sun, 20 Dec 2020 08:15:26 +0100 Subject: [PATCH 46/53] simplified code --- indent/rapid.vim | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/indent/rapid.vim b/indent/rapid.vim index 058e9a4..3fcf3ce 100644 --- a/indent/rapid.vim +++ b/indent/rapid.vim @@ -2,7 +2,7 @@ " Language: ABB Rapid Command " Maintainer: Patrick Meiser-Knosowski " Version: 2.2.2 -" Last Change: 01. Dec 2020 +" Last Change: 20. Dec 2020 " Credits: Based on indent/vim.vim " " Suggestions of improvement are very welcome. Please email me! @@ -145,10 +145,9 @@ function s:RapidLenTilStr(lnum, str, startIdx) abort let l:line = getline(a:lnum) let l:len = strlen(l:line) let l:idx = a:startIdx - if a:str =~ '^\k\+$' - let l:str = '\c\<' . a:str . '\>' - else - let l:str = a:str + let l:str = a:str + if l:str =~ '^\k\+$' + let l:str = '\c\<' . l:str . '\>' endif while l:len > l:idx From 58932845951b9c240c40e9dc1b9b7b19afefd3a4 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Sun, 20 Dec 2020 08:17:17 +0100 Subject: [PATCH 47/53] optional different indent of multi line structure Added an undocumented variable g:rapidNewStyleIndent for a different indent style of multi line structures. Not everyone may like that, so it's off by default. --- indent/rapid.vim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/indent/rapid.vim b/indent/rapid.vim index 3fcf3ce..a52800e 100644 --- a/indent/rapid.vim +++ b/indent/rapid.vim @@ -32,7 +32,11 @@ setlocal nolisp setlocal nosmartindent setlocal autoindent setlocal indentexpr=GetRapidIndent() -setlocal indentkeys=!^F,o,O,0=~endmodule,0=~error,0=~undo,0=~backward,0=~endproc,0=~endrecord,0=~endtrap,0=~endfunc,0=~else,0=~endif,0=~endtest,0=~endfor,0=~endwhile,: +if get(g:,'rapidNewStyleIndent',0) + setlocal indentkeys=!^F,o,O,0=~endmodule,0=~error,0=~undo,0=~backward,0=~endproc,0=~endrecord,0=~endtrap,0=~endfunc,0=~else,0=~endif,0=~endtest,0=~endfor,0=~endwhile,:,<[>,<]>,<(>,<)> +else + setlocal indentkeys=!^F,o,O,0=~endmodule,0=~error,0=~undo,0=~backward,0=~endproc,0=~endrecord,0=~endtrap,0=~endfunc,0=~else,0=~endif,0=~endtest,0=~endfor,0=~endwhile,: +endif let b:undo_indent="setlocal lisp< si< ai< inde< indk<" if get(g:,'rapidSpaceIndent',1) @@ -126,7 +130,11 @@ function s:GetRapidIndentIntern() abort " continued lines with () or [] let l:OpenSum = s:RapidLoneParen(l:preNoneBlankLineNum,"(") + s:RapidLoneParen(l:preNoneBlankLineNum,"[") - let l:CloseSum = s:RapidLoneParen(l:preNoneBlankLineNum,")") + s:RapidLoneParen(l:preNoneBlankLineNum,"]") + if get(g:,'rapidNewStyleIndent',0) + let l:CloseSum = s:RapidLoneParen(l:preNoneBlankLineNum,")") + s:RapidLoneParen(l:currentLineNum,"]") + else + let l:CloseSum = s:RapidLoneParen(l:preNoneBlankLineNum,")") + s:RapidLoneParen(l:preNoneBlankLineNum,"]") + endif if l:OpenSum > l:CloseSum let l:ind += (l:OpenSum * 4 * &sw) elseif l:OpenSum < l:CloseSum From 37b03c48abb03832b5d70d67e524eaf7f0dacd08 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Tue, 22 Dec 2020 04:20:40 +0100 Subject: [PATCH 48/53] Disable rapidErrorStringTooLong. It's buggy and does perform poorly --- syntax/rapid.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index 902f428..a5cb4a7 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -2,7 +2,7 @@ " Language: ABB Rapid Command " Maintainer: Patrick Meiser-Knosowski " Version: 2.2.2 -" Last Change: 25. Oct 2020 +" Last Change: 22. Dec 2020 " Credits: Thanks for beta testing to Thomas Baginski " " Suggestions of improvement are very welcome. Please email me! @@ -588,7 +588,7 @@ if get(g:,'rapidShowError',1) " " This error must be defined after rapidString " string too long - syn match rapidErrorStringTooLong /\v("[^"]{80})@81<=[^"]+\ze"/ contained + " syn match rapidErrorStringTooLong /\v("[^"]{80})@81<=[^"]+\ze"/ contained highlight default link rapidErrorStringTooLong Error " endif From f66d3b7f4f3e1d0dc2021fcd4dd346b519922465 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Tue, 22 Dec 2020 04:24:20 +0100 Subject: [PATCH 49/53] Fix some caseing --- syntax/rapid.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index a5cb4a7..e88b0ae 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -161,7 +161,7 @@ else " Type, StorageClass and Typedef {{{ " anytype (preceded by 'alias|pers|var|const|func' " TODO: still missing are userdefined types which are part of a parameter: - " proc message( mystring msMessagePart1{}, + " PROC message( mystring msMessagePart1{}, " \ myvar msMsg4{}) " TODO testing. Problem: does not highlight any type if it's part of an argument list " syn match rapidAnyType /\v^\s*(global\s+|task\s+|local\s+)?(alias|pers|var|const|func)\s+\w+>/ contains=rapidStorageClass,rapidType,rapidTypeDef @@ -221,7 +221,7 @@ else syn keyword rapidConditional if then elseif else endif test case default endtest highlight default link rapidConditional Conditional " Repeat - syn keyword rapidRepeat DO + syn keyword rapidRepeat do syn match rapidRepeat /\c\v^\s*%(|)%([^!]+)@=/ syn keyword rapidRepeat from to step endfor endwhile highlight default link rapidRepeat Repeat @@ -370,7 +370,7 @@ else " }}} " Function {{{ - syn match rapidFunction contains=rapidBuildInFunction /\v\c%(<(proc|module)\s+)@10 Date: Tue, 22 Dec 2020 04:38:57 +0100 Subject: [PATCH 50/53] Feature: Allow umlauts in labels, variable- and function names --- syntax/rapid.vim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/syntax/rapid.vim b/syntax/rapid.vim index e88b0ae..e131ff0 100644 --- a/syntax/rapid.vim +++ b/syntax/rapid.vim @@ -227,7 +227,7 @@ else highlight default link rapidRepeat Repeat " Label syn keyword rapidLabel goto - syn match rapidLabel /\c\v^\s*\a\w*\:\ze%([^=]|$)/ contains=rapidConditional,rapidOperator + syn match rapidLabel /\c\v^\s*[[:upper:][:lower:]]\k*\:\ze%([^=]|$)/ contains=rapidConditional,rapidOperator highlight default link rapidLabel Label " Keyword syn keyword rapidKeyword AccSet ActEventBuffer ActUnit Add AliasCamera AliasIO AliasIOReset BitClear BitSet BookErrNo BrakeCheck @@ -317,7 +317,7 @@ else " }}} special keyword for move command " Structure value {{{ - syn match rapidNames /[a-zA-Z_][.a-zA-Z0-9_]*/ + syn match rapidNames /\v[[:upper:][:lower:]](\k|\.)*/ " highlight default link rapidNames None " rapid structrure values. added to be able to conceal them syn region rapidConcealableString start=/"/ end=/"/ contained contains=rapidCharCode,rapidEscapedBackSlash,rapidErrorSingleBackslash,rapidErrorStringTooLong conceal @@ -370,7 +370,7 @@ else " }}} " Function {{{ - syn match rapidFunction contains=rapidBuildInFunction /\v\c%(<(PROC|MODULE)\s+)@1032 chars are not possible in rapid. a234567890123456789012345 - syn match rapidErrorIdentifierNameTooLong /\w\{33,}/ containedin=rapidFunction,rapidNames,rapidLabel + syn match rapidErrorIdentifierNameTooLong /\k\{33,}/ containedin=rapidFunction,rapidNames,rapidLabel highlight default link rapidErrorIdentifierNameTooLong Error " " a == b + 1 - syn match rapidErrorShouldBeColonEqual /\c\v%(^\s*%(%(TASK\s+|LOCAL\s+)?%(VAR|PERS|CONST)\s+\w+\s+)?\w+%(\w|\{|,|\}|\+|\-|\*|\/|\.)*\s*)@<=\=/ + syn match rapidErrorShouldBeColonEqual /\c\v%(^\s*%(%(TASK\s+|LOCAL\s+)?%(VAR|PERS|CONST)\s+\k+\s+)?\k+%(\k|[.{},*/+-])*\s*)@<=\=/ highlight default link rapidErrorShouldBeColonEqual Error " " WaitUntil a==b @@ -573,7 +573,7 @@ else highlight default link rapidErrorMissingOperator Error " " "for" missing "from" - syn match rapidErrorMissingFrom /\c\v^\s*for\s+%(\w[0-9a-zA-Z_.{},*/+-]*\s+from)@!\S+\s+\S+/ + syn match rapidErrorMissingFrom /\c\v^\s*for\s+%([[:upper:][:lower:]]%(\k|[.{},*/+-])*\s+from)@!\S+\s+\S+/ highlight default link rapidErrorMissingFrom Error " " From 65c45351fc304babadd16881ea8bb0ed5da8ba35 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Tue, 22 Dec 2020 05:25:52 +0100 Subject: [PATCH 51/53] Style --- ftplugin/rapid.vim | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ftplugin/rapid.vim b/ftplugin/rapid.vim index a778f9d..9c67502 100644 --- a/ftplugin/rapid.vim +++ b/ftplugin/rapid.vim @@ -2,7 +2,7 @@ " Language: ABB Rapid Command " Maintainer: Patrick Meiser-Knosowski " Version: 2.2.1 -" Last Change: 10. Dec 2020 +" Last Change: 22. Dec 2020 " Credits: Peter Oddings (KnopUniqueListItems/xolox#misc#list#unique) " Thanks for beta testing to Thomas Baginski " @@ -400,7 +400,8 @@ if !exists("*s:KnopVerboseEcho()") " elseif l:currentChar =~ '\d' && \( synIDattr(synID(line("."),col("."),0),"name")=="rapidFloat" - \|| synIDattr(synID(line("."),col("."),0),"name")=="") + \|| synIDattr(synID(line("."),col("."),0),"name")=="" + \) return ("num" . l:word) " elseif l:nextChar == "(" && @@ -1081,10 +1082,6 @@ if !exists("*s:KnopVerboseEcho()") let l:qfresult = [] for l:i in getqflist() if bufname(get(l:i,'bufnr')) !~ '\~$' - " \&& (get(l:i,'text') =~ '\v\c^([^"]*"[^"]*"[^"]*)*[^"]*<'.l:currentWord.'>' - " \|| (bufname(get(l:i,'bufnr')) !~ '\v\c\w+\.mod$' - " \&& bufname(get(l:i,'bufnr')) !~ '\v\c\w+\.sys$' - " \&& bufname(get(l:i,'bufnr')) !~ '\v\c\w+\.prg$')) call add(l:qfresult,l:i) endif endfor From 3cf89ad536e8241d2f660fe85deae31094c90c70 Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Tue, 22 Dec 2020 05:45:59 +0100 Subject: [PATCH 52/53] Fix: Don't accept 'global' --- ftplugin/rapid.vim | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/ftplugin/rapid.vim b/ftplugin/rapid.vim index 9c67502..bd9fa59 100644 --- a/ftplugin/rapid.vim +++ b/ftplugin/rapid.vim @@ -454,12 +454,12 @@ if !exists("*s:KnopVerboseEcho()") " let l:numSearchStartLine = line(".") let l:numSearchStartColumn = col(".") - let l:numProcStart = search('\v\c^\s*((local|global|task)\s+)?(proc|func|trap)\s+','bcnW') + let l:numProcStart = search('\v\c^\s*((local|task)\s+)?(proc|func|trap)\s+','bcnW') let l:numProcEnd = search('\v\c^\s*end(proc|func|trap)>','cnW') " " if search starts inside a proc, search local decl if l:numProcStart != 0 && l:numProcEnd != 0 - \&& search('\v\c^\s*(((local|global|task)\s+)?(proc|func|trap)\s+|endmodule)','cnW') > l:numProcEnd + \&& search('\v\c^\s*(((local|task)\s+)?(proc|func|trap)\s+|endmodule)','cnW') > l:numProcEnd \&& search('\v\c^\s*end(proc|func|trap)>','bcnW') < l:numProcStart " " search FOR loop local auto declaration @@ -514,7 +514,7 @@ if !exists("*s:KnopVerboseEcho()") let l:numFoundLine = line(".") let l:numFoundCol = col(".") " rule out proc local declarations - if search('\v\c^\s*((local|global|task)\s+)?(end)?(proc|func|trap|record|module)>','W') && + if search('\v\c^\s*((local|task)\s+)?(end)?(proc|func|trap|record|module)>','W') && \( expand("") !~ '\c\v^\s*end(proc|func|trap|record)>' \|| expand("") =~ '\c\v^\s*endmodule>' \) @@ -528,7 +528,7 @@ if !exists("*s:KnopVerboseEcho()") " search Module local proc (et al) declaration call s:KnopVerboseEcho("search Module local proc (et al) declaration") let l:numEndmodule=s:RapidPutCursorOnModuleAndReturnEndmoduleline() - if search('\v\c^\s*((local|global|task)\s+)?(proc|func\s+\w+|trap|record)\s+\zs'.a:currentWord.'>','cW',l:numEndmodule) + if search('\v\c^\s*((local|task)\s+)?(proc|func\s+\w+|trap|record)\s+\zs'.a:currentWord.'>','cW',l:numEndmodule) call s:KnopVerboseEcho("Found declaration of PROC, FUNC, TRAP or RECORD in this MODULE",1) return 0 " @@ -543,7 +543,7 @@ if !exists("*s:KnopVerboseEcho()") " " first fill location list with all (end)?(proc|func|trap|record) and variable " declarations with currentWord - let l:prefix = '/\c\v^\s*(local\s+|task\s+|global\s+)?((var|pers|const)\s+\w+\s+' + let l:prefix = '/\c\v^\s*(local\s+|task\s+)?((var|pers|const)\s+\w+\s+' let l:suffix = '>|(end)?(proc|func|trap|record)>)/j' " since this finds all (not only global) ends, the previous must also list local if l:i =~ 'task' if has("win32") @@ -573,9 +573,9 @@ if !exists("*s:KnopVerboseEcho()") " search for global proc in loclist call s:KnopVerboseEcho("search for global proc in loclist") if l:i =~ 'task' - let l:procdecl = '\v\c^\s*(task\s+|global\s+)?(proc|func\s+\w+|trap|record)\s+' + let l:procdecl = '\v\c^\s*(task\s+)?(proc|func\s+\w+|trap|record)\s+' elseif l:i =~ 'system' - let l:procdecl = '\v\c^\s*(global\s+)?(proc|func\s+\w+|trap|record)\s+' + let l:procdecl = '\v\c^\s*(proc|func\s+\w+|trap|record)\s+' endif let l:loclist = getloclist(0) let l:qf = [] @@ -597,7 +597,7 @@ if !exists("*s:KnopVerboseEcho()") " " then search for global variable in loc list call s:KnopVerboseEcho("search for global variable in loc list") - let l:procdecl = '\v\c^\s*(local\s+|task\s+|global\s+)?(proc|func\s+\w+|trap|record)\s+' " procdecl must also contain local, since all ends are present + let l:procdecl = '\v\c^\s*(local\s+|task\s+)?(proc|func\s+\w+|trap|record)\s+' " procdecl must also contain local, since all ends are present let l:endproc = '\v\c^\s*end(proc|func|trap|record)>' let l:skip = 0 if l:i =~ 'task' @@ -681,7 +681,7 @@ if !exists("*s:KnopVerboseEcho()") autocmd CursorMoved * call RapidCleanBufferList() augroup END " - let l:declPrefix = '\c\v^\s*(local\s+|task\s+|global\s+)?(var|pers|const|alias)\s+\w+\s+' + let l:declPrefix = '\c\v^\s*(local\s+|task\s+)?(var|pers|const|alias)\s+\w+\s+' " " suche das naechste wort if search('\w','cW',line(".")) @@ -1008,7 +1008,7 @@ if !exists("*s:KnopVerboseEcho()") autocmd CursorMoved * call RapidCleanBufferList() augroup END " list defs in qf - if s:KnopSearchPathForPatternNTimes('\v\c^\s*(global\s+|task\s+|local\s+)?(proc|func|trap|record|module)>','%','','rapid')==0 + if s:KnopSearchPathForPatternNTimes('\v\c^\s*(task\s+|local\s+)?(proc|func|trap|record|module)>','%','','rapid')==0 if getqflist()==[] | return | endif " put cursor back after manipulating qf if getbufvar('%', "&buftype")!="quickfix" @@ -1017,7 +1017,7 @@ if !exists("*s:KnopVerboseEcho()") endif if getbufvar('%', "&buftype")!="quickfix" | return | endif setlocal modifiable - silent %substitute/\v\c^.*\|\s*((global\s+|task\s+|local\s+)?(proc|func|trap|record|module)>)/\1/ + silent %substitute/\v\c^.*\|\s*((task\s+|local\s+)?(proc|func|trap|record|module)>)/\1/ 0 if !exists("g:rapidTmpFile") let g:rapidTmpFile=tempname() @@ -1321,7 +1321,7 @@ if exists("loaded_matchit") " depends on matchit (or matchup) \.'^\s*\[^!]\+\.*:^\s*\.*,' \.'^\s*\[^!]\+\.*:^\s*\.*,' \.'^\s*\.*:^\s*\.*:^\s*\.*:^\s*\.*,' - \.'^\s*\(global\s\+\|local\s\+\|task\s\+\)\?\<\(proc\|func\|trap\|record\)\>.*:\:\:^\s*\.*:\:\:^\s*\.*:^\s*\.*:^\s*\.*,' + \.'^\s*\(local\s\+\|task\s\+\)\?\<\(proc\|func\|trap\|record\)\>.*:\:\:^\s*\.*:\:\:^\s*\.*:^\s*\.*:^\s*\.*,' \.'^\s*\.*:^\s*\.*' let b:match_ignorecase = 1 " Rapid does ignore case endif @@ -1346,12 +1346,12 @@ if get(g:,'rapidMoveAroundKeyMap',1) onoremap [] :exe "normal! V"call search('^#\n\w\+:\n\n','besW') else " Move around functions - nnoremap [[ :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*(global\s+\|local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>', 'bs') unlet b:knopCount:normal! zt - onoremap [[ :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*(global\s+\|local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>.*\n\zs', 'bsW')unlet b:knopCount - xnoremap [[ :let b:knopCount=v:count1exe "normal! gv" call KnopNTimesSearch(b:knopCount, '\c\v^\s*(global\s+\|local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>', 'bsW') unlet b:knopCount - nnoremap ]] :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*(global\s+\|local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>', 's') unlet b:knopCount:normal! zt - onoremap ]] :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*(global\s+\|local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>', 'sW') unlet b:knopCount - xnoremap ]] :let b:knopCount=v:count1exe "normal! gv" call KnopNTimesSearch(b:knopCount, '\c\v^\s*(global\s+\|local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>.*\n', 'seWz')unlet b:knopCount + nnoremap [[ :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*(local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>', 'bs') unlet b:knopCount:normal! zt + onoremap [[ :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*(local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>.*\n\zs', 'bsW')unlet b:knopCount + xnoremap [[ :let b:knopCount=v:count1exe "normal! gv" call KnopNTimesSearch(b:knopCount, '\c\v^\s*(local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>', 'bsW') unlet b:knopCount + nnoremap ]] :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*(local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>', 's') unlet b:knopCount:normal! zt + onoremap ]] :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*(local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>', 'sW') unlet b:knopCount + xnoremap ]] :let b:knopCount=v:count1exe "normal! gv" call KnopNTimesSearch(b:knopCount, '\c\v^\s*(local\s+\|task\s+)?(proc\|func\|trap\|record\|module)>.*\n', 'seWz')unlet b:knopCount nnoremap [] :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*end(proc\|func\|trap\|record\|module)>', 'bs') unlet b:knopCount:normal! zb onoremap [] :let b:knopCount=v:count1 call KnopNTimesSearch(b:knopCount, '\c\v^\s*end(proc\|func\|trap\|record\|module)>\n^(.\|\n)', 'bseW') unlet b:knopCount xnoremap [] :let b:knopCount=v:count1exe "normal! gv" call KnopNTimesSearch(b:knopCount, '\c\v^\s*end(proc\|func\|trap\|record\|module)>', 'bsW') unlet b:knopCount From ce19fbef7e10453fd0f0b565fc8f34810fdfa39e Mon Sep 17 00:00:00 2001 From: Patrick Meiser-Knosowski Date: Tue, 22 Dec 2020 05:50:02 +0100 Subject: [PATCH 53/53] Feature: Allow umlauts in names --- ftplugin/rapid.vim | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ftplugin/rapid.vim b/ftplugin/rapid.vim index bd9fa59..e1a469d 100644 --- a/ftplugin/rapid.vim +++ b/ftplugin/rapid.vim @@ -490,7 +490,7 @@ if !exists("*s:KnopVerboseEcho()") call s:KnopVerboseEcho("search Proc/Func/Trap argument declaration") call cursor(l:numProcStart,1) let l:noneCloseParen = '([^)]|\n)*' - if search('\c\v^'.l:noneCloseParen.'\('.l:noneCloseParen.'\w(\s|\n)*\zs<'.a:currentWord.'>'.l:noneCloseParen.'\)','cW',line(".")) + if search('\c\v^'.l:noneCloseParen.'\('.l:noneCloseParen.'\k(\s|\n)*\zs<'.a:currentWord.'>'.l:noneCloseParen.'\)','cW',line(".")) call s:KnopVerboseEcho("Found VARIABLE declaration in ARGUMENT list",1) return 0 " @@ -528,7 +528,7 @@ if !exists("*s:KnopVerboseEcho()") " search Module local proc (et al) declaration call s:KnopVerboseEcho("search Module local proc (et al) declaration") let l:numEndmodule=s:RapidPutCursorOnModuleAndReturnEndmoduleline() - if search('\v\c^\s*((local|task)\s+)?(proc|func\s+\w+|trap|record)\s+\zs'.a:currentWord.'>','cW',l:numEndmodule) + if search('\v\c^\s*((local|task)\s+)?(proc|func\s+\k+|trap|record)\s+\zs'.a:currentWord.'>','cW',l:numEndmodule) call s:KnopVerboseEcho("Found declaration of PROC, FUNC, TRAP or RECORD in this MODULE",1) return 0 " @@ -543,7 +543,7 @@ if !exists("*s:KnopVerboseEcho()") " " first fill location list with all (end)?(proc|func|trap|record) and variable " declarations with currentWord - let l:prefix = '/\c\v^\s*(local\s+|task\s+)?((var|pers|const)\s+\w+\s+' + let l:prefix = '/\c\v^\s*(local\s+|task\s+)?((var|pers|const)\s+\k+\s+' let l:suffix = '>|(end)?(proc|func|trap|record)>)/j' " since this finds all (not only global) ends, the previous must also list local if l:i =~ 'task' if has("win32") @@ -573,9 +573,9 @@ if !exists("*s:KnopVerboseEcho()") " search for global proc in loclist call s:KnopVerboseEcho("search for global proc in loclist") if l:i =~ 'task' - let l:procdecl = '\v\c^\s*(task\s+)?(proc|func\s+\w+|trap|record)\s+' + let l:procdecl = '\v\c^\s*(task\s+)?(proc|func\s+\k+|trap|record)\s+' elseif l:i =~ 'system' - let l:procdecl = '\v\c^\s*(proc|func\s+\w+|trap|record)\s+' + let l:procdecl = '\v\c^\s*(proc|func\s+\k+|trap|record)\s+' endif let l:loclist = getloclist(0) let l:qf = [] @@ -597,7 +597,7 @@ if !exists("*s:KnopVerboseEcho()") " " then search for global variable in loc list call s:KnopVerboseEcho("search for global variable in loc list") - let l:procdecl = '\v\c^\s*(local\s+|task\s+)?(proc|func\s+\w+|trap|record)\s+' " procdecl must also contain local, since all ends are present + let l:procdecl = '\v\c^\s*(local\s+|task\s+)?(proc|func\s+\k+|trap|record)\s+' " procdecl must also contain local, since all ends are present let l:endproc = '\v\c^\s*end(proc|func|trap|record)>' let l:skip = 0 if l:i =~ 'task' @@ -681,10 +681,10 @@ if !exists("*s:KnopVerboseEcho()") autocmd CursorMoved * call RapidCleanBufferList() augroup END " - let l:declPrefix = '\c\v^\s*(local\s+|task\s+)?(var|pers|const|alias)\s+\w+\s+' + let l:declPrefix = '\c\v^\s*(local\s+|task\s+)?(var|pers|const|alias)\s+\k+\s+' " " suche das naechste wort - if search('\w','cW',line(".")) + if search('\k','cW',line(".")) " let l:currentWord = s:RapidCurrentWordIs() " @@ -765,13 +765,13 @@ if !exists("*s:KnopVerboseEcho()") endfunction " s:RapidGetType() function s:RapidGetName() abort - let l:sName = substitute(input("\nName?\n Type for word under cursor.\n> "),'[^ 0-9a-zA-Z_]*','','g') + let l:sName = substitute(input("\nName?\n Type for word under cursor.\n> "),'[^ _0-9[:upper:][:lower:]]*','','g') if l:sName=="" return '' elseif l:sName=~'^ $' " sName from current word let l:sName = expand("") endif - let l:sName = substitute(l:sName,'\W*','','g') + let l:sName = substitute(l:sName,'[^_0-9[:upper:][:lower:]]*','','g') return l:sName endfunction " s:RapidGetName() @@ -781,7 +781,7 @@ if !exists("*s:KnopVerboseEcho()") else let l:sDataType = substitute(input("\nData type? \n \Choose [b]ool, [n]um, [d]num, [s]ring, [p]ose, [r]obtarget, [j]ointtarget, [t]ooldata, [w]objdata,\n - \ or enter your desired data type\n> "),'[^ 0-9a-zA-Z_{}]*','','g') + \ or enter your desired data type\n> "),'[^ _0-9[:upper:][:lower:],{}]*','','g') endif if l:sDataType=~'\c^b$' return "bool" @@ -1046,7 +1046,7 @@ if !exists("*s:KnopVerboseEcho()") autocmd CursorMoved * call RapidCleanBufferList() augroup END " - if search('\w','cW',line(".")) + if search('\k','cW',line(".")) let l:currentWord = s:RapidCurrentWordIs() " if l:currentWord =~ '^userdefined.*'