commit b7a9d892c4140836e77b0bfefb12729365f11060
parent 7784171fa2daf2728889912b2395950efd68cdb5
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Thu, 8 Oct 2020 15:25:28 +0200
Add support for specifying ANSI colors for :terminal
Diffstat:
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
@@ -74,6 +74,12 @@ link statusline,statuslinenc normal
In my opinion, much more readable and writable than Vimscript.
+You can also set `g:terminal_ansi_colors` with the `ansi:` keyword:
+
+```schemer
+ansi: #eff0f3, #125394, #145a9c, #1562c0, #2182e1, #2377e1, #3c68e6, #0a0c0f, #525963, #125394, #145a9c, #1562c0, #2182e1, #2377e1, #3c68e6, #0a0c0f
+```
+
## Other alternatives
There are a few alternative colorscheme generators.
I took a look at [RNB](https://github.com/romainl/vim-rnb), but it didn't feel right for me, for a few reasons.
diff --git a/autoload/schemer.vim b/autoload/schemer.vim
@@ -2574,6 +2574,7 @@ function! Schemer#ProcessFile(file) abort
let nlines = len(lines)
let colornames = {}
+ let ansis = []
let cursor = 0
@@ -2598,6 +2599,8 @@ function! Schemer#ProcessFile(file) abort
break
endif
endwhile
+ elseif line =~ "^ansi:"
+ let ansis = split(line)[1:]->map({key, val -> (val->substitute(",", "", "")->trim())})
elseif line =~ "^link"
let splitline = line->split()
let from = splitline[1]->trim()
@@ -2651,6 +2654,9 @@ function! Schemer#ProcessFile(file) abort
call add(outlines, "endif")
call add(outlines, "let g:colors_name = \"".(a:file->substitute(".*/", "", "")->substitute("\.schemer", "", ""))."\"")
+ call add(outlines, "\"ANSI colors for :terminal")
+ call add(outlines, "let g:terminal_ansi_colors = [".ansis->map("'\"'.v:val.'\"'")->join(', ')."]")
+
call add(outlines, "\" Highlight group definitions")
for item in primary
let itemline = "hi ".item[0]." guifg=".item[1]." guibg=".item[2]
diff --git a/syntax/schemer.vim b/syntax/schemer.vim
@@ -10,7 +10,7 @@ set cpo&vim
syntax clear
" Define highlighting groups
-syntax keyword schemerKeyword background light dark
+syntax keyword schemerKeyword background light dark ansi
syntax keyword schemerNone NONE
syntax keyword schemerAttrs italic bold inverse underline undercurl strikethrough reverse standout
syntax match schemerGroup "^[A-Z][^ ]*"