-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.esrc
50 lines (44 loc) · 938 Bytes
/
.esrc
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
#!/usr/bin/env es
## Simple es configuration script
LANG=(en_US.UTF-8)
TERM=(xterm-256color)
path=(/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin $home^/bin $home^/bin/c)
## Make reloading the config easier
fn reload {
. $home^/.esrc
}
## Everything is vim
fn vim {
$editor $*
}
## Create a '++' pseudo-operator, mutates state internally
fn ++ i {
## The argument 'i' is meant to be a variable reference,
## used like so:
## ; x = 0
## ; ++ x
## ; echo $x
## 1
$i = <= {
$&sum $$i 1
}
}
## Creates simple equality checks, similar to '==' or the '=' 'eq?' forms in some lisp dialects
fn eq a b {
~ $a $b
}
## Modified form to accept variable references instead of values
fn veq a b {
~ $$a $$b
}
## Enable prettier printing of the current primitives
fn primitives {
local (pi = 1)
let (plist = <= {$&primitives}) {
echo Found $#plist primitives:
for (p = $plist) {
echo $pi: $p
++ pi
}
}
}