♻️ 移行
Oh-My-Zsh
OMZ のショートハンドシンタックス
zi snippet <URL> # Raw syntax with URL
zi snippet OMZ::<PATH> # Shorthand OMZ:: (http://github.com/ohmyzsh/ohmyzsh/raw/master/)
zi snippet OMZL::<PATH> # Shorthand OMZ::lib (http://github.com/ohmyzsh/ohmyzsh/raw/master/lib)
zi snippet OMZT::<PATH> # Shorthand OMZ::themes (http://github.com/ohmyzsh/ohmyzsh/raw/master/themes)
zi snippet OMZP::<PATH> # Shorthand OMZ::plugins (http://github.com/ohmyzsh/ohmyzsh/raw/master/plugins)
OMZライブラリ
Importing the clipboard and termsupport from the OMZ library example:
生の構文:
zi snippet https://github.com/ohmyzsh/ohmyzsh/blob/master/lib/clipboard.zsh
zi snippet https://github.com/ohmyzsh/ohmyzsh/blob/master/lib/termsupport.zsh
OMZの省略記号構文:
zi snippet OMZ::lib/clipboard.zsh
zi snippet OMZ::lib/termsupport.zsh
OMZLの省略記号構文:
zi snippet OMZL::clipboard.zsh
zi snippet OMZL::termsupport.zsh
より高度な、Subversionを使ったライブラリの読み込みの例:
if (( $+commands[svn] )) {
sni=({git,theme-and-appearance,prompt_info_functions,history,completion,vcs_info}.zsh)
zi is-snippet has'svn' for svn \
multisrc'${sni[*]}' pick'/dev/null' \
atinit'typeset -gx COMPLETION_WAITING_DOTS=true \
HISTSIZE=290000 SAVEHIST=290000 HISTFILE=${ZSH_CACHE_DIR}/.history;' \
OMZ::lib
unset sni
} else {
+zi-message "{auto}Subversion not installed!"
}
OMZ プラグイン
- plugins=(
- git
- dotenv
- rake
- rbenv
- ruby
-)
+ zi snippet OMZP::git
+ zi snippet OMZP::dotenv
+ zi snippet OMZP::rake
+ zi snippet OMZP::rbenv
+ zi snippet OMZP::ruby
より高度な、条件付きターボローディングの例:
zi is-snippet wait lucid for \
atload"unalias grv g" \
OMZP::{git,sudo,encode64,extract} \
if'[[ -d /opt/google-cloud-sdk ]]' \
OMZP::gcloud \
if'[[ -f /etc/os-release ]] && source /etc/os-release && [[ "$ID" = arch ]]' \
OMZP::archlinux \
if'[[ -d ~/.nvm ]]' \
OMZP::nvm \
if'[[ -d ~/.ssh ]]' \
OMZP::ssh-agent \
if'[[ -d ~/.gnupg ]]' \
OMZP::gpg-agent \
if'[[ "$OSTYPE" = *-gnu ]]' \
OMZP::gnu-utils \
has'pip' \
OMZP::pip \
has'python' \
OMZP::python
上の例を1つのファイルに束ねる:
zi snippet <some/path/or/url/bundled-snippets.zsh
Use zi ice svn
if multiple files require an entire subdirectory.
zi ice svn
zi snippet OMZP::gitfast
zi ice svn
zi snippet OMZP::osx
zi ice svn
zi snippet OMZP::history-substring-search
Use zi ice as"completion"
to directly add single file completion snippets.
zi ice as"completion"
zi snippet OMZP::docker/_docker
zi ice as"completion"
zi snippet OMZP::fd/_fd
zi ice as"completion"
zi snippet OMZP::ag/_ag
OMZ テーマ
Themes are stored in the themes
directory and loaded in the background with the simple syntax:
ZSH_THEME="robbyrussell"
However, Zi doesn't support the ZSH_THEME
variable natively.
To use themes created for OMZ requires loading shown below as it would be the same as OMZ does in the background.
テーマによっては、追加の設定が必要な場合があります。それは、テーマ設定ファイルから判断できます。
- Load
git
library - Load the
git
plugin - ライブラリの依存関係を読み込む
- Enable
setopt prompt_subst
上記のうち1つでも欠けていたり、順番が違っていたりすると、以下のようにテーマが壊れます。
… $(build_prompt) …
If the Git
library is not loaded or loaded in the wrong order, then it may appear similar to the following:
........:1: command not found: git_prompt_status
........:1: command not found: git_prompt_short_sha
テーマで問題が発生した場合、OMZサポートライブラリを読み込む必要があります。
-
If your theme isn't colored when it should, you will want to load
theme-and-appearance.zsh
-
次のようなエラーメッセージが表示された場合:
zsh: command not found: ruby_prompt_info
You need to load prompt_info_functions.zsh
まとめると、次のようになります:
zi snippet OMZL::git.zsh
zi snippet OMZP::git
zi snippet OMZL::theme-and-appearance.zsh
zi snippet OMZL::prompt_info_functions.zsh
その後、プロンプトを読み込みます:
setopt prompt_subst
zi snippet OMZT::robbyrussell
External theme sample: NicoSantangelo/Alpharized
OMZを読み込む:
ZSH_THEME="alpharized"
Load git
library from OMZ:
zi snippet OMZL::git.zsh
Load git
plugin from OMZ:
zi snippet OMZP::git
zi cdclear -q