質問編集履歴
1
oh-my-zshファイルの中身を追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -233,3 +233,265 @@
|
|
233
233
|
|
234
234
|
|
235
235
|
```
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
追記しました。
|
246
|
+
|
247
|
+
```
|
248
|
+
|
249
|
+
<oh-my-zsh.sh>の中身
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
# Set ZSH_CACHE_DIR to the path where cache files should be created
|
256
|
+
|
257
|
+
# or else we will use the default cache/
|
258
|
+
|
259
|
+
if [[ -z "$ZSH_CACHE_DIR" ]]; then
|
260
|
+
|
261
|
+
ZSH_CACHE_DIR="$ZSH/cache"
|
262
|
+
|
263
|
+
fi
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
# Migrate .zsh-update file to $ZSH_CACHE_DIR
|
268
|
+
|
269
|
+
if [ -f ~/.zsh-update ] && [ ! -f ${ZSH_CACHE_DIR}/.zsh-update ]; then
|
270
|
+
|
271
|
+
mv ~/.zsh-update ${ZSH_CACHE_DIR}/.zsh-update
|
272
|
+
|
273
|
+
fi
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
# Check for updates on initial load...
|
278
|
+
|
279
|
+
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
|
280
|
+
|
281
|
+
env ZSH=$ZSH ZSH_CACHE_DIR=$ZSH_CACHE_DIR DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
|
282
|
+
|
283
|
+
fi
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
# Initializes Oh My Zsh
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
# add a function path
|
292
|
+
|
293
|
+
fpath=($ZSH/functions $ZSH/completions $fpath)
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
# Load all stock functions (from $fpath files) called below.
|
298
|
+
|
299
|
+
autoload -U compaudit compinit
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
# Set ZSH_CUSTOM to the path where your custom config files
|
304
|
+
|
305
|
+
# and plugins exists, or else we will use the default custom/
|
306
|
+
|
307
|
+
if [[ -z "$ZSH_CUSTOM" ]]; then
|
308
|
+
|
309
|
+
ZSH_CUSTOM="$ZSH/custom"
|
310
|
+
|
311
|
+
fi
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
is_plugin() {
|
318
|
+
|
319
|
+
local base_dir=$1
|
320
|
+
|
321
|
+
local name=$2
|
322
|
+
|
323
|
+
test -f $base_dir/plugins/$name/$name.plugin.zsh \
|
324
|
+
|
325
|
+
|| test -f $base_dir/plugins/$name/_$name
|
326
|
+
|
327
|
+
}
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
# Add all defined plugins to fpath. This must be done
|
332
|
+
|
333
|
+
# before running compinit.
|
334
|
+
|
335
|
+
for plugin ($plugins); do
|
336
|
+
|
337
|
+
if is_plugin $ZSH_CUSTOM $plugin; then
|
338
|
+
|
339
|
+
fpath=($ZSH_CUSTOM/plugins/$plugin $fpath)
|
340
|
+
|
341
|
+
elif is_plugin $ZSH $plugin; then
|
342
|
+
|
343
|
+
fpath=($ZSH/plugins/$plugin $fpath)
|
344
|
+
|
345
|
+
else
|
346
|
+
|
347
|
+
echo "[oh-my-zsh] plugin '$plugin' not found"
|
348
|
+
|
349
|
+
fi
|
350
|
+
|
351
|
+
done
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
# Figure out the SHORT hostname
|
356
|
+
|
357
|
+
if [[ "$OSTYPE" = darwin* ]]; then
|
358
|
+
|
359
|
+
# macOS's $HOST changes with dhcp, etc. Use ComputerName if possible.
|
360
|
+
|
361
|
+
SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/}
|
362
|
+
|
363
|
+
else
|
364
|
+
|
365
|
+
SHORT_HOST=${HOST/.*/}
|
366
|
+
|
367
|
+
fi
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
# Save the location of the current completion dump file.
|
372
|
+
|
373
|
+
if [ -z "$ZSH_COMPDUMP" ]; then
|
374
|
+
|
375
|
+
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
|
376
|
+
|
377
|
+
fi
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
|
382
|
+
|
383
|
+
source $ZSH/lib/compfix.zsh
|
384
|
+
|
385
|
+
# If completion insecurities exist, warn the user
|
386
|
+
|
387
|
+
handle_completion_insecurities
|
388
|
+
|
389
|
+
# Load only from secure directories
|
390
|
+
|
391
|
+
compinit -i -C -d "${ZSH_COMPDUMP}"
|
392
|
+
|
393
|
+
else
|
394
|
+
|
395
|
+
# If the user wants it, load from all found directories
|
396
|
+
|
397
|
+
compinit -u -C -d "${ZSH_COMPDUMP}"
|
398
|
+
|
399
|
+
fi
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
# Load all of the config files in ~/oh-my-zsh that end in .zsh
|
406
|
+
|
407
|
+
# TIP: Add files you don't want in git to .gitignore
|
408
|
+
|
409
|
+
for config_file ($ZSH/lib/*.zsh); do
|
410
|
+
|
411
|
+
custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}"
|
412
|
+
|
413
|
+
[ -f "${custom_config_file}" ] && config_file=${custom_config_file}
|
414
|
+
|
415
|
+
source $config_file
|
416
|
+
|
417
|
+
done
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
# Load all of the plugins that were defined in ~/.zshrc
|
422
|
+
|
423
|
+
for plugin ($plugins); do
|
424
|
+
|
425
|
+
if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then
|
426
|
+
|
427
|
+
source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh
|
428
|
+
|
429
|
+
elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
|
430
|
+
|
431
|
+
source $ZSH/plugins/$plugin/$plugin.plugin.zsh
|
432
|
+
|
433
|
+
fi
|
434
|
+
|
435
|
+
done
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
# Load all of your custom configurations from custom/
|
440
|
+
|
441
|
+
for config_file ($ZSH_CUSTOM/*.zsh(N)); do
|
442
|
+
|
443
|
+
source $config_file
|
444
|
+
|
445
|
+
done
|
446
|
+
|
447
|
+
unset config_file
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
# Load the theme
|
452
|
+
|
453
|
+
if [[ "$ZSH_THEME" == "random" ]]; then
|
454
|
+
|
455
|
+
if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = "array" ]] && [[ "${#ZSH_THEME_RANDOM_CANDIDATES[@]}" -gt 0 ]]; then
|
456
|
+
|
457
|
+
themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDIDATES}.zsh-theme)
|
458
|
+
|
459
|
+
else
|
460
|
+
|
461
|
+
themes=($ZSH/themes/*zsh-theme)
|
462
|
+
|
463
|
+
fi
|
464
|
+
|
465
|
+
N=${#themes[@]}
|
466
|
+
|
467
|
+
((N=(RANDOM%N)+1))
|
468
|
+
|
469
|
+
RANDOM_THEME=${themes[$N]}
|
470
|
+
|
471
|
+
source "$RANDOM_THEME"
|
472
|
+
|
473
|
+
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
|
474
|
+
|
475
|
+
else
|
476
|
+
|
477
|
+
if [ ! "$ZSH_THEME" = "" ]; then
|
478
|
+
|
479
|
+
if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then
|
480
|
+
|
481
|
+
source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme"
|
482
|
+
|
483
|
+
elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then
|
484
|
+
|
485
|
+
source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme"
|
486
|
+
|
487
|
+
else
|
488
|
+
|
489
|
+
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
|
490
|
+
|
491
|
+
fi
|
492
|
+
|
493
|
+
fi
|
494
|
+
|
495
|
+
fi
|
496
|
+
|
497
|
+
```
|