From 9024799d0f85af1da73b2385cee70946bb991ded Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 17 Jul 2022 14:08:06 -0700 Subject: [PATCH] Added conceal generator --- .gitignore | 1 + conceal_defs | 131 ++++++++++++++++++++++++++++++++++++++++++++++++ gen_conceal.awk | 28 +++++++++++ vimrc | 6 +++ 4 files changed, 166 insertions(+) create mode 100644 conceal_defs create mode 100755 gen_conceal.awk diff --git a/.gitignore b/.gitignore index a0e76af..ba5e070 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .netrwhist +conceal.vim diff --git a/conceal_defs b/conceal_defs new file mode 100644 index 0000000..80c9741 --- /dev/null +++ b/conceal_defs @@ -0,0 +1,131 @@ +# Define strings to conceal here. +# Format is `char | string`, where +# `char` is the character that will replace `string`. +# +# `char` MUST be a SINGLE character. +# All whitespace is ignored. +# +# To generate vim file, do `./gen_conceal.awk this_file` + +# Greek letters +Α | Alpha +α | alpha +Β | Beta +β | beta +Γ | Gamma +γ | gamma +Δ | Delta +δ | delta +Ε | Epsilon +ε | epsilon +Ζ | Zeta +ζ | zeta +Η | Eta +η | eta +Θ | Theta +θ | theta +Ι | Iota +ι | iota +Κ | Kappa +κ | kapa +Λ | Lambda +λ | lambda +Μ | Mu +μ | mu +Ν | Nu +ν | nu +Ξ | Xi +ξ | xi +Ο | Omicron +ο | omicron +Π | Pi +π | pi +Ρ | Rho +ρ | rho +Σ | Sigma +σ | sigma +Τ | Tau +τ | tau +Υ | Upsilon +υ | upsilon +Φ | Phi +φ | phi +Χ | Xi +χ | xi +Ψ | Psi +ψ | psi +Ω | Omega +ω | omega + +# Blackboard Bold +𝔸 | _bbA +𝕒 | _bba +𝔹 | _bbB +𝕓 | _bbb +ℂ | _bbC +𝕔 | _bbc +𝔻 | _bbD +𝕕 | _bbd +𝔼 | _bbE +𝕖 | _bbe +𝔽 | _bbF +𝕗 | _bbf +𝔾 | _bbG +𝕘 | _bbg +ℍ | _bbH +𝕙 | _bbh +𝕀 | _bbI +𝕚 | _bbi +𝕁 | _bbJ +𝕛 | _bbj +𝕂 | _bbK +𝕜 | _bbk +𝕃 | _bbL +𝕝 | _bbl +𝕄 | _bbM +𝕞 | _bbm +ℕ | _bbN +𝕟 | _bbn +𝕆 | _bbO +𝕠 | _bbo +ℙ | _bbP +𝕡 | _bbp +ℚ | _bbQ +𝕢 | _bbq +ℝ | _bbR +𝕣 | _bbr +𝕊 | _bbS +𝕤 | _bbs +𝕋 | _bbT +𝕥 | _bbt +𝕌 | _bbU +𝕦 | _bbu +𝕍 | _bbV +𝕧 | _bbv +𝕎 | _bbW +𝕨 | _bbw +𝕏 | _bbX +𝕩 | _bbx +𝕐 | _bbY +𝕪 | _bby +ℤ | _bbZ +𝕫 | _bbz +𝟘 | _bb0 +𝟙 | _bb1 +𝟚 | _bb2 +𝟛 | _bb3 +𝟜 | _bb4 +𝟝 | _bb5 +𝟞 | _bb6 +𝟟 | _bb7 +𝟠 | _bb8 +𝟡 | _bb9 + +# Math symbols +∈ | _in +∉ | _notin +∀ | _forall +∃ | _exists +⇒ | _implies +⇔ | _iff +∞ | _inf diff --git a/gen_conceal.awk b/gen_conceal.awk new file mode 100755 index 0000000..ed5ca55 --- /dev/null +++ b/gen_conceal.awk @@ -0,0 +1,28 @@ +#!/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) + keyword = substr($0,p+1) + + # Vim config output + print ":syntax match keyword \"\\<" keyword "\\>\" conceal cchar=" conceal + +} + diff --git a/vimrc b/vimrc index 643b9b4..3655ac6 100644 --- a/vimrc +++ b/vimrc @@ -259,3 +259,9 @@ augroup pencil autocmd FileType text call pencil#init() autocmd FileType text setlocal list augroup END + + +" Configure and load conceal chars +:set conceallevel=2 +highlight Conceal ctermbg=NONE ctermfg=green guibg=NONE guifg=NONE +source ~/.vim/conceal.vim