Closed6

Ubuntuの環境構築

Naoki TakahashiNaoki Takahashi

fish

sudo apt-get install software-properties-common
sudo apt-add-repository ppa:fish-shell/release-3
sudo apt update
curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher
fisher install oh-my-fish/theme-bobthefish
which fish
chsh -s /usr/bin/fish
Naoki TakahashiNaoki Takahashi

Starship

sh -c "\$(curl -fsSL https://starship.rs/install.sh)
echo 'eval "$(starship init bash)"' >> ~/.bashrc
echo 'starship init fish | source' >> ~/.config/fish/config.fish
~/.config/starship.toml
[directory]
truncation_length = 100
truncate_to_repo = false
Naoki TakahashiNaoki Takahashi

Python

direnvvenv の入り切りを自動化

sudo apt install python3 python3-pip python3-venv direnv

~/.bashrc に以下を追記

~/.bashrc
# direnv
eval "$(direnv hook bash)"
show_virtual_env() {
  if [[ -n "$VIRTUAL_ENV" && -n "$DIRENV_DIR" ]]; then
    echo "($(basename $VIRTUAL_ENV))"
  fi
}
export -f show_virtual_env
PS1='$(show_virtual_env)'$PS1

~/.config/fish/config.fish はこんな感じ?

~/.config/fish/config.fish
# direnv
direnv hook fish | source
show_virtual_env() {
  if [[ -n "$VIRTUAL_ENV" && -n "$DIRENV_DIR" ]]; then
    echo "($(basename $VIRTUAL_ENV))"
  fi
}
export -f show_virtual_env
PS1='$(show_virtual_env)'$PS1

.envrc をPythonプロジェクトに追加

.envrc
source venv/bin/activate
unset PS1
Naoki TakahashiNaoki Takahashi

Git

git config --global --edit
~/.gitignore
# WSLのCredential Helper
[credential]
        helper = /mnt/c/Program\\ Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe
[core]
        autoCRLF = false
[alias]
        vacuum = "!f () { git checkout $1; git branch --merged|egrep -v '\\*|develop|main'|xargs git branch -d; git fetch --prune; };f"
このスクラップは2023/04/18にクローズされました