vim/gen_conceal.awk

27 lines
468 B
Awk
Raw Normal View History

2022-07-17 14:08:06 -07:00
#!/usr/bin/awk -f
BEGIN {
c = "\""
2022-08-03 10:51:34 -07:00
2022-07-17 14:08:06 -07:00
print c " Conceal character file generated by awk."
print c " Do not edit this manually."
}
{
# Ignore all whitespace
gsub("\\s", "", $0)
2022-08-03 10:51:34 -07:00
2022-07-17 14:08:06 -07:00
# 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)
2022-08-03 10:51:34 -07:00
string = substr($0,p+1)
2022-07-17 14:08:06 -07:00
# Vim config output
2022-08-03 10:51:34 -07:00
print ":syntax match keyword \"\\<" string "\\>\" conceal cchar=" conceal
2022-07-17 14:08:06 -07:00
2022-08-03 10:51:34 -07:00
}