-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexamples.kak
58 lines (51 loc) · 1.38 KB
/
examples.kak
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Examples
# --------
define-command example-expansions %{
echo %opt{tabstop} %{ %opt{tabstop} } "%opt{tabstop}" '%opt{tabstop}' %{ "%opt{tabstop}" } %{ '%opt{tabstop}' } "%{%opt{tabstop}}" '%{%opt{tabstop}}'
}
define-command example-if-for-kakrc %{
if "-f kakrc" %{
echo '`kakrc` exists in current directory'
} %{
echo '`kakrc` does not exist in current directory'
}
}
declare-option str colorscheme_mode 'light'
define-command example-switch-colorscheme \
-docstring 'switch colorscheme between light and dark modes' %{
if "%opt{colorscheme_mode} = light" %{
colorscheme solarized-dark-termcolors
set-option current colorscheme_mode 'dark'
} %{
colorscheme solarized-light-termcolors
set-option current colorscheme_mode 'light'
}
}
define-command example-if-for-git %{
if-available "git" %{
echo '`git` is available'
} %{
echo '`git` is not available'
}
}
declare-option int example_number 0
define-command example-if-for-number %{
if "%opt{example_number} -lt 0" %{
echo 'negative number'
} %{if "%opt{example_number} -gt 0" %{
echo 'positive number'
} %{
echo 'number equals zero'
}
}
}
define-command example-case-for-number %{
case-3 %opt{example_number} \
"0" %{
echo 'number equals zero'
} "-*" %{
echo 'negative number'
} "*" %{
echo 'positive number'
}
}