" The below is already set by textobj-function " SetUndoFtplugin unlet! b:textobj_function_select let b:textobj_function_select = function('vimrc#textobj_vimspec#select') def CommandAbbrev(command: string): string if getline('.')[: col('.') - 1]->trim() ==# command return toupper(command[0]) .. command[1 :] else return command endif enddef inoreabbrev describe CommandAbbrev('describe') inoreabbrev context CommandAbbrev('context') inoreabbrev before CommandAbbrev('before') inoreabbrev after CommandAbbrev('after') inoreabbrev it CommandAbbrev('it') inoreabbrev assert CommandAbbrev('assert') inoreabbrev throws CommandAbbrev('throws') inoreabbrev fail CommandAbbrev('fail') inoreabbrev skip CommandAbbrev('skip') def AssertCommandAbbrev(command: string, abbrev: string): string if getline('.')[: col('.') - 1] =~? '\v^\s*Assert\s+' .. command .. '$' return abbrev else return command endif enddef inoreabbrev true AssertCommandAbbrev('true', 'True') inoreabbrev false AssertCommandAbbrev('false', 'False') inoreabbrev truthy AssertCommandAbbrev('truthy', 'Truthy') inoreabbrev falsy AssertCommandAbbrev('falsy', 'Falsy') inoreabbrev compare AssertCommandAbbrev('compare', 'Compare') inoreabbrev equals AssertCommandAbbrev('equals', 'Equals') inoreabbrev notequals AssertCommandAbbrev('notequals', 'NotEquals') inoreabbrev same AssertCommandAbbrev('same', 'Same') inoreabbrev notsame AssertCommandAbbrev('notsame', 'NotSame') inoreabbrev match AssertCommandAbbrev('match', 'Match') inoreabbrev notmatch AssertCommandAbbrev('notmatch', 'NotMatch') inoreabbrev isnumber AssertCommandAbbrev('isnumber', 'IsNumber') inoreabbrev isnotnumber AssertCommandAbbrev('isnotnumber', 'IsNotNumber') inoreabbrev isstring AssertCommandAbbrev('isstring', 'IsString') inoreabbrev isnotstring AssertCommandAbbrev('isnotstring', 'IsNotString') inoreabbrev isfunction AssertCommandAbbrev('isfunction', 'IsFunction') inoreabbrev isnotfunction AssertCommandAbbrev('isnotfunction', 'IsNotFunction') inoreabbrev islist AssertCommandAbbrev('islist', 'IsList') inoreabbrev isnotlist AssertCommandAbbrev('isnotlist', 'IsNotList') inoreabbrev isdictionary AssertCommandAbbrev('isdictionary', 'IsDictionary') inoreabbrev isnotdictionary AssertCommandAbbrev('isnotdictionary', 'IsNotDictionary') inoreabbrev isfloat AssertCommandAbbrev('isfloat', 'IsFloat') inoreabbrev isnotfloat AssertCommandAbbrev('isnotfloat', 'IsNotFloat') inoreabbrev isbool AssertCommandAbbrev('isbool', 'IsBool') inoreabbrev isnotbool AssertCommandAbbrev('isnotbool', 'IsNotBool') inoreabbrev isnone AssertCommandAbbrev('isnone', 'IsNone') inoreabbrev isnotnone AssertCommandAbbrev('isnotnone', 'IsNotNone') inoreabbrev isjob AssertCommandAbbrev('isjob', 'IsJob') inoreabbrev isnotjob AssertCommandAbbrev('isnotjob', 'IsNotJob') inoreabbrev ischannel AssertCommandAbbrev('ischannel', 'IsChannel') inoreabbrev isnotchannel AssertCommandAbbrev('isnotchannel', 'IsNotChannel') inoreabbrev typeof AssertCommandAbbrev('typeof', 'TypeOf') inoreabbrev lengthof AssertCommandAbbrev('lengthof', 'LengthOf') inoreabbrev keyexists AssertCommandAbbrev('keyexists', 'KeyExists') inoreabbrev keynotexists AssertCommandAbbrev('keynotexists', 'KeyNotExists') inoreabbrev haskey AssertCommandAbbrev('haskey', 'HasKey') inoreabbrev exists AssertCommandAbbrev('exists', 'Exists') inoreabbrev cmdexists AssertCommandAbbrev('cmdexists', 'CmdExists') inoreabbrev empty AssertCommandAbbrev('empty', 'Empty') inoreabbrev notempty AssertCommandAbbrev('notempty', 'NotEmpty') def ExpectCommandAbbrev(command: string, abbrev: string): string if getline('.')[: col('.') - 1] =~? '\v^\s*Expect\s+' .. abbrev .. '$' return abbrev else return command endif enddef inoreabbrev tobefalsy ExpectCommandAbbrev('tobefalsy', 'ToBeFalsy') inoreabbrev tobegreaterthan ExpectCommandAbbrev('tobegreaterthan', 'ToBeGreaterThan') inoreabbrev tobegreaterthanorequal ExpectCommandAbbrev('tobegreaterthanorequal', 'ToBeGreaterThanOrEqual') inoreabbrev tobelessthan ExpectCommandAbbrev('tobelessthan', 'ToBeLessThan') inoreabbrev tobelessthanorequal ExpectCommandAbbrev('tobelessthanorequal', 'ToBeLessThanOrEqual') inoreabbrev toequal ExpectCommandAbbrev('toequal', 'ToEqual') inoreabbrev tobesame ExpectCommandAbbrev('tobesame', 'ToBeSame') inoreabbrev tomatch ExpectCommandAbbrev('tomatch', 'ToMatch') inoreabbrev tobenumber ExpectCommandAbbrev('tobenumber', 'ToBeNumber') inoreabbrev tobestring ExpectCommandAbbrev('tobestring', 'ToBeString') inoreabbrev tobefunc ExpectCommandAbbrev('tobefunc', 'ToBeFunc') inoreabbrev tobelist ExpectCommandAbbrev('tobelist', 'ToBeList') inoreabbrev tobedict ExpectCommandAbbrev('tobedict', 'ToBeDict') inoreabbrev tobefloat ExpectCommandAbbrev('tobefloat', 'ToBeFloat') inoreabbrev toexist ExpectCommandAbbrev('toexist', 'ToExist') inoreabbrev tobeempty ExpectCommandAbbrev('tobeempty', 'ToBeEmpty') inoreabbrev tohavelength ExpectCommandAbbrev('tohavelength', 'ToHaveLength') inoreabbrev tohavekey ExpectCommandAbbrev('tohavekey', 'ToHaveKey')