trixie で zsh

Debian Logo Tech

zsh

まずは zsh を入れる。

sudo apt update
sudo apt install zsh

デフォルトシェルを zsh に変更。

which zsh
→/usr/bin/zsh
chsh -s /usr/bin/zsh

sheldon

rustup で rust 関連のもの(cargo を含む)をインストール。

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

~/.zshrc を準備。ターミナルを開き直す。

 if [ -f "$HOME/.cargo/env" ]; then
 . "$HOME/.cargo/env"
fi

autoload -Uz compinit
compinit

sheldon のインストール。

sudo apt install pkg-config libssl-dev
cargo install sheldon
mkdir -p ~/.config/sheldon
sheldon init --shell zsh
vi ~/.config/sheldon/plugins.toml

設定ファイル ~/.config/sheldon/plugins.toml を作成。

# `sheldon` configuration file
# ----------------------------
#
# You can modify this file directly or you can use one of the following
# `sheldon` commands which are provided to assist in editing the config file:
#
# - `sheldon add` to add a new plugin to the config file
# - `sheldon edit` to open up the config file in the default editor
# - `sheldon remove` to remove a plugin from the config file
#
# See the documentation for more https://github.com/rossmacarthur/sheldon#readme

shell = "zsh"

[plugins]

# For example:
#
# [plugins.base16]
# github = "chriskempson/base16-shell"

[plugins.zsh-abbr]
github = "olets/zsh-abbr"

[plugins.zsh-autosuggestions]
github = "zsh-users/zsh-autosuggestions"

[plugins.zsh-syntax-highlighting]
github = "zsh-users/zsh-syntax-highlighting"

[plugins.zsh-completions]
github = "zsh-users/zsh-completions"

~/.zshrc に追加

eval "$(sheldon source)"

ヒストリ

.zshrc に追加。

HISTFILE=$HOME/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt hist_ignore_dups
setopt hist_ignore_all_dups
setopt hist_ignore_space
setopt hist_reduce_blanks
setopt share_history
setopt inc_append_history
setopt extended_history
setopt hist_verify
setopt hist_save_no_dups

プロンプト

starship をインストールする。

sudo apt update
sudo apt install -y curl ca-certificates # 念の為
curl -sS https://starship.rs/install.sh | sh

.zshrc に追加。

if command -v starship > /dev/null; then
eval "$(starship init zsh)"
fi

~/.config/starship.toml をつくる。

add_newline = true

format = """
$username$hostname$directory
$git_branch$git_status$python$nodejs$cmd_duration
$character
"""

right_format = "$status $time"

[username]
show_always = true
style_user = "bold green"
format = "[$user]($style)"

[hostname]
ssh_only = false
style = "bold green"
format = "[@$hostname]($style):"

[directory]
truncation_length = 5
truncation_symbol = "…/"
home_symbol = "~"
truncate_to_repo = false
repo_root_style = "bold purple"
style = "bold blue"
format = "[$path]($style)"

[git_branch]
symbol = "🌱 "
style = "bold purple"
format = "[$symbol$branch]($style) "

[git_status]
style = "dim purple"
format = "[$all_status$ahead_behind]($style) "

[nodejs]
symbol = "⬢ "
style = "bold cyan"
format = "[$symbol$version]($style) "

[python]
symbol = "🐍 "
style = "bold yellow"
format = "[$symbol$version]($style) "

[cmd_duration]
min_time = 2000
style = "bold red"
format = "took [$duration]($style) "

[status]
disabled = false
symbol = "✖ "
style = "bold red"
format = "[$symbol$status]($style)"

[time]
disabled = false
time_format = "%H:%M:%S" # ← 24時間制
style = "bold cyan"
format = "[\\[$time\\]]($style)"

[character]
success_symbol = "[❯](bold green)"
error_symbol = "[❯](bold red)"
vicmd_symbol = "[❮](bold yellow)"

コメント

タイトルとURLをコピーしました