vim/gen_conceal.awk

27 lines
468 B
Awk
Executable File

#!/usr/bin/awk -f
BEGIN {
c = "\""
print c " Conceal character file generated by awk."
print c " Do not edit this manually."
}
{
# Ignore all whitespace
gsub("\\s", "", $0)
# Skip comments
if (substr($0,0,1) == "#") { next }
# Skip blank lines
if (NF <= 0) { next }
# Extract args
p = index($0, "|")
conceal = substr($0,0,p-1)
string = substr($0,p+1)
# Vim config output
print ":syntax match keyword \"\\<" string "\\>\" conceal cchar=" conceal
}