summaryrefslogtreecommitdiff
path: root/vim/.vim
diff options
context:
space:
mode:
authorUrbain Vaes <urbain@vaes.uk>2020-04-07 12:18:21 +0200
committerUrbain Vaes <urbain@vaes.uk>2020-04-07 12:18:21 +0200
commitaf174aee615ad634cd457ee1c842d4aa89f3a59c (patch)
tree7d0688fb1b18f3d4d453b0e01a9d97e048ffae37 /vim/.vim
parent72c51052ac3b9bd9275b3710f543fe5da4ecbeca (diff)
Improve vim syntax for colors
Diffstat (limited to 'vim/.vim')
-rw-r--r--vim/.vim/after/syntax/vim.vim25
1 files changed, 25 insertions, 0 deletions
diff --git a/vim/.vim/after/syntax/vim.vim b/vim/.vim/after/syntax/vim.vim
new file mode 100644
index 0000000..f6b389e
--- /dev/null
+++ b/vim/.vim/after/syntax/vim.vim
@@ -0,0 +1,25 @@
+" Modification of default rule: vimHiCtermFg,vimHiCtermBg instead of vimHiCtermFgBg
+syntax cluster vimHiCluster remove=vimHiCtermFgBg
+syntax cluster vimHiCluster add=vimHiCtermFg,vimHiCtermBg
+
+" Modification of default rule: @vimHiNmbrFgCluster,@vimHiNmbrBgCluster instead of vimHiNmbr
+syntax match vimHiCtermFg /\cctermfg=/ contained nextgroup=@vimHiNmbrFgCluster,vimHiCtermColor,vimFgBgAttrib,vimHiCtermError
+syntax match vimHiCtermBg /\cctermbg=/ contained nextgroup=@vimHiNmbrBgCluster,vimHiCtermColor,vimFgBgAttrib,vimHiCtermError
+
+" Assemble syntax groups
+let syntax_groups_fg = "vimHiNmbrFg1"
+let syntax_groups_bg = "vimHiNmbrBg1"
+for i in range(2, 255)
+ let syntax_groups_fg = syntax_groups_fg.",vimHiNmbrFg".i
+ let syntax_groups_bg = syntax_groups_bg.",vimHiNmbrBg".i
+endfor
+
+exe "syntax cluster vimHiNmbrFgCluster contains=".syntax_groups_fg
+exe "syntax cluster vimHiNmbrBgCluster contains=".syntax_groups_bg
+
+for i in range(1, 255)
+ exe "syntax match vimHiNmbrFg".i." /".i."/ contained"
+ exe "syntax match vimHiNmbrBg".i." /".i."/ contained"
+ exe "highlight vimHiNmbrFg".i." ctermfg=".i
+ exe "highlight vimHiNmbrBg".i." ctermfg=black ctermbg=".i
+endfor