ubuntu オレオレセットアップ
ubuntu
お気に入り
シェル関連
starship
eza
bat
glow
fzf-tab
oh-my-zsh
開発環境
devbox
github gh
AIツール
mods
いっきにいきましょう
nixのインストールは環境によっては時間かかるので注意
code:.sh
sudo apt update
sudo apt upgrade
# Oh My Zsh
sudo apt install zsh git curl -y
chsh -s $(which zsh)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
oh-my-zshは完了時に強制的に処理が中断されます
code:.sh
# gh
sudo apt install gh -y
# Rust Cargo
sudo apt install build-essential -y
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
. "$HOME/.cargo/env"
# eza
cargo install eza
# bat
sudo apt install bat -y
# fzf, fzf-tab
sudo apt install fzf -y
git clone https://github.com/Aloxaf/fzf-tab \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-tab
# starship
curl -sS https://starship.rs/install.sh | sh
# glow
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://repo.charm.sh/apt/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/charm.gpg
echo "deb signed-by=/etc/apt/keyrings/charm.gpg https://repo.charm.sh/apt/ * *" | sudo tee /etc/apt/sources.list.d/charm.list
sudo apt update && sudo apt install glow
# mods
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://repo.charm.sh/apt/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/charm.gpg
echo "deb signed-by=/etc/apt/keyrings/charm.gpg https://repo.charm.sh/apt/ * *" | sudo tee /etc/apt/sources.list.d/charm.list
sudo apt update && sudo apt install mods
# nix, devbox
curl -L https://nixos.org/nix/install | sh
curl -fsSL https://get.jetify.com/devbox | bash
ちなみに、まだお気に入りではなけど、試してる便利ツールにaichatがあります
しかしubuntu環境全般で使えるプリビルドが配信されていません
cargo installをしたら何度条件を変えても謎にセッションがクラッシュして痛い目をみました
導入の際には注意してください
プリビルドを利用するか、cargo installは試すに留めるとかしましょう
zshrc
Oh My Zshの推奨プラクティスには従っていない(笑)
これから肥大するようならファイルに分けます
code:.zshrc.sh
# Oh My Zsh
export ZSH="$HOME/.oh-my-zsh"
HIST_STAMPS="yyyy-mm-dd"
plugins=(git fzf-tab)
source $ZSH/oh-my-zsh.sh
# User configuration
export LANG=ja_JP.UTF-8
# Preferred editor
export EDITOR='cursor'
# Set personal aliases, overriding those provided by Oh My Zsh libs,
# plugins, and themes. Aliases can be placed here, though Oh My Zsh
# users are encouraged to define aliases within a top-level file in
# the $ZSH_CUSTOM folder, with .zsh extension. Examples:
# - $ZSH_CUSTOM/aliases.zsh
# - $ZSH_CUSTOM/macos.zsh
# For a full list of active aliases, run alias.
# fzf
# fzf-tab bug fix (backward-delete-char/eof)
zstyle ':fzf-tab:*' fzf-bindings-default 'tab:down,btab:up,change:top,ctrl-space:toggle,bspace:backward-delete-char,ctrl-h:backward-delete-char'
# use eza or bat for fzf-tab preview
zstyle ':fzf-tab:complete:*' fzf-preview '
# Define bat command based on availability
if command -v batcat &>/dev/null; then
BAT_CMD="batcat --style=numbers --color=always --line-range :200"
elif command -v bat &>/dev/null; then
BAT_CMD="bat --style=numbers --color=always --line-range :200"
else
BAT_CMD="cat -n"
fi
if -d $realpath ; then
# if a directory, use eza
eza -1 --all --color=always --icons=always $realpath
elif -f $realpath ; then
# check if binary file
if file --mime "$realpath" | grep -q "charset=binary"; then
# if binary, show file metadata
file -b "$realpath"
else
# if text file, use bat or batcat
$BAT_CMD $realpath
fi
fi
'
# Starship
eval "$(starship init zsh)"
# eza
alias ls='eza --all --long --no-permissions --no-user --icons --header --time-style=long-iso --sort=modified'
export EZA_ICONS_AUTO=1
# devbox
export DEVBOX_NO_PROMPT=true
# venv
export VIRTUAL_ENV_DISABLE_PROMPT=1
# aichat
s() {
aichat $@ | glow
}
# atuin
. "$HOME/.atuin/bin/env"
eval "$(atuin init zsh)"
# bat
if command -v batcat &>/dev/null; then
alias bat="batcat"
fi