Merge branch 'colorscheme'

This commit is contained in:
Maxime Coste 2015-07-07 22:41:00 +01:00
commit bb01b79c78
5 changed files with 72 additions and 1 deletions

View File

@ -488,6 +488,7 @@ Basic Commands
* `source <filename>`: execute commands in <filename> * `source <filename>`: execute commands in <filename>
* `runtime <filename>`: execute commands in <filename>, <filename> * `runtime <filename>`: execute commands in <filename>, <filename>
is relative to kak executable path. is relative to kak executable path.
* `colorscheme <name>`: load named colorscheme.
* `nameclient <name>`: set current client name * `nameclient <name>`: set current client name
* `namebuf <name>`: set current buffer name * `namebuf <name>`: set current buffer name
* `echo <text>`: show <text> in status line * `echo <text>`: show <text> in status line

52
colors/zenburn.kak Normal file
View File

@ -0,0 +1,52 @@
# zenburn theme
# first we define the zenburn colors as faces
face zenbackground default,rgb:3f3f3f
face zenstatus rgb:efdcbc,rgb:2a2a2a
face zeninfo rgb:cc9393,rgb:2a2a2a
face zenmenubg rgb:7f9f7f,rgb:4a4a4a
face zenmenufg rgb:8cd0d3,rgb:4a4a4a
face zentext rgb:efefef
face zenkeyword rgb:f0dfaf+b
face zenstorageClass rgb:c3bf9f+b
face zennumber rgb:8cd0d3
face zencomment rgb:7f9f7f
face zenconstant rgb:dca3a3+b
face zenspecial rgb:cfbfaf
face zenfunction rgb:efef8f
face zenstatement rgb:e3ceab
face zenidentifier rgb:efdcbc
face zentype rgb:dfdfbf
face zenstring rgb:cc9393
face zenexception rgb:c3bf9f+b
face zenmatching rgb:3f3f3f,rgb:8cd0d3
# then we map them to code
face value zenconstant
face type zentype
face identifier zenidentifier
face string zenstring
face error zenexception
face keyword zenkeyword
face operator zenfunction
face attribute zenstatement
face comment zencomment
face meta zenspecial
# and markup
face title zenkeyword
face header zenconstant
face bold zenstorageClass
face italic zenfunction
face mono zennumber
face block zenstatement
face link zenstring
face bullet zenidentifier
face list zentype
# and built in faces
face Default zenbackground
face StatusLine zenstatus
face Information zeninfo
face MenuBackground zenmenubg
face MenuForeground zenmenufg

View File

@ -8,7 +8,7 @@ addhl -group / regions -default code kakrc \
single_string %{(^|\h)'} %{(?<!\\)(\\\\)*'} '' \ single_string %{(^|\h)'} %{(?<!\\)(\\\\)*'} '' \
shell '%sh\{' '\}' '\{' shell '%sh\{' '\}' '\{'
addhl -group /kakrc/code regex \<(hook|rmhooks|addhl|rmhl|exec|eval|source|runtime|def|alias|unalias|decl|echo|edit|set|map|face|prompt|menu|info|try|catch|nameclient|namebuf|cd)\> 0:keyword addhl -group /kakrc/code regex \<(hook|rmhooks|addhl|rmhl|exec|eval|source|runtime|def|alias|unalias|decl|echo|edit|set|map|face|prompt|menu|info|try|catch|nameclient|namebuf|cd|colorscheme)\> 0:keyword
addhl -group /kakrc/code regex \<(default|black|red|green|yellow|blue|magenta|cyan|white|(?:rgb:[0-9a-fA-F]{6}))\> 0:value addhl -group /kakrc/code regex \<(default|black|red|green|yellow|blue|magenta|cyan|white|(?:rgb:[0-9a-fA-F]{6}))\> 0:value
addhl -group /kakrc/code regex (?:\<hook)\h+(?:(global|buffer|window)|(\S+))\h+(\S+)\h+(\S+)? 1:attribute 2:error 3:identifier 4:string addhl -group /kakrc/code regex (?:\<hook)\h+(?:(global|buffer|window)|(\S+))\h+(\S+)\h+(\S+)? 1:attribute 2:error 3:identifier 4:string
addhl -group /kakrc/code regex (?:\<set)\h+(?:(global|buffer|window)|(\S+))\h+(\S+)\h+(\S+)? 1:attribute 2:error 3:identifier 4:string addhl -group /kakrc/code regex (?:\<set)\h+(?:(global|buffer|window)|(\S+))\h+(\S+)\h+(\S+)? 1:attribute 2:error 3:identifier 4:string

1
share/kak/colors Symbolic link
View File

@ -0,0 +1 @@
../../colors

View File

@ -30,6 +30,23 @@ def -shell-params runtime %{ %sh{
done done
}} }}
def -shell-params -docstring "colorscheme <name>: enable named colorscheme" \
-shell-completion %{
prefix=${1:0:${kak_pos_in_token}}
(
for col in ${kak_runtime}/colors/*.kak; do
expr $(basename "${col}" .kak) : "^\(${prefix}.*\)$"
done
) | grep -v '^$'
} \
colorscheme %{ %sh{
if [ $# -eq 1 ]; then
echo "source '${kak_runtime}/colors/$1.kak'"
else
echo -color Error 'Usage: colorscheme <scheme name>'
fi
}}
%sh{ %sh{
autoload() { autoload() {
dir=$1 dir=$1