開発やメイン環境ではなく、あるツールのsandbox環境を目指す。
> [!info]
> [[🦉owl-playbook]]でスクリプト化してあるので、分かっている人はそちらを使う方が楽かも。
# 必須
## [[Multipass]]と[[Ubuntu]]のインストール
[[📜Windows10でMultipassを動かしてみる]] を参考に。
```console
$ multipass --version
multipass 1.12.2+win
multipassd 1.12.2+win
$ multipass launch --name ubuntu-sandbox --cpus 2 --memory 4G --disk 10GB
```
## [[Ubuntu]]にログイン
```console
$ multipass exec ubuntu-sandbox -- bash
$ mkdir .config
```
### 依存をインストール
```console
sudo apt-get update
sudo apt-get install -y \
build-essential \
libsqlite3-dev \
unzip \
libbz2-dev \
libncurses-dev \
libreadline-dev \
libssl-dev \
libffi-dev \
liblzma-dev \
zlib1g-dev
```
- [[build-essential]]は[[nvim-treesitter]]で使用
- [[libsqlite3-dev]]は[[telescope-frecency.nvim]]で使用
- [[unzip]]は[[Broot]]で使用
- 以下は[[Python]]で使用
- [[libbz2-dev]]
- [[libncurses-dev]]
- [[libreadline-dev]]
- [[libssl-dev]]
- [[libffi-dev]]
- [[liblzma-dev]]
- [[zlib1g-dev]]
- [[libsqlite3-dev]]
## [[asdf]]
```console
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.12.0
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc
echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc
```
再ログイン。
## [[Starship]]
```console
asdf plugin add starship
asdf install starship latest
asdf global starship latest
echo 'eval "$(starship init bash)"' >> ~/.bashrc
starship preset bracketed-segments > ~/.config/starship.toml
```
再ログインするとターミナルが格好良くなる。
## [[Broot]]
```console
asdf plugin-add broot https://github.com/cmur2/asdf-broot.git
asdf install broot latest
asdf global broot latest
```
一度は`broot`コマンドで起動する。案内に従ってインストールも。
```console
wget https://raw.githubusercontent.com/tadashi-aikawa/owl-playbook/master/mnt/linux/ubuntu/broot.toml -O ~/.config/broot/conf.toml
```
再ログインすると`br`コマンドが使えるようになり設定も有効になっている。
## [[Neovim]]
### [[Neovim]]のインストール
```console
asdf plugin add neovim
asdf install neovim 0.8.3
asdf global neovim 0.8.3
echo 'alias vim=nvim' >> ~/.bashrc
mkdir -p ~/.config/nvim
wget https://raw.githubusercontent.com/tadashi-aikawa/owl-playbook/master/mnt/common/nvim/init.lua -O ~/.config/nvim/init.lua
wget https://raw.githubusercontent.com/tadashi-aikawa/owl-playbook/master/mnt/common/nvim/coc-settings.json -O ~/.config/nvim/coc-settings.json
wget https://raw.githubusercontent.com/tadashi-aikawa/owl-playbook/master/mnt/common/nvim/lazy-lock.json -O ~/.config/nvim/lazy-lock.json
```
再ログインして`vim`コマンドで起動すると、プラグインインストールがはじまる。
> [!Caution]
> #2023/04/08 現在だと、[[📝VMのUbuntuでNeovim 0.9を起動するとレイアウトが色々壊れる]]ことが発覚したので、バージョンは0.8.3に切り戻している。
## [[GitUI]]
```console
asdf plugin add gitui
asdf install gitui latest
asdf global gitui latest
```
```console
wget https://raw.githubusercontent.com/tadashi-aikawa/owl-playbook/master/mnt/common/gitui/key_bindings.ron -O ~/.config/gitui/key_bindings.ron
```
## [[Node.js]]
```console
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
asdf list-all nodejs
asdf install nodejs 18.17.1
asdf global nodejs 18.17.1
```
## [[ripgrep]]
```console
asdf plugin add ripgrep
asdf install ripgrep latest
asdf global ripgrep latest
```
## [[zoxide]]
```console
asdf plugin add zoxide https://github.com/nyrst/asdf-zoxide.git
asdf install zoxide latest
asdf global zoxide latest
echo 'eval "$(zoxide init bash)"' >> ~/.bashrc
```
## [[exa]]
```console
sudo apt-get install -y unzip
asdf plugin add exa
asdf install exa latest
asdf global exa latest
echo 'alias tree="exa --icons -T"' >> ~/.bashrc
echo 'alias ll="exa --icons -l --git"' >> ~/.bashrc
```
## [[fzf]]
```
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
# すべてyes
~/.fzf/install
echo 'alias cdz="zi"' >> ~/.bashrc
echo 'export FZF_DEFAULT_OPTS="--reverse --border --height 50%"' >> ~/.bashrc
```
## [[delta]]
```console
asdf plugin add delta https://github.com/andweeb/asdf-delta.git
asdf install delta latest
asdf global delta latest
```
`.gitconfig`
```txt
[core]
pager = delta
[interactive]
diffFilter = delta --color-only
[delta]
navigate = true # use n and N to move between diff sections
light = false # set to true if you're in a terminal w/ a light background color (e.g. the default macOS terminal)
side-by-side = true
[merge]
conflictstyle = diff3
[diff]
colorMoved = default
```
## [[Task]]
```console
asdf plugin add task
asdf install task latest
asdf global task latest
```
## 移動エイリアス
```console
cat >> ~/.bashrc << 'EOF'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
EOF
```
## [[Git]]コマンドエイリアス
```console
cat >> ~/.bashrc << 'EOF'
alias gf="git fetch --all"
alias ga='git add'
alias gaa='git add --all'
alias gb='git checkout $(git branch -l | grep -vE "^\*" | tr -d " " | fzf)'
alias gbc='git checkout -b'
alias gco='git commit -m'
alias gbr='git branch -rl | grep -vE "HEAD|master" | tr -d " " | sed -r "s@origin/@@g" | fzf | xargs -i git checkout -b {} origin/{}'
alias gd='git diff'
alias gds='git diff --staged'
alias gf='git fetch --all'
alias gl='git log'
alias gll='git log -10 --oneline --all --graph --decorate'
alias gls='git log -3'
alias glll="git log --graph --all --date=format:'%Y-%m-%d %H:%M' --pretty=format:'%C(auto)%d%Creset %C(yellow reverse)%h%Creset %C(magenta)%ae%Creset %C(cyan)%ad%Creset%n%C(white bold)%w(80)%s%Creset%n%b'"
alias glls="git log --graph --all --date=format:'%Y-%m-%d %H:%M' --pretty=format:'%C(auto)%d%Creset %C(yellow reverse)%h%Creset %C(magenta)%ae%Creset %C(cyan)%ad%Creset%n%C(white bold)%w(80)%s%Creset%n%b' -10"
alias gbm='git merge --no-ff $(git branch -l | grep -vE "^\*" | tr -d " " | fzf)'
alias gs='git status --short'
alias gss='git status -v'
EOF
```
# 任意
## [[Python]]
```console
asdf plugin-add python
asdf install python latest
asdf global python latest
```
### [[Poetry]]
```console
asdf plugin-add poetry https://github.com/asdf-community/asdf-poetry.git
asdf install poetry latest
asdf global poetry latest
poetry config virtualenvs.in-project true
```
### [[Pipenv]]
```console
pip install pipenv
```
## [[Go]]
```console
asdf plugin-add golang
asdf install golang latest
asdf global golang latest
```
### [[gopls]]
```console
go install golang.org/x/tools/gopls@latest
```
## [[AWS CLI]]
```console
asdf plugin add awscli
asdf install awscli latest
asdf global awscli latest
```
## [[jq]]
```console
asdf plugin add jq
asdf install jq latest
asdf global jq latest
```
## [[BATS]]
```console
asdf plugin add bats
asdf install bats latest
asdf global bats latest
```
## [[Bun]]
```console
asdf plugin add bun
asdf install bun latest
asdf global bun latest
```