From bb16be6cf23b470ea01670d3de78531039b9d0a4 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 6 Oct 2015 23:22:36 +0100 Subject: [PATCH] clang.kak: Try to detect word boundaries and highlight types/operators --- rc/clang.kak | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rc/clang.kak b/rc/clang.kak index 1b14b80f..c48a4612 100644 --- a/rc/clang.kak +++ b/rc/clang.kak @@ -61,7 +61,9 @@ def -shell-params clang-parse -docstring "Parse the contents of the current buff for (id in docstrings) { menu=id - gsub(/(operator|new|delete)/, "{keyword}&{}", menu) + gsub(/(^|[^[:alnum:]_])(operator|new|delete)($|[^[:alnum:]_])/, "{keyword}&{}", menu) + gsub(/(^|[[:space:]])(int|size_t|bool|char|unsigned|signed|long)($|[[:space:]])/, "{type}&{}", menu) + gsub(/[^[:alnum:]{}_]+/, "{operator}&{}", menu) print id "@" docstrings[id] "@" menu } }' | sort | paste -s -d ':' | sed -e "s/\\\\n/\\n/g; s/'/\\\\'/g")