#acronyms on
on *:START: loadacros
[color:red] [/color]
on *:INPUT:*:{
if /* !iswm $1 && !$ctrlenter && !$inpaste {
haltdef
msg $active $acronym($$1-)
}
}
#acronyms end
[color:red] [/color]
alias acronym {
var %a = $1, %b = 1
while $hfind(acros,$lower($1),%b,R) {
.echo -q $regsub(%a,/(?<=^|\s) $+ $v1 $+ (?=\s|$)/gi,$hget(acros,$v1),%a)
inc %b
}
return %a
}
[color:red] [/color]
alias addacro {
if !$2 { echo -a You have to specify a translation for the item: $1 | return }
if !$hget(acros) { loadacros }
if $hget(acros,$1) { hdel acros $1 }
hadd acros $1 $2-
hsave -oi acros acros.txt
echo -a Added acronym: $1 with translation: $2-
}
[color:red] [/color]
alias delacro {
if !$1 { echo -a You must specify an acronym | return }
if !$hget(acros) { loadacros }
if !$hget(acros,$1) { echo -a There is no such acronym: $1 | return }
hdel acros $1
hsave -oi acros acros.txt
echo -a Deleted acronym: $1
}
[color:red] [/color]
alias loadacros {
if $hget(acros) { hfree acros }
hmake acros
hload -i acros acros.txt
}