Open4

Shell

おやつカルパスおやつカルパス

fishの導入

普段使っているKonsoleはデフォルトのbashのままにしておき、Kittyをfishにする。

まず、fishシェルをインストールします。

sudo apt update
sudo apt install fish

インストールが完了したら、次のステップでKittyの設定を行います。

Kittyの設定ファイルは、通常~/.config/kitty/kitty.confにあります。このファイルを編集することで、Kittyで使用するデフォルトのシェルを変更できます。

vim ~/.config/kitty/kitty.conf

そして、次の行をファイルに追加または編集します。

# シェルの設定
shell /usr/bin/fish

この行はKittyが起動する際に使用するシェルを指定します。/usr/bin/fishはfishシェルの通常のインストールパスですが、もし異なる場合は適切なパスに変更してください。変更後は、Kittyを再起動する必要があります。

Konsoleは設定を変更していないので、デフォルトのシェルとしてbashを使い続けます。また、システム全体のデフォルトシェルを変更していないため、システムログイン時のシェルもbashのままです。

この方法で、Kittyではfishを使い、Konsoleとシステムのログインシェルはbashのままに保つことができます。

おやつカルパスおやつカルパス

.bashrc

# 上矢印キー(コマンド履歴の中から前に該当する項目を検索して表示)
bind '"\e[A": history-search-backward'
# 下矢印キー(コマンド履歴の中から次に該当する項目を検索して表示)
bind '"\e[B": history-search-forward'

\e はエスケープシーケンス

おやつカルパスおやつカルパス

zshを導入する

sudo apt update
sudo apt install zsh

zsh --version

デフォルトのログインシェルの変更

echo $SHELL
chsh -s $(which zsh)

この変更を適用するには、システムからログアウトして再度ログインするか、コンピュータを再起動します。

.zshrc

# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"

# history
HISTFILE=$HOME/.zsh_history
HISTSIZE=100000
SAVEHIST=1000000

# share .zshhistory
setopt inc_append_history
setopt share_history

# Themes
ZSH_THEME="robbyrussell"

# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
HYPHEN_INSENSITIVE="true"

# Uncomment one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled  # disable automatic updates
zstyle ':omz:update' mode auto      # update automatically without asking
# zstyle ':omz:update' mode reminder  # just remind me to update when it's time

# You can also set it to another string to have that shown instead of the default red dots.
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
COMPLETION_WAITING_DOTS="true"

plugins=(git)

source $ZSH/oh-my-zsh.sh

# User configuration
source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

# オートコンプリーションの有効化
autoload -Uz compinit
compinit

# 日本語の言語環境とUTF-8エンコーディングを設定
export LANG=ja_JP.UTF-8

# デフォルトのエディタをmicroに設定
export EDITOR='micro'

# aliases
alias ll="ls -l"
alias la="ls -a"
alias l="ls -CF"
alias mi="micro"

# インタラクティブなcd
# cdコマンドを入力した後にTabキーを押すと、インタラクティブなディレクトリ選択が可能になります。
autoload -Uz vcs_info
precmd() { vcs_info }
setopt AUTO_CD

# 補完候補を表示する際のスタイルを設定します。
zstyle ':completion:*' menu select

# cdコマンドをオーバーライドして、cd後にls -aを実行する
function cd() {
    builtin cd "$@" && ls
}

eval "$(starship init zsh)"
おやつカルパスおやつカルパス

Oh My Zshのインストール

sh -c "$(wget -O- https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

または、

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

zsh-autosuggestionsのインストール

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

zsh-syntax-highlightingのインストール

git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

変更の適用

source ~/.zshrc

Starshipのインストール

sh -c "$(curl -fsSL https://starship.rs/install.sh)"

echo 'eval "$(starship init zsh)"' >> ~/.zshrc

Nerd Fontsのインストール

https://www.nerdfonts.com/
FIraFontをインストールした。

unzip FiraCode.zip -d FiraCode

mkdir -p ~/.local/share/fonts
mv FiraCode/* ~/.local/share/fonts/

# フォントキャッシュの更新
fc-cache -fv

microエディタをインストール

https://micro-editor.github.io/