forked from rafi/awesome-vim-colorschemes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreview.sh
executable file
·46 lines (35 loc) · 846 Bytes
/
preview.sh
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
#!/bin/sh
set -euo pipefail
#set -x
if [ $(basename $PWD) != 'awesome-vim-colorschemes' ]; then
echo >&2 'You must run me inside awesome-vim-colorschemes repo'
exit 1
fi
example=$(mktemp).cpp
trap "rm -f $example" EXIT
schemes=$(find colors -name \*.vim | xargs -n1 basename | sed 's/\.vim//g')
for s in $schemes; do
cat > $example <<EOF
// Colorscheme "$s".
// To stop iteration, add ABORT anywhere below and save file.
#include <stdio.h>
namespace XYZ {
static int x = 1;
struct A {
int x;
int y;
void a() const { return x + y; }
};
int main() {
A var;
printf("Hello world!\n");
return 0;
}
} // XYZ
EOF
vim +':syntax on' +":set runtimepath+=$PWD" +":colo $s" $example
if [ $(grep ABORT $example | grep -v 'add ABORT anywhere' | wc -l) -gt 0 ]; then
echo 'Aborting per user request...'
break
fi
done