質問するログイン新規登録

質問編集履歴

1

oh-my-zshファイルの中身を追記

2019/10/08 11:57

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -115,4 +115,135 @@
115
115
  # alias zshconfig="mate ~/.zshrc"
116
116
  # alias ohmyzsh="mate ~/.oh-my-zsh"
117
117
 
118
+ ```
119
+
120
+
121
+
122
+
123
+ 追記しました。
124
+ ```
125
+ <oh-my-zsh.sh>の中身
126
+
127
+
128
+ # Set ZSH_CACHE_DIR to the path where cache files should be created
129
+ # or else we will use the default cache/
130
+ if [[ -z "$ZSH_CACHE_DIR" ]]; then
131
+ ZSH_CACHE_DIR="$ZSH/cache"
132
+ fi
133
+
134
+ # Migrate .zsh-update file to $ZSH_CACHE_DIR
135
+ if [ -f ~/.zsh-update ] && [ ! -f ${ZSH_CACHE_DIR}/.zsh-update ]; then
136
+ mv ~/.zsh-update ${ZSH_CACHE_DIR}/.zsh-update
137
+ fi
138
+
139
+ # Check for updates on initial load...
140
+ if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
141
+ env ZSH=$ZSH ZSH_CACHE_DIR=$ZSH_CACHE_DIR DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
142
+ fi
143
+
144
+ # Initializes Oh My Zsh
145
+
146
+ # add a function path
147
+ fpath=($ZSH/functions $ZSH/completions $fpath)
148
+
149
+ # Load all stock functions (from $fpath files) called below.
150
+ autoload -U compaudit compinit
151
+
152
+ # Set ZSH_CUSTOM to the path where your custom config files
153
+ # and plugins exists, or else we will use the default custom/
154
+ if [[ -z "$ZSH_CUSTOM" ]]; then
155
+ ZSH_CUSTOM="$ZSH/custom"
156
+ fi
157
+
158
+
159
+ is_plugin() {
160
+ local base_dir=$1
161
+ local name=$2
162
+ test -f $base_dir/plugins/$name/$name.plugin.zsh \
163
+ || test -f $base_dir/plugins/$name/_$name
164
+ }
165
+
166
+ # Add all defined plugins to fpath. This must be done
167
+ # before running compinit.
168
+ for plugin ($plugins); do
169
+ if is_plugin $ZSH_CUSTOM $plugin; then
170
+ fpath=($ZSH_CUSTOM/plugins/$plugin $fpath)
171
+ elif is_plugin $ZSH $plugin; then
172
+ fpath=($ZSH/plugins/$plugin $fpath)
173
+ else
174
+ echo "[oh-my-zsh] plugin '$plugin' not found"
175
+ fi
176
+ done
177
+
178
+ # Figure out the SHORT hostname
179
+ if [[ "$OSTYPE" = darwin* ]]; then
180
+ # macOS's $HOST changes with dhcp, etc. Use ComputerName if possible.
181
+ SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/}
182
+ else
183
+ SHORT_HOST=${HOST/.*/}
184
+ fi
185
+
186
+ # Save the location of the current completion dump file.
187
+ if [ -z "$ZSH_COMPDUMP" ]; then
188
+ ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
189
+ fi
190
+
191
+ if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
192
+ source $ZSH/lib/compfix.zsh
193
+ # If completion insecurities exist, warn the user
194
+ handle_completion_insecurities
195
+ # Load only from secure directories
196
+ compinit -i -C -d "${ZSH_COMPDUMP}"
197
+ else
198
+ # If the user wants it, load from all found directories
199
+ compinit -u -C -d "${ZSH_COMPDUMP}"
200
+ fi
201
+
202
+
203
+ # Load all of the config files in ~/oh-my-zsh that end in .zsh
204
+ # TIP: Add files you don't want in git to .gitignore
205
+ for config_file ($ZSH/lib/*.zsh); do
206
+ custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}"
207
+ [ -f "${custom_config_file}" ] && config_file=${custom_config_file}
208
+ source $config_file
209
+ done
210
+
211
+ # Load all of the plugins that were defined in ~/.zshrc
212
+ for plugin ($plugins); do
213
+ if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then
214
+ source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh
215
+ elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
216
+ source $ZSH/plugins/$plugin/$plugin.plugin.zsh
217
+ fi
218
+ done
219
+
220
+ # Load all of your custom configurations from custom/
221
+ for config_file ($ZSH_CUSTOM/*.zsh(N)); do
222
+ source $config_file
223
+ done
224
+ unset config_file
225
+
226
+ # Load the theme
227
+ if [[ "$ZSH_THEME" == "random" ]]; then
228
+ if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = "array" ]] && [[ "${#ZSH_THEME_RANDOM_CANDIDATES[@]}" -gt 0 ]]; then
229
+ themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDIDATES}.zsh-theme)
230
+ else
231
+ themes=($ZSH/themes/*zsh-theme)
232
+ fi
233
+ N=${#themes[@]}
234
+ ((N=(RANDOM%N)+1))
235
+ RANDOM_THEME=${themes[$N]}
236
+ source "$RANDOM_THEME"
237
+ echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
238
+ else
239
+ if [ ! "$ZSH_THEME" = "" ]; then
240
+ if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then
241
+ source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme"
242
+ elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then
243
+ source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme"
244
+ else
245
+ source "$ZSH/themes/$ZSH_THEME.zsh-theme"
246
+ fi
247
+ fi
248
+ fi
118
249
  ```