♻️ 移行
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
その後、プロンプトを読み込みます:
setopt prompt_subst
zi light NicoSantangelo/Alpharized
Prezto
PZT 省略記号構文
zi snippet <URL> # Raw syntax with URL
zi snippet PZT::<PATH> # Shorthand PZT:: (https://github.com/sorin-ionescu/prezto/tree/master/)
zi snippet PZTM::<PATH> # Shorthand PZT::modules/ (https://github.com/sorin-ionescu/prezto/tree/master/modules/)
PZT modules
Importing the environment and terminal Prezto modules example:
生の構文
zi snippet https://github.com/sorin-ionescu/prezto/blob/master/modules/environment/init.zsh
zi snippet https://github.com/sorin-ionescu/prezto/blob/master/modules/terminal/init.zsh
PZT 省略記号構文:
zi snippet PZT::<PATH>
zi snippet PZT::modules/environment
zi snippet PZT::modules/terminal
PZTMの省略記号構文:
zi snippet PZTM::<PATH>
zi snippet PZTM::environment
zi snippet PZTM::terminal
Preztoモジュール:
- zstyle ':prezto:load' pmodule 'git'
- zstyle ':prezto:load' pmodule 'environment' 'terminal'
+ zi snippet PZTM::git
+ zi is-snippet for PZTM::environment PZTM::terminal
利用可能なPreztoモジュール:
モジュール名 | 説明 |
---|---|
archive | アーカイブの一覧表示や抽出を行う機能を提供します。 |
autosuggestions | Integrates zsh-autosuggestions plugin into Prezto. |
command-not-found | Loads the command-not-found tool on macOS or Debian-based distributions. |
completion | Sets TAB completion and provides additional completions from the zsh-completions . |
directory | ディレクトリのオプションを設定し、ディレクトリ・エイリアスを定義します。 |
dnf | Defines dnf aliases. |
docker | Defines docker aliases and functions. |
dpkg | Defines dpkg aliases and functions. |
editor | キーバインディングを設定します。 |
emacs | Emacsの依存関係管理を有効にします。 |
environment | 一般的なシェルオプションを設定し、環境変数を定義します。 |
fasd | 頻繁に使用するファイルやディレクトリのリストを保持し、高速なアクセスを実現します。 |
git | 別名、関数、およびリポジトリー状況情報をプロンプトに表示することによって、 Git を拡張します。 |
gnu-utility | GNU 以外のシステムでの GNU ユーティリティのインタラクティブな使用を可能にします。 |
gpg | Provides for an easier use of GPG by setting up gpg-agent . |
haskell | Haskell パッケージのローカルインストールを有効にします。 |
helper | モジュール開発のためのヘルパー機能を提供します。 |
history-substring-search | Zsh-history-substring-searchをPreztoに統合します。 |
history | ヒストリーのオプションを設定し、ヒストリーのエイリアスを定義します。 |
homebrew | Homebrewのエイリアスを定義します。 |
macports | MacPortsのエイリアスを定義し、MacPortsのディレクトリをpathに追加します。 |
node | Provides utility functions for Node.js and loads npm completion. |
ocaml | OCaml パッケージ管理を初期化します。 |
osx | MacOSのエイリアスや関数を定義しています。 |
pacman | Pacman パッケージマネージャとフロントエンドのためのエイリアスや関数を提供します。 |
perl | MacOSでのPerlモジュールのローカルインストールを可能にし、エイリアスを定義します。 |
prompt | プロンプトのテーマを読み込みます。 |
python | ローカルPythonおよびローカルPythonパッケージのインストールを有効にします。 |
rails | Ruby on Railsのエイリアスを定義します。 |
rsync | Defines rsync aliases. |
ruby | Rubyのローカルgemのインストール、バージョンマネージャのロード、エイリアスの定義などを設定します。 |
screen | GNU Screen のエイリアスを定義し、起動時に自動起動する機能を提供します。 |
spectrum | 256 colorやエフェクトをより使いやすくするための機能を提供します。 |
ssh | Provides for an easier use of SSH by setting up ssh-agent . |
syntax-highlighting | Integrates zsh-syntax-highlighting into Prezto. |
terminal | ターミナルウィンドウとタブのタイトルを設定します。 |
tmux | Defines tmux aliases and provides for auto launching it at start-up. |
utility | 一般的なエイリアスや関数を定義します。 |
wakeonlan | このモジュールは、wakeonlanツールのラッパーを提供します。 |
yum | yum のエイリアスを定義します。 |
Use zi ice svn
if multiple files require an entire subdirectory.
zi ice svn
zi snippet PZTM::docker
zi ice svn
zi snippet PZTM::git
Use zi ice as"null"
no *.plugin.zsh
, init.zsh
, *.zsh-theme*
files exist in module directory.
zi ice svn as"null"
zi snippet PZTM::archive
Use zi ice atclone"git clone <repo> <location>"
if module have external module.
zi ice svn blockf \
atclone"git clone --recursive https://github.com/zsh-users/zsh-completions.git external"
zi snippet PZTM::completion
Use blockf
to prevent any unnecessary additions to fpath
, as Zi manages fpath
.
What is zstyle
?
- Official (zsh.sourceforge.net): zsh/zutil
- StackExchange: What does
zstyle
do?
利用可能
Zgen
OMZライブラリの読み込み
- zgen oh-my-zsh
+ zi snippet OMZL::<ANY OF THEM>
OMZプラグインの読み込み
- zgen oh-my-zsh <PATH>
+ zi snippet OMZP::<PATH>
Prezto モジュールのロード
- zgen prezto <module name>
+ zi snippet PZTM::<module name>
リポジトリを prezto プラグインとして読み込む:
- zgen pmodule <reponame> <branch>
+ zi ice ver"<branch>"
+ zi load <repo/plugin>
Zgenの要約
For the location
: refer src, pick, multisrc ice-modifier.
- zgen load <repo> [location] [branch]
+ zi ice ver"[branch]"
+ zi load <repo>
Zplugの基本
- zplug <repo/plugin>, tag1:<option1>, tag2:<option2>
+ zi ice tag1"<option1>" tag2"<option2>"
+ zi load <repo/plugin>
タグの比較
as
=>as
use
=>pick
,src
,multisrc
ignore
=> Nonefrom
=>from
at
=>ver
rename-to
=>mv
,cp
dir
=> Selection(pick
, …) with renameif
=>if
hook-build
=>atclone
,atpull
hook-load
=>atload
frozen
=> Noneon
=> Nonedefer
=>wait
lazy
=>autoload
depth
=>depth