Ubuntu バージョン
$ cat /etc/os-release PRETTY_NAME="Ubuntu 22.04.2 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04.2 LTS (Jammy Jellyfish)" VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=jammy
zsh をインストール
現在のシェルを確認
$ echo $SHELL
インストール済みか確認
$ zsh --version
Command 'zsh' not found, but can be installed with:
インストール
$ sudo apt update && sudo apt install zsh
zsh の場所を確認
$ which zsh
/usr/bin/zsh
デフォルトのシェルを変更
$ chsh -s /usr/bin/zsh
コンソールを立ち上げ直して適用されていることを確認
$ echo $SHELL /usr/bin/zsh
OhMyZsh をインストール
$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git のインストール
後続の手順でgit が必要なのでインストールします。
新しいバージョンを入れておきたかったのでgit公式の手順に従ってPPAを使用します。
(PPA=Ubuntu非公式レポジトリ)
git-scm.com
$ sudo add-apt-repository ppa:git-core/ppa $ sudo apt update $ apt install git
zsh-autocomplete をインストール
zsh-autocomplete は zsh の自動補完機能を提供するプラグインです。
リンク先の Installing & Updating に従ってインストールをします。
github.com
~/Repos を作成して cd します。
$ mkdir ~/Repos && cd $_
リポジトリをクローン
$ git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
ls -a ~/.zshrc
でファイルが無ければ ~/.zshrc を作成する
$ touch ~/.zshrc
vim で.zshrcを開き source ~/Repos/zsh-autocomplete/zsh-autocomplete.plugin.zsh
を追記
$ vim ~/.zshrc
シェルをリロード
$ exec $SHELL -l
enhancd をインストール
github.com ~/Repos に移動
cd ~/Repos
リポジトリをクローン
git clone https://github.com/b4b4r07/enhancd && source enhancd/init.sh
cd 後に ls を実行するように以下を .zshrc に記載.
source ~/Repos/enhancd/init.sh ENHANCD_HOOK_AFTER_CD=ls