-
Notifications
You must be signed in to change notification settings - Fork 11
/
rc.elv
226 lines (167 loc) · 5.62 KB
/
rc.elv
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# DO NOT EDIT THIS FILE DIRECTLY
# This is a file generated from a literate programing source file located at
# https://gitlab.com/zzamboni/dot-elvish/-/blob/master/rc.org
# You should make any changes there and regenerate it from Emacs org-mode using C-c C-v t
use re
use readline-binding
use path
use str
use math
# Where all the Go stuff is
if (path:is-dir ~/Dropbox/Personal/devel/go) {
set E:GOPATH = ~/Dropbox/Personal/devel/go
} else {
set E:GOPATH = ~/go
}
# Optional paths, add only those that exist
var optpaths = [
~/.emacs.d/bin
/usr/local/opt/coreutils/libexec/gnubin
/usr/local/opt/texinfo/bin
/usr/local/opt/python/libexec/bin
/usr/local/go/bin
~/Work/automated-security-helper
~/.toolbox/bin
]
var optpaths-filtered = [(each {|p|
if (path:is-dir $p) { put $p }
} $optpaths)]
set paths = [
~/bin
$E:GOPATH/bin
$@optpaths-filtered
/usr/local/bin
/usr/local/sbin
/usr/sbin
/sbin
/usr/bin
/bin
]
set E:GONOPROXY = "*"
each {|p|
if (not (path:is-dir &follow-symlink $p)) {
echo (styled "Warning: directory "$p" in $paths no longer exists." red)
}
} $paths
use epm
epm:install &silent-if-installed ^
github.com/zzamboni/elvish-modules ^
github.com/zzamboni/elvish-completions ^
github.com/xiaq/edit.elv ^
github.com/muesli/elvish-libs ^
github.com/iwoloschin/elvish-packages
use github.com/zzamboni/elvish-modules/proxy
set proxy:host = "http://aproxy.corproot.net:8080"
set proxy:test = {
and ?(test -f /etc/resolv.conf) ^
?(egrep -q '^(search|domain).*(corproot.net|swissptt.ch)' /etc/resolv.conf)
}
proxy:autoset
set edit:insert:binding[Alt-Backspace] = $edit:kill-small-word-left~
set edit:insert:binding[Alt-d] = $edit:kill-small-word-right~
set edit:insert:binding[Alt-m] = $edit:-instant:start~
set edit:max-height = 20
use github.com/zzamboni/elvish-modules/1pass
1pass:read-aliases
use github.com/zzamboni/elvish-modules/lazy-vars
set E:USER_750WORDS = [email protected]
lazy-vars:add-var PASS_750WORDS { 1pass:get-password "750words.com" }
lazy-vars:add-alias 750words-client.py [ PASS_750WORDS ]
use github.com/zzamboni/elvish-modules/alias
fn have-external { |prog|
put ?(which $prog >/dev/null 2>&1)
}
fn only-when-external { |prog lambda|
if (have-external $prog) { $lambda }
}
only-when-external dfc {
alias:new dfc e:dfc -p -/dev/disk1s4,devfs,map,com.apple.TimeMachine
}
only-when-external vagrant {
alias:new v vagrant
}
only-when-external hub {
alias:new git hub
}
only-when-external bat {
alias:new cat bat
alias:new more bat --paging always
set E:MANPAGER = "sh -c 'col -bx | bat -l man -p'"
}
fn manpdf {|@cmds|
each {|c|
man -t $c | open -f -a /System/Applications/Preview.app
} $cmds
}
use github.com/xiaq/edit.elv/smart-matcher
smart-matcher:apply
# Enable the universal command completer if available.
# See https://github.com/rsteube/carapace-bin
if (has-external carapace) {
eval (carapace _carapace | slurp)
}
use github.com/zzamboni/elvish-completions/ssh
# eval (starship init elvish | sed 's/except/catch/')
# Temporary fix for use of except in the output of the Starship init code
eval (/usr/local/bin/starship init elvish --print-full-init | slurp)
set edit:prompt-stale-transform = {|x| styled $x "bright-black" }
set edit:-prompt-eagerness = 10
use github.com/zzamboni/elvish-modules/iterm2
iterm2:init
set edit:insert:binding[Ctrl-L] = $iterm2:clear-screen~
use github.com/zzamboni/elvish-modules/long-running-notifications
use github.com/zzamboni/elvish-modules/bang-bang
use github.com/zzamboni/elvish-modules/dir
alias:new cd &use=[github.com/zzamboni/elvish-modules/dir] dir:cd
alias:new cdb &use=[github.com/zzamboni/elvish-modules/dir] dir:cdb
set edit:insert:binding[Alt-i] = $dir:history-chooser~
set edit:insert:binding[Alt-b] = $dir:left-small-word-or-prev-dir~
set edit:insert:binding[Alt-f] = $dir:right-small-word-or-next-dir~
set edit:insert:binding[Ctrl-R] = {
edit:histlist:start
edit:histlist:toggle-case-sensitivity
}
only-when-external eza {
var eza-ls~ = { |@_args|
use github.com/zzamboni/elvish-modules/util
e:eza --color-scale --git --group-directories-first (each {|o|
util:cond [
{ eq $o "-lrt" } "-lsnew"
{ eq $o "-lrta" } "-alsnew"
:else $o
]
} $_args)
}
edit:add-var ls~ $eza-ls~
}
use github.com/zzamboni/elvish-modules/terminal-title
var private-loaded = ?(use private)
use github.com/zzamboni/elvish-modules/atlas
use github.com/zzamboni/elvish-modules/opsgenie
use github.com/zzamboni/elvish-modules/leanpub
set leanpub:api-key-fn = { 1pass:get-item leanpub &fields=["API key"] }
use github.com/zzamboni/elvish-modules/tinytex
only-when-external pyenv {
set paths = [ ~/.pyenv/shims $@paths ]
set-env PYENV_SHELL elvish
}
set E:LESS = "-i -R"
set E:EDITOR = "vim"
set E:LC_ALL = "en_US.UTF-8"
set E:PKG_CONFIG_PATH = "/usr/local/opt/icu4c/lib/pkgconfig"
use github.com/zzamboni/elvish-modules/git-summary gs
set gs:stop-gitstatusd-after-use = $true
var git-summary-repos-to-exclude = ['.emacs.d*' .cargo Library/Caches Dropbox/Personal/devel/go/src]
var git-summary-fd-exclude-opts = [(each {|d| put -E $d } $git-summary-repos-to-exclude)]
set gs:find-all-user-repos-fn = {
fd -H -I -t d $@git-summary-fd-exclude-opts '^.git$' ~ | each $path:dir~
}
use github.com/zzamboni/elvish-modules/util
use github.com/muesli/elvish-libs/git
use github.com/iwoloschin/elvish-packages/update
set update:curl-timeout = 3
update:check-commit &verbose
use github.com/zzamboni/elvish-modules/util-edit
util-edit:electric-delimiters
use github.com/zzamboni/elvish-modules/spinners
use github.com/zzamboni/elvish-modules/tty