From 1d017d6b7447175241b8562588fa3315d5d57adc Mon Sep 17 00:00:00 2001 From: machupicchubeta Date: Sun, 29 Oct 2023 01:47:01 +0900 Subject: [PATCH 01/17] Move RSpec config file under XDG Base Directory Refs. - https://github.com/rspec/rspec-core/commit/5e395e2016f1da19475e6db2817eb26dae828c4c - https://wiki.archlinux.org/title/XDG_Base_Directory#Supported - https://wiki.archlinux.jp/index.php/XDG_Base_Directory#.E3.82.B5.E3.83.9D.E3.83.BC.E3.83.88.E3.81.97.E3.81.A6.E3.81.84.E3.82.8B.E3.82.BD.E3.83.95.E3.83.88.E3.82.A6.E3.82.A7.E3.82.A2 --- bin/put_settings.sh | 2 +- .rspec => config/rspec/options | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename .rspec => config/rspec/options (100%) diff --git a/bin/put_settings.sh b/bin/put_settings.sh index f01f4999..bd4f87ed 100755 --- a/bin/put_settings.sh +++ b/bin/put_settings.sh @@ -35,7 +35,7 @@ if [ -d "$SETTINGS_PATH/.vim" ]; then ln -s "$SETTINGS_PATH/.vim" "$XDG_CONFIG_HOME/nvim" fi -for app in "git" "starship" "lsd" "sheldon"; do +for app in "git" "starship" "lsd" "sheldon" "rspec"; do if [ -L "$XDG_CONFIG_HOME/$app" ]; then unlink "$XDG_CONFIG_HOME/$app" fi diff --git a/.rspec b/config/rspec/options similarity index 100% rename from .rspec rename to config/rspec/options From d260238f64248ac646ff2b1811a98cd78caa77e0 Mon Sep 17 00:00:00 2001 From: machupicchubeta Date: Sun, 29 Oct 2023 01:58:59 +0900 Subject: [PATCH 02/17] Move RubyGems config file under XDG Base Directory Refs. - https://github.com/ruby/ruby/commit/5c6269c - https://github.com/ruby/ruby/pull/2174 - https://wiki.archlinux.org/title/XDG_Base_Directory#Supported - https://wiki.archlinux.jp/index.php/XDG_Base_Directory#.E3.82.B5.E3.83.9D.E3.83.BC.E3.83.88.E3.81.97.E3.81.A6.E3.81.84.E3.82.8B.E3.82.BD.E3.83.95.E3.83.88.E3.82.A6.E3.82.A7.E3.82.A2 --- bin/put_settings.sh | 2 +- .gemrc => config/gem/gemrc | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename .gemrc => config/gem/gemrc (100%) diff --git a/bin/put_settings.sh b/bin/put_settings.sh index bd4f87ed..dc3706f5 100755 --- a/bin/put_settings.sh +++ b/bin/put_settings.sh @@ -35,7 +35,7 @@ if [ -d "$SETTINGS_PATH/.vim" ]; then ln -s "$SETTINGS_PATH/.vim" "$XDG_CONFIG_HOME/nvim" fi -for app in "git" "starship" "lsd" "sheldon" "rspec"; do +for app in "git" "starship" "lsd" "sheldon" "gem" "rspec"; do if [ -L "$XDG_CONFIG_HOME/$app" ]; then unlink "$XDG_CONFIG_HOME/$app" fi diff --git a/.gemrc b/config/gem/gemrc similarity index 100% rename from .gemrc rename to config/gem/gemrc From 1a665a8ba1cff28099039d1fb672b4599d90888e Mon Sep 17 00:00:00 2001 From: machupicchubeta Date: Sun, 29 Oct 2023 02:05:36 +0900 Subject: [PATCH 03/17] Move tmux config file under XDG Base Directory Refs. - https://raw.githubusercontent.com/tmux/tmux/3.1/CHANGES - https://github.com/tmux/tmux/issues/142 - https://wiki.archlinux.org/title/XDG_Base_Directory#Supported - https://wiki.archlinux.jp/index.php/XDG_Base_Directory#.E3.82.B5.E3.83.9D.E3.83.BC.E3.83.88.E3.81.97.E3.81.A6.E3.81.84.E3.82.8B.E3.82.BD.E3.83.95.E3.83.88.E3.82.A6.E3.82.A7.E3.82.A2 --- bin/put_settings.sh | 2 +- .tmux.conf => config/tmux/tmux.conf | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename .tmux.conf => config/tmux/tmux.conf (100%) diff --git a/bin/put_settings.sh b/bin/put_settings.sh index dc3706f5..963a0ff0 100755 --- a/bin/put_settings.sh +++ b/bin/put_settings.sh @@ -35,7 +35,7 @@ if [ -d "$SETTINGS_PATH/.vim" ]; then ln -s "$SETTINGS_PATH/.vim" "$XDG_CONFIG_HOME/nvim" fi -for app in "git" "starship" "lsd" "sheldon" "gem" "rspec"; do +for app in "git" "starship" "lsd" "sheldon" "gem" "rspec" "tmux"; do if [ -L "$XDG_CONFIG_HOME/$app" ]; then unlink "$XDG_CONFIG_HOME/$app" fi diff --git a/.tmux.conf b/config/tmux/tmux.conf similarity index 100% rename from .tmux.conf rename to config/tmux/tmux.conf From 5e2cbb667ef4f7b0e944142f32a7101b9253db8e Mon Sep 17 00:00:00 2001 From: machupicchubeta Date: Sun, 29 Oct 2023 02:20:13 +0900 Subject: [PATCH 04/17] Move Readline config file under XDG Base Directory See also: - https://wiki.archlinux.org/title/XDG_Base_Directory#Partial - https://wiki.archlinux.jp/index.php/XDG_Base_Directory#.E9.83.A8.E5.88.86.E7.9A.84.E3.81.AB.E3.82.B5.E3.83.9D.E3.83.BC.E3.83.88.E3.81.97.E3.81.A6.E3.81.84.E3.82.8B.E3.82.BD.E3.83.95.E3.83.88.E3.82.A6.E3.82.A7.E3.82.A2 --- .bash/variables.sh | 1 + .zsh/variables.zsh | 1 + bin/put_settings.sh | 2 +- .inputrc => config/readline/inputrc | 0 4 files changed, 3 insertions(+), 1 deletion(-) rename .inputrc => config/readline/inputrc (100%) diff --git a/.bash/variables.sh b/.bash/variables.sh index a0a469a4..da6f3527 100644 --- a/.bash/variables.sh +++ b/.bash/variables.sh @@ -66,5 +66,6 @@ export GUILE_TLS_CERTIFICATE_DIRECTORY="$HOMEBREW_PREFIX/etc/gnutls/" export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$HOMEBREW_PREFIX/opt/openssl@1.1" export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml" +export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc" export GPG_TTY=$(tty) diff --git a/.zsh/variables.zsh b/.zsh/variables.zsh index 12200523..d022bae3 100644 --- a/.zsh/variables.zsh +++ b/.zsh/variables.zsh @@ -75,5 +75,6 @@ export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$HOMEBREW_PREFIX/opt/openssl@1.1" export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#F2E6D4,bg=#7E87D6,bold,underline" export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml" +export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc" export GPG_TTY=$(tty) diff --git a/bin/put_settings.sh b/bin/put_settings.sh index 963a0ff0..69e1d52d 100755 --- a/bin/put_settings.sh +++ b/bin/put_settings.sh @@ -35,7 +35,7 @@ if [ -d "$SETTINGS_PATH/.vim" ]; then ln -s "$SETTINGS_PATH/.vim" "$XDG_CONFIG_HOME/nvim" fi -for app in "git" "starship" "lsd" "sheldon" "gem" "rspec" "tmux"; do +for app in "git" "starship" "lsd" "sheldon" "readline" "gem" "rspec" "tmux"; do if [ -L "$XDG_CONFIG_HOME/$app" ]; then unlink "$XDG_CONFIG_HOME/$app" fi diff --git a/.inputrc b/config/readline/inputrc similarity index 100% rename from .inputrc rename to config/readline/inputrc From ebd745ee006d98f3247966d815ecbcbbb4823874 Mon Sep 17 00:00:00 2001 From: machupicchubeta Date: Sun, 29 Oct 2023 03:24:53 +0900 Subject: [PATCH 05/17] Move Bundler config file under XDG Base Directory See also: - https://github.com/rubygems/bundler/pull/6024 - https://github.com/rubygems/bundler/issues/4333 - https://github.com/rubygems/rubygems/issues/1599 - https://wiki.archlinux.org/title/XDG_Base_Directory#Partial - https://wiki.archlinux.jp/index.php/XDG_Base_Directory#.E9.83.A8.E5.88.86.E7.9A.84.E3.81.AB.E3.82.B5.E3.83.9D.E3.83.BC.E3.83.88.E3.81.97.E3.81.A6.E3.81.84.E3.82.8B.E3.82.BD.E3.83.95.E3.83.88.E3.82.A6.E3.82.A7.E3.82.A2 --- .bash/variables.sh | 22 +++++++++++++------ .zsh/variables.zsh | 22 +++++++++++++------ bin/put_settings.sh | 18 ++++++++++++++- {.bundle_arm64 => config/bundle/arm64}/config | 0 .../bundle/x86_64}/config | 0 config/git/ignore | 4 ---- 6 files changed, 47 insertions(+), 19 deletions(-) rename {.bundle_arm64 => config/bundle/arm64}/config (100%) rename {.bundle_x86_64 => config/bundle/x86_64}/config (100%) diff --git a/.bash/variables.sh b/.bash/variables.sh index da6f3527..5f1d08c2 100644 --- a/.bash/variables.sh +++ b/.bash/variables.sh @@ -1,15 +1,28 @@ +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_STATE_HOME="$HOME/.local/state" + if [ "$(uname -m)" = "x86_64" ]; then export ARCHFLAGS="-arch x86_64" export HOMEBREW_PREFIX="/usr/local" export HOMEBREW_CELLAR="/usr/local/Cellar" export HOMEBREW_REPOSITORY="/usr/local/Homebrew" - export BUNDLE_USER_HOME="$HOME/.bundle_x86_64" + + export BUNDLE_USER_HOME="$XDG_DATA_HOME/bundle/x86_64" + export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME/bundle/x86_64/config" + export BUNDLE_USER_CACHE="$XDG_CACHE_HOME/bundle/x86_64" + export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME/bundle/x86_64/plugin" elif [ "$(uname -m)" = "arm64" ]; then export ARCHFLAGS="-arch arm64" export HOMEBREW_PREFIX="/opt/homebrew" export HOMEBREW_CELLAR="/opt/homebrew/Cellar" export HOMEBREW_REPOSITORY="/opt/homebrew" - export BUNDLE_USER_HOME="$HOME/.bundle_arm64" + + export BUNDLE_USER_HOME="$XDG_DATA_HOME/bundle/arm64" + export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME/bundle/arm64/config" + export BUNDLE_USER_CACHE="$XDG_CACHE_HOME/bundle/arm64" + export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME/bundle/arm64/plugin" fi # Make vim the default editor @@ -49,11 +62,6 @@ export AWS_PROFILE=default export DISABLE_SPRING=1 -export XDG_CONFIG_HOME="$HOME/.config" -export XDG_CACHE_HOME="$HOME/.cache" -export XDG_DATA_HOME="$HOME/.local/share" -export XDG_STATE_HOME="$HOME/.local/state" - export PYTHONPATH=$(if [ -d "$PYENV_ROOT/shims" ]; then echo "$PYENV_ROOT/shims"; elif [ -d "$HOMEBREW_PREFIX/opt/python/libexec/bin" ]; then echo "$HOMEBREW_PREFIX/opt/python/libexec/bin"; else echo '/usr/bin/python'; fi) export ENHANCD_FILTER=fzf diff --git a/.zsh/variables.zsh b/.zsh/variables.zsh index d022bae3..22b293b4 100644 --- a/.zsh/variables.zsh +++ b/.zsh/variables.zsh @@ -1,15 +1,28 @@ +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_STATE_HOME="$HOME/.local/state" + if [ "$(uname -m)" = "x86_64" ]; then export ARCHFLAGS="-arch x86_64" export HOMEBREW_PREFIX="/usr/local" export HOMEBREW_CELLAR="/usr/local/Cellar" export HOMEBREW_REPOSITORY="/usr/local/Homebrew" - export BUNDLE_USER_HOME="$HOME/.bundle_x86_64" + + export BUNDLE_USER_HOME="$XDG_DATA_HOME/bundle/x86_64" + export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME/bundle/x86_64/config" + export BUNDLE_USER_CACHE="$XDG_CACHE_HOME/bundle/x86_64" + export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME/bundle/x86_64/plugin" elif [ "$(uname -m)" = "arm64" ]; then export ARCHFLAGS="-arch arm64" export HOMEBREW_PREFIX="/opt/homebrew" export HOMEBREW_CELLAR="/opt/homebrew/Cellar" export HOMEBREW_REPOSITORY="/opt/homebrew" - export BUNDLE_USER_HOME="$HOME/.bundle_arm64" + + export BUNDLE_USER_HOME="$XDG_DATA_HOME/bundle/arm64" + export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME/bundle/arm64/config" + export BUNDLE_USER_CACHE="$XDG_CACHE_HOME/bundle/arm64" + export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME/bundle/arm64/plugin" fi export CPU_BRAND="$(/usr/sbin/sysctl -n machdep.cpu.brand_string)" @@ -53,11 +66,6 @@ export AWS_PROFILE=default export DISABLE_SPRING=1 -export XDG_CONFIG_HOME="$HOME/.config" -export XDG_CACHE_HOME="$HOME/.cache" -export XDG_DATA_HOME="$HOME/.local/share" -export XDG_STATE_HOME="$HOME/.local/state" - export RBENV_ROOT="$HOME/.rbenv" export GHQ_ROOT="$HOME/Repositories" diff --git a/bin/put_settings.sh b/bin/put_settings.sh index 69e1d52d..c3012070 100755 --- a/bin/put_settings.sh +++ b/bin/put_settings.sh @@ -21,6 +21,7 @@ find "$SETTINGS_PATH"/.* -maxdepth 0 -type d ! -path "$SETTINGS_PATH/." ! -path : "${XDG_CONFIG_HOME:=$HOME/.config}" : "${XDG_DATA_HOME:=$HOME/.local/share}" +: "${XDG_CACHE_HOME:=$HOME/.cache}" if [ ! -d "$XDG_CONFIG_HOME" ]; then mkdir "$XDG_CONFIG_HOME" @@ -35,7 +36,7 @@ if [ -d "$SETTINGS_PATH/.vim" ]; then ln -s "$SETTINGS_PATH/.vim" "$XDG_CONFIG_HOME/nvim" fi -for app in "git" "starship" "lsd" "sheldon" "readline" "gem" "rspec" "tmux"; do +for app in "git" "starship" "lsd" "sheldon" "bundle" "readline" "gem" "rspec" "tmux"; do if [ -L "$XDG_CONFIG_HOME/$app" ]; then unlink "$XDG_CONFIG_HOME/$app" fi @@ -62,9 +63,24 @@ for app in "git" "starship" "lsd" "sheldon" "readline" "gem" "rspec" "tmux"; do fi done fi + + if [ "$app" = "bundle" ]; then + for arch in "x86_64" "arm64"; do + if [ ! -d "$XDG_DATA_HOME/$app/$arch" ]; then + mkdir --parents "$XDG_DATA_HOME/$app/$arch" + fi + if [ ! -d "$XDG_DATA_HOME/$app/$arch/plugin" ]; then + mkdir --parents "$XDG_DATA_HOME/$app/$arch/plugin" + fi + if [ ! -d "$XDG_CACHE_HOME/$app/$arch" ]; then + mkdir --parents "$XDG_CACHE_HOME/$app/$arch" + fi + done + fi done unset -v app unset -v shell +unset -v arch find "$SETTINGS_PATH"/.* -maxdepth 0 -type f -exec sh -c ' dot_file=$1 diff --git a/.bundle_arm64/config b/config/bundle/arm64/config similarity index 100% rename from .bundle_arm64/config rename to config/bundle/arm64/config diff --git a/.bundle_x86_64/config b/config/bundle/x86_64/config similarity index 100% rename from .bundle_x86_64/config rename to config/bundle/x86_64/config diff --git a/config/git/ignore b/config/git/ignore index 5ea8bb72..1e875202 100644 --- a/config/git/ignore +++ b/config/git/ignore @@ -15,11 +15,7 @@ tags.lock **/.private **/private.* .bundle/* -.bundle_arm64/* -.bundle_x86_64/* vendor/bundle/** !.bundle/config -!.bundle_arm64/config -!.bundle_x86_64/config !**/.keep From 201194afa97da33eefbfad5a99657eddfee4ce6a Mon Sep 17 00:00:00 2001 From: machupicchubeta Date: Sun, 29 Oct 2023 03:43:03 +0900 Subject: [PATCH 06/17] Organize sheldon directories Instead of putting directories for each architecture horizontally under the XDG Base Directory, put directories for each architecture under the sheldon directory. This will make the directories directly under the XDG Base Directory clearer. Refs. - https://github.com/rossmacarthur/sheldon/blob/6244a30069761d299a7135a0393b0c09b57f5fec/README.md#options --- .bash_profile | 4 ++-- .zshrc | 4 ++-- bin/put_settings.sh | 13 ++----------- config/{sheldon_bash => sheldon/bash}/plugins.toml | 0 config/{sheldon_zsh => sheldon/zsh}/plugins.toml | 0 5 files changed, 6 insertions(+), 15 deletions(-) rename config/{sheldon_bash => sheldon/bash}/plugins.toml (100%) rename config/{sheldon_zsh => sheldon/zsh}/plugins.toml (100%) diff --git a/.bash_profile b/.bash_profile index 8b86891b..4e9b605d 100644 --- a/.bash_profile +++ b/.bash_profile @@ -9,7 +9,7 @@ if [ "$(uname -m)" = "arm64" ]; then fi if which sheldon > /dev/null; then - export SHELDON_CONFIG_DIR="$XDG_CONFIG_HOME/sheldon_bash" - export SHELDON_DATA_DIR="$XDG_DATA_HOME/sheldon_bash" + export SHELDON_CONFIG_DIR="$XDG_CONFIG_HOME/sheldon/bash" + export SHELDON_DATA_DIR="$XDG_DATA_HOME/sheldon/bash" eval "$(sheldon source)" fi diff --git a/.zshrc b/.zshrc index 1f8b432e..4d7ab77c 100644 --- a/.zshrc +++ b/.zshrc @@ -9,8 +9,8 @@ if [ "$(uname -m)" = "arm64" ]; then fi if which sheldon > /dev/null; then - export SHELDON_CONFIG_DIR="$XDG_CONFIG_HOME/sheldon_zsh" - export SHELDON_DATA_DIR="$XDG_DATA_HOME/sheldon_zsh" + export SHELDON_CONFIG_DIR="$XDG_CONFIG_HOME/sheldon/zsh" + export SHELDON_DATA_DIR="$XDG_DATA_HOME/sheldon/zsh" eval "$(sheldon source)" fi diff --git a/bin/put_settings.sh b/bin/put_settings.sh index c3012070..bf00a30b 100755 --- a/bin/put_settings.sh +++ b/bin/put_settings.sh @@ -49,17 +49,8 @@ for app in "git" "starship" "lsd" "sheldon" "bundle" "readline" "gem" "rspec" "t if [ "$app" = "sheldon" ]; then for shell in "bash" "zsh"; do - if [ -L "$XDG_CONFIG_HOME/$app"_"$shell" ]; then - unlink "$XDG_CONFIG_HOME/$app"_"$shell" - fi - if [ -d "$XDG_CONFIG_HOME/$app"_"$shell" ]; then - mv "$XDG_CONFIG_HOME/$app"_"$shell" "$XDG_CONFIG_HOME/$app"_"$shell"_"$timestamp" - fi - if [ -d "$SETTINGS_PATH/config/$app"_"$shell" ]; then - ln -s "$SETTINGS_PATH/config/$app"_"$shell" "$XDG_CONFIG_HOME/$app"_"$shell" - fi - if [ ! -d "$XDG_DATA_HOME/$app"_"$shell" ]; then - mkdir "$XDG_DATA_HOME/$app"_"$shell" + if [ ! -d "$XDG_DATA_HOME/$app/$shell" ]; then + mkdir --parents "$XDG_DATA_HOME/$app/$shell" fi done fi diff --git a/config/sheldon_bash/plugins.toml b/config/sheldon/bash/plugins.toml similarity index 100% rename from config/sheldon_bash/plugins.toml rename to config/sheldon/bash/plugins.toml diff --git a/config/sheldon_zsh/plugins.toml b/config/sheldon/zsh/plugins.toml similarity index 100% rename from config/sheldon_zsh/plugins.toml rename to config/sheldon/zsh/plugins.toml From 0fddc44122a2679af561d6c0d0ae4a6bda1d97b7 Mon Sep 17 00:00:00 2001 From: machupicchubeta Date: Sun, 29 Oct 2023 04:23:56 +0900 Subject: [PATCH 07/17] Move RBENV_ROOT under XDG Base Directory See also: - https://github.com/rbenv/rbenv/blob/d6bb1c63964304d9d3cdac783a65d66d56b35736/README.md#environment-variables - https://github.com/rbenv/rbenv/issues/811 - https://github.com/rbenv/rbenv/issues/1146 - https://wiki.archlinux.org/title/XDG_Base_Directory#Partial - https://wiki.archlinux.jp/index.php/XDG_Base_Directory#.E9.83.A8.E5.88.86.E7.9A.84.E3.81.AB.E3.82.B5.E3.83.9D.E3.83.BC.E3.83.88.E3.81.97.E3.81.A6.E3.81.84.E3.82.8B.E3.82.BD.E3.83.95.E3.83.88.E3.82.A6.E3.82.A7.E3.82.A2 --- .bash/variables.sh | 1 + .zsh/variables.zsh | 2 +- bin/put_settings.sh | 9 ++++----- {rbenv => local/share/rbenv}/default-gems | 0 4 files changed, 6 insertions(+), 6 deletions(-) rename {rbenv => local/share/rbenv}/default-gems (100%) diff --git a/.bash/variables.sh b/.bash/variables.sh index 5f1d08c2..ab3360cd 100644 --- a/.bash/variables.sh +++ b/.bash/variables.sh @@ -75,5 +75,6 @@ export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$HOMEBREW_PREFIX/opt/openssl@1.1" export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml" export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc" +export RBENV_ROOT="$XDG_DATA_HOME/rbenv" export GPG_TTY=$(tty) diff --git a/.zsh/variables.zsh b/.zsh/variables.zsh index 22b293b4..a55c95df 100644 --- a/.zsh/variables.zsh +++ b/.zsh/variables.zsh @@ -66,7 +66,6 @@ export AWS_PROFILE=default export DISABLE_SPRING=1 -export RBENV_ROOT="$HOME/.rbenv" export GHQ_ROOT="$HOME/Repositories" export PYTHONPATH=$(if [ -d "$PYENV_ROOT/shims" ]; then echo "$PYENV_ROOT/shims"; elif [ -d "$HOMEBREW_PREFIX/opt/python/libexec/bin" ]; then echo "$HOMEBREW_PREFIX/opt/python/libexec/bin"; else echo '/usr/bin/python'; fi) @@ -84,5 +83,6 @@ export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#F2E6D4,bg=#7E87D6,bold,underline" export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml" export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc" +export RBENV_ROOT="$XDG_DATA_HOME/rbenv" export GPG_TTY=$(tty) diff --git a/bin/put_settings.sh b/bin/put_settings.sh index bf00a30b..5ff0ad29 100755 --- a/bin/put_settings.sh +++ b/bin/put_settings.sh @@ -102,17 +102,16 @@ if [ -f "$SETTINGS_PATH/mysql/my-utf8mb4.cnf" ]; then sudo ln -s "$SETTINGS_PATH/mysql/my-utf8mb4.cnf" /etc/my.cnf fi -: "${RBENV_ROOT:=$HOME/.rbenv}" +: "${RBENV_ROOT:=$XDG_DATA_HOME/rbenv}" if [ ! -d "$RBENV_ROOT" ]; then - mkdir "$RBENV_ROOT" + mkdir --parent "$RBENV_ROOT" fi - if [ -L "$RBENV_ROOT/default-gems" ]; then unlink "$RBENV_ROOT/default-gems" fi -if [ -f "$SETTINGS_PATH/rbenv/default-gems" ]; then - ln -s "$SETTINGS_PATH/rbenv/default-gems" "$RBENV_ROOT/default-gems" +if [ -f "$SETTINGS_PATH/local/share/rbenv/default-gems" ]; then + ln -s "$SETTINGS_PATH/local/share/rbenv/default-gems" "$RBENV_ROOT/default-gems" fi unset SETTINGS_PATH diff --git a/rbenv/default-gems b/local/share/rbenv/default-gems similarity index 100% rename from rbenv/default-gems rename to local/share/rbenv/default-gems From ea80ca269bec9b374b38deb862017ec0f675545c Mon Sep 17 00:00:00 2001 From: machupicchubeta Date: Sun, 29 Oct 2023 04:39:24 +0900 Subject: [PATCH 08/17] Specify XDG Base Directory in the environment variables "STARSHIP_CACHE" explicitly See also: - https://starship.rs/config/#logging > By default starship logs warnings and errors into a file named `~/.cache/starship/session_${STARSHIP_SESSION_KEY}.log`, where the session key is corresponding to an instance of your terminal. - https://wiki.archlinux.org/title/XDG_Base_Directory#Partial --- .bash/variables.sh | 1 + .zsh/variables.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/.bash/variables.sh b/.bash/variables.sh index ab3360cd..959d3e0f 100644 --- a/.bash/variables.sh +++ b/.bash/variables.sh @@ -74,6 +74,7 @@ export GUILE_TLS_CERTIFICATE_DIRECTORY="$HOMEBREW_PREFIX/etc/gnutls/" export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$HOMEBREW_PREFIX/opt/openssl@1.1" export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml" +export STARSHIP_CACHE="$XDG_CACHE_HOME/starship" export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc" export RBENV_ROOT="$XDG_DATA_HOME/rbenv" diff --git a/.zsh/variables.zsh b/.zsh/variables.zsh index a55c95df..b3c99a42 100644 --- a/.zsh/variables.zsh +++ b/.zsh/variables.zsh @@ -82,6 +82,7 @@ export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$HOMEBREW_PREFIX/opt/openssl@1.1" export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#F2E6D4,bg=#7E87D6,bold,underline" export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml" +export STARSHIP_CACHE="$XDG_CACHE_HOME/starship" export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc" export RBENV_ROOT="$XDG_DATA_HOME/rbenv" From b7d4503ac592e98a4f3be32fd80c86247749e1b5 Mon Sep 17 00:00:00 2001 From: machupicchubeta Date: Sun, 29 Oct 2023 15:50:34 +0900 Subject: [PATCH 09/17] Stop using Oh My Zsh Docker plugin via sheldon It seems that the use case of using only the Oh My Zsh plugin is not intended, and an error occurs when loading the plugin in sheldon. I changed the directory arrangement in `SHELDON_CONFIG_DIR` and `SHELDON_DATA_DIR`, and now the error occurs when loading the plugin. The error was: ``` /Users/machupicchubeta/.local/share/sheldon/zsh/repos/github.com/ohmyzsh/ohmyzsh/plugins/docker/docker.plugin.zsh:60: no such file or directory: /completions/_docker ``` --- config/sheldon/zsh/plugins.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/sheldon/zsh/plugins.toml b/config/sheldon/zsh/plugins.toml index 90d576e3..3319c71b 100644 --- a/config/sheldon/zsh/plugins.toml +++ b/config/sheldon/zsh/plugins.toml @@ -26,7 +26,7 @@ apply = ["source"] [plugins.ohmyzsh-plugins] github = "ohmyzsh/ohmyzsh" dir = "plugins" -use = ["{bundler/bundler,docker/docker,docker-compose/docker-compose,git/git,history/history,macos/macos,terraform/terraform,z/z}.plugin.zsh"] +use = ["{bundler/bundler,docker-compose/docker-compose,git/git,history/history,macos/macos,terraform/terraform,z/z}.plugin.zsh"] apply = ["source"] [plugins.ohmyzsh-plugin-redis-cli] From 66c4150d408fe53f900095f4766ead058c9590a3 Mon Sep 17 00:00:00 2001 From: machupicchubeta Date: Sun, 29 Oct 2023 16:26:55 +0900 Subject: [PATCH 10/17] Put IRB configuration file under XDG Base Directory Until now, I have used the famous Rubiest configuration file as it is, but I created a new one based on it. See also: - https://github.com/k0kubun/dotfiles/blob/38d8bb44e88b52719fa8d0c91131ae21d2201596/config/.irbrc - https://ruby-doc.org/3.2.2/stdlibs/irb/IRB.html - https://wiki.archlinux.org/title/XDG_Base_Directory#Partial --- .bash/variables.sh | 1 + .zsh/variables.zsh | 1 + bin/put_settings.sh | 13 +++++-------- config/irb/irbrc | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 config/irb/irbrc diff --git a/.bash/variables.sh b/.bash/variables.sh index 959d3e0f..8480d4c1 100644 --- a/.bash/variables.sh +++ b/.bash/variables.sh @@ -77,5 +77,6 @@ export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml" export STARSHIP_CACHE="$XDG_CACHE_HOME/starship" export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc" export RBENV_ROOT="$XDG_DATA_HOME/rbenv" +export IRBRC="$XDG_CONFIG_HOME/irb/irbrc" export GPG_TTY=$(tty) diff --git a/.zsh/variables.zsh b/.zsh/variables.zsh index b3c99a42..0504775c 100644 --- a/.zsh/variables.zsh +++ b/.zsh/variables.zsh @@ -85,5 +85,6 @@ export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml" export STARSHIP_CACHE="$XDG_CACHE_HOME/starship" export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc" export RBENV_ROOT="$XDG_DATA_HOME/rbenv" +export IRBRC="$XDG_CONFIG_HOME/irb/irbrc" export GPG_TTY=$(tty) diff --git a/bin/put_settings.sh b/bin/put_settings.sh index 5ff0ad29..9dd40178 100755 --- a/bin/put_settings.sh +++ b/bin/put_settings.sh @@ -36,7 +36,7 @@ if [ -d "$SETTINGS_PATH/.vim" ]; then ln -s "$SETTINGS_PATH/.vim" "$XDG_CONFIG_HOME/nvim" fi -for app in "git" "starship" "lsd" "sheldon" "bundle" "readline" "gem" "rspec" "tmux"; do +for app in "git" "starship" "lsd" "sheldon" "bundle" "readline" "gem" "irb" "rspec" "tmux"; do if [ -L "$XDG_CONFIG_HOME/$app" ]; then unlink "$XDG_CONFIG_HOME/$app" fi @@ -68,6 +68,10 @@ for app in "git" "starship" "lsd" "sheldon" "bundle" "readline" "gem" "rspec" "t fi done fi + + if [ "$app" = "irb" ] && [ ! -d "$XDG_DATA_HOME/$app" ]; then + mkdir --parents "$XDG_DATA_HOME/$app" + fi done unset -v app unset -v shell @@ -85,13 +89,6 @@ find "$SETTINGS_PATH"/.* -maxdepth 0 -type f -exec sh -c ' ln -s "$dot_file" "$HOME/$dot_filename" ' sh {} \; -if [ -L "$HOME/.irbrc" ]; then - unlink "$HOME/.irbrc" -fi -if [ -f "$GITHUB_REPOSITORIES_PATH/k0kubun/dotfiles/config/.irbrc" ]; then - ln -s "$GITHUB_REPOSITORIES_PATH/k0kubun/dotfiles/config/.irbrc" "$HOME/.irbrc" -fi - if [ -L /etc/my.cnf ]; then sudo unlink /etc/my.cnf fi diff --git a/config/irb/irbrc b/config/irb/irbrc new file mode 100644 index 00000000..41cb5a8e --- /dev/null +++ b/config/irb/irbrc @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +autoload :Base64, 'base64' +autoload :CGI, 'cgi' +autoload :CSV, 'csv' +autoload :Digest, 'digest' +autoload :ERB, 'erb' +autoload :FileUtils, 'fileutils' +autoload :JSON, 'json' +autoload :Pathname, 'pathname' +autoload :Psych, 'psych' +autoload :Ripper, 'ripper' +autoload :SecureRandom, 'securerandom' +autoload :Shellwords, 'shellwords' +autoload :StringIO, 'stringio' +autoload :URI, 'uri/generic' # `autoload :URI, 'uri'` breaks Rails +autoload :YAML, 'yaml' +autoload :Zlib, 'zlib' + +IRB.conf[:USE_AUTOCOMPLETE] = false +IRB.conf[:SAVE_HISTORY] = 1000 +IRB.conf[:HISTORY_FILE] = File.join(ENV['XDG_DATA_HOME'], 'irb', 'history') +if defined?(IRB::Color) # just for consistency + clear = "\e[0m" + bold = "\e[1m" + green = "\e[32m" + blue = "\e[34m" + cyan = "\e[36m" + IRB.conf[:PROMPT][:DEFAULT] = { + PROMPT_I: "#{cyan}#{bold}%N#{clear}(#{green}#{bold}%m#{clear})[#{blue}%02n#{clear}:%i]> ", + PROMPT_N: "#{cyan}#{bold}%N#{clear}(#{green}#{bold}%m#{clear})[#{blue}%02n#{clear}:%i]> ", + PROMPT_S: "#{cyan}#{bold}%N#{clear}(#{green}#{bold}%m#{clear})[#{blue}%02n#{clear}:%i]%l ", + PROMPT_C: "#{cyan}#{bold}%N#{clear}(#{green}#{bold}%m#{clear})[#{blue}%02n#{clear}:%i]* ", + RETURN: "=> %s\n", + } +end From 9d026317b597797078ce4dfee0fbfbe2f1050b0b Mon Sep 17 00:00:00 2001 From: machupicchubeta Date: Sun, 29 Oct 2023 17:25:38 +0900 Subject: [PATCH 11/17] Move Rustup and Cargo config file under XDG Base Directory Refs. - https://rust-lang.github.io/rustup/environment-variables.html - https://doc.rust-lang.org/cargo/reference/environment-variables.html See also: - https://wiki.archlinux.org/title/XDG_Base_Directory#Partial - https://github.com/rust-lang/rustup/issues/247 - https://github.com/rust-lang/cargo/issues/1734 - https://github.com/rust-lang/rfcs/pull/1615 - https://github.com/rust-lang/cargo/pull/5183 - https://github.com/rust-lang/cargo/pull/148 --- .bash/variables.sh | 16 +++++++++------- .zsh/variables.zsh | 16 +++++++++------- bin/setup_rust.sh | 5 ++++- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/.bash/variables.sh b/.bash/variables.sh index 8480d4c1..27e034db 100644 --- a/.bash/variables.sh +++ b/.bash/variables.sh @@ -37,8 +37,16 @@ export LESSOPEN="| $HOMEBREW_PREFIX/bin/src-hilite-lesspipe.sh %s" export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 +export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml" +export STARSHIP_CACHE="$XDG_CACHE_HOME/starship" +export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc" +export RBENV_ROOT="$XDG_DATA_HOME/rbenv" +export IRBRC="$XDG_CONFIG_HOME/irb/irbrc" +export RUSTUP_HOME="$XDG_DATA_HOME/rustup" +export CARGO_HOME="$XDG_DATA_HOME/cargo" + export PYENV_ROOT="$HOME/.pyenv" -export PATH="$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$HOME/.cargo/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" +export PATH="$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$CARGO_HOME/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" if [ -n "$(echo $CPU_BRAND | grep -o 'Apple')" -a "$(uname -m)" = "arm64" ]; then export PATH="$PATH:/usr/local/bin" fi @@ -73,10 +81,4 @@ export GUILE_TLS_CERTIFICATE_DIRECTORY="$HOMEBREW_PREFIX/etc/gnutls/" export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$HOMEBREW_PREFIX/opt/openssl@1.1" -export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml" -export STARSHIP_CACHE="$XDG_CACHE_HOME/starship" -export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc" -export RBENV_ROOT="$XDG_DATA_HOME/rbenv" -export IRBRC="$XDG_CONFIG_HOME/irb/irbrc" - export GPG_TTY=$(tty) diff --git a/.zsh/variables.zsh b/.zsh/variables.zsh index 0504775c..9e4e198b 100644 --- a/.zsh/variables.zsh +++ b/.zsh/variables.zsh @@ -40,8 +40,16 @@ export LESSOPEN="| $HOMEBREW_PREFIX/bin/src-hilite-lesspipe.sh %s" export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 +export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml" +export STARSHIP_CACHE="$XDG_CACHE_HOME/starship" +export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc" +export RBENV_ROOT="$XDG_DATA_HOME/rbenv" +export IRBRC="$XDG_CONFIG_HOME/irb/irbrc" +export RUSTUP_HOME="$XDG_DATA_HOME/rustup" +export CARGO_HOME="$XDG_DATA_HOME/cargo" + export PYENV_ROOT="$HOME/.pyenv" -export PATH="$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$HOME/.docker/bin:$HOME/.cargo/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" +export PATH="$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$HOME/.docker/bin:$CARGO_HOME/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" if [ -n "$(echo $CPU_BRAND | grep -o 'Apple')" -a "$(uname -m)" = "arm64" ]; then export PATH="$PATH:/usr/local/bin" fi @@ -81,10 +89,4 @@ export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$HOMEBREW_PREFIX/opt/openssl@1.1" export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#F2E6D4,bg=#7E87D6,bold,underline" -export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml" -export STARSHIP_CACHE="$XDG_CACHE_HOME/starship" -export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc" -export RBENV_ROOT="$XDG_DATA_HOME/rbenv" -export IRBRC="$XDG_CONFIG_HOME/irb/irbrc" - export GPG_TTY=$(tty) diff --git a/bin/setup_rust.sh b/bin/setup_rust.sh index 53fd753c..25b52571 100755 --- a/bin/setup_rust.sh +++ b/bin/setup_rust.sh @@ -1,8 +1,11 @@ #!/bin/bash set -eu +: "${XDG_DATA_HOME:=$HOME/.local/share}" +: "${CARGO_HOME:=$XDG_DATA_HOME/cargo}" + # if [[ ! -d "$HOME/.cargo/bin" ]]; then RUSTUP_INIT_SKIP_PATH_CHECK=yes rustup-init -y --no-modify-path --default-host x86_64-apple-darwin --default-toolchain stable --profile default; fi -if [[ ! -d "$HOME/.cargo/bin" ]]; then RUSTUP_INIT_SKIP_PATH_CHECK=yes rustup-init -y --no-update-default-toolchain --no-modify-path; fi +if [[ ! -d "$CARGO_HOME/bin" ]]; then RUSTUP_INIT_SKIP_PATH_CHECK=yes rustup-init -y --no-update-default-toolchain --no-modify-path; fi rustup update if [ "$(uname -m)" = "x86_64" ]; then From bdb729430c38200b96a9b2104642b2a04c60fca6 Mon Sep 17 00:00:00 2001 From: machupicchubeta Date: Sun, 29 Oct 2023 17:58:09 +0900 Subject: [PATCH 12/17] Change the z datafile path under XDG Base Directory Refs. - https://github.com/rupa/z/blob/b82ac78a2d4457d2ca09973332638f123f065fd1/README See also: - https://github.com/rupa/z/issues/267 - https://wiki.archlinux.org/title/XDG_Base_Directory#Partial --- .bash/variables.sh | 1 + .zsh/variables.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/.bash/variables.sh b/.bash/variables.sh index 27e034db..224dfe04 100644 --- a/.bash/variables.sh +++ b/.bash/variables.sh @@ -44,6 +44,7 @@ export RBENV_ROOT="$XDG_DATA_HOME/rbenv" export IRBRC="$XDG_CONFIG_HOME/irb/irbrc" export RUSTUP_HOME="$XDG_DATA_HOME/rustup" export CARGO_HOME="$XDG_DATA_HOME/cargo" +export _Z_DATA="$XDG_DATA_HOME/z/data" export PYENV_ROOT="$HOME/.pyenv" export PATH="$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$CARGO_HOME/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" diff --git a/.zsh/variables.zsh b/.zsh/variables.zsh index 9e4e198b..8a3c3362 100644 --- a/.zsh/variables.zsh +++ b/.zsh/variables.zsh @@ -47,6 +47,7 @@ export RBENV_ROOT="$XDG_DATA_HOME/rbenv" export IRBRC="$XDG_CONFIG_HOME/irb/irbrc" export RUSTUP_HOME="$XDG_DATA_HOME/rustup" export CARGO_HOME="$XDG_DATA_HOME/cargo" +export _Z_DATA="$XDG_DATA_HOME/z/data" export PYENV_ROOT="$HOME/.pyenv" export PATH="$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$HOME/.docker/bin:$CARGO_HOME/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" From 701cb08b3a5a478e17eaa055639b6c57df20166e Mon Sep 17 00:00:00 2001 From: machupicchubeta Date: Sun, 29 Oct 2023 18:15:34 +0900 Subject: [PATCH 13/17] Change NODENV_ROOT under XDG Base Directory Refs. - https://github.com/nodenv/nodenv/blob/15375bb6d6b5215a47c56cdd8bf347d4f360bf34/README.md#environment-variables See also: - https://wiki.archlinux.org/title/XDG_Base_Directory#Partial --- .bash/variables.sh | 1 + .zsh/variables.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/.bash/variables.sh b/.bash/variables.sh index 224dfe04..5e3638b1 100644 --- a/.bash/variables.sh +++ b/.bash/variables.sh @@ -45,6 +45,7 @@ export IRBRC="$XDG_CONFIG_HOME/irb/irbrc" export RUSTUP_HOME="$XDG_DATA_HOME/rustup" export CARGO_HOME="$XDG_DATA_HOME/cargo" export _Z_DATA="$XDG_DATA_HOME/z/data" +export NODENV_ROOT="$XDG_DATA_HOME/nodenv" export PYENV_ROOT="$HOME/.pyenv" export PATH="$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$CARGO_HOME/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" diff --git a/.zsh/variables.zsh b/.zsh/variables.zsh index 8a3c3362..03e64aba 100644 --- a/.zsh/variables.zsh +++ b/.zsh/variables.zsh @@ -48,6 +48,7 @@ export IRBRC="$XDG_CONFIG_HOME/irb/irbrc" export RUSTUP_HOME="$XDG_DATA_HOME/rustup" export CARGO_HOME="$XDG_DATA_HOME/cargo" export _Z_DATA="$XDG_DATA_HOME/z/data" +export NODENV_ROOT="$XDG_DATA_HOME/nodenv" export PYENV_ROOT="$HOME/.pyenv" export PATH="$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$HOME/.docker/bin:$CARGO_HOME/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" From 69bbec4160bb57fde63471220260dd2241d9f50c Mon Sep 17 00:00:00 2001 From: machupicchubeta Date: Sun, 29 Oct 2023 18:22:13 +0900 Subject: [PATCH 14/17] Move PYENV_ROOT under XDG Base Directory Refs. - https://github.com/pyenv/pyenv/blob/54f7a7c0464f4feb3ba61cfee72fc14db802f98f/README.md#environment-variables See also: - https://github.com/pyenv/pyenv/issues/139 - https://github.com/pyenv/pyenv/issues/1789 - https://wiki.archlinux.org/title/XDG_Base_Directory#Partial --- .bash/variables.sh | 2 +- .zsh/variables.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.bash/variables.sh b/.bash/variables.sh index 5e3638b1..0caf7e8e 100644 --- a/.bash/variables.sh +++ b/.bash/variables.sh @@ -46,8 +46,8 @@ export RUSTUP_HOME="$XDG_DATA_HOME/rustup" export CARGO_HOME="$XDG_DATA_HOME/cargo" export _Z_DATA="$XDG_DATA_HOME/z/data" export NODENV_ROOT="$XDG_DATA_HOME/nodenv" +export PYENV_ROOT="$XDG_DATA_HOME/pyenv" -export PYENV_ROOT="$HOME/.pyenv" export PATH="$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$CARGO_HOME/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" if [ -n "$(echo $CPU_BRAND | grep -o 'Apple')" -a "$(uname -m)" = "arm64" ]; then export PATH="$PATH:/usr/local/bin" diff --git a/.zsh/variables.zsh b/.zsh/variables.zsh index 03e64aba..a9b68724 100644 --- a/.zsh/variables.zsh +++ b/.zsh/variables.zsh @@ -49,8 +49,8 @@ export RUSTUP_HOME="$XDG_DATA_HOME/rustup" export CARGO_HOME="$XDG_DATA_HOME/cargo" export _Z_DATA="$XDG_DATA_HOME/z/data" export NODENV_ROOT="$XDG_DATA_HOME/nodenv" +export PYENV_ROOT="$XDG_DATA_HOME/pyenv" -export PYENV_ROOT="$HOME/.pyenv" export PATH="$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$HOME/.docker/bin:$CARGO_HOME/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" if [ -n "$(echo $CPU_BRAND | grep -o 'Apple')" -a "$(uname -m)" = "arm64" ]; then export PATH="$PATH:/usr/local/bin" From 656627501804e47a85d5669f1a59356f83379289 Mon Sep 17 00:00:00 2001 From: machupicchubeta Date: Sun, 29 Oct 2023 18:57:36 +0900 Subject: [PATCH 15/17] Move GOENV_ROOT and GOENV_GOPATH_PREFIX under XDG Base Directory Refs. - https://github.com/go-nv/goenv/blob/56c9dec4e8184f16b4af886134b44b9eb2edf9b7/ENVIRONMENT_VARIABLES.md In addition, I added `GOENV_ROOT/shims` to the PATH environment variable to give preference to Go installed with goenv over Homebrew. For example, rbenv, nodenv, and pyenv add their respective `shims` directories to the top of the PATH environment variable, but goenv did not, and only Go installed with Homebrew was found. --- .bash/variables.sh | 4 +++- .zsh/variables.zsh | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.bash/variables.sh b/.bash/variables.sh index 0caf7e8e..75dde8d8 100644 --- a/.bash/variables.sh +++ b/.bash/variables.sh @@ -47,8 +47,10 @@ export CARGO_HOME="$XDG_DATA_HOME/cargo" export _Z_DATA="$XDG_DATA_HOME/z/data" export NODENV_ROOT="$XDG_DATA_HOME/nodenv" export PYENV_ROOT="$XDG_DATA_HOME/pyenv" +export GOENV_ROOT="$XDG_DATA_HOME/goenv" +export GOENV_GOPATH_PREFIX="$XDG_DATA_HOME/goenv/modules" -export PATH="$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$CARGO_HOME/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" +export PATH="$GOENV_ROOT/shims:$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$CARGO_HOME/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" if [ -n "$(echo $CPU_BRAND | grep -o 'Apple')" -a "$(uname -m)" = "arm64" ]; then export PATH="$PATH:/usr/local/bin" fi diff --git a/.zsh/variables.zsh b/.zsh/variables.zsh index a9b68724..8c2552fc 100644 --- a/.zsh/variables.zsh +++ b/.zsh/variables.zsh @@ -50,8 +50,10 @@ export CARGO_HOME="$XDG_DATA_HOME/cargo" export _Z_DATA="$XDG_DATA_HOME/z/data" export NODENV_ROOT="$XDG_DATA_HOME/nodenv" export PYENV_ROOT="$XDG_DATA_HOME/pyenv" +export GOENV_ROOT="$XDG_DATA_HOME/goenv" +export GOENV_GOPATH_PREFIX="$XDG_DATA_HOME/goenv/modules" -export PATH="$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$HOME/.docker/bin:$CARGO_HOME/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" +export PATH="$GOENV_ROOT/shims:$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$HOME/.docker/bin:$CARGO_HOME/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" if [ -n "$(echo $CPU_BRAND | grep -o 'Apple')" -a "$(uname -m)" = "arm64" ]; then export PATH="$PATH:/usr/local/bin" fi From e88ae89a54d51cd8c8e4200fe365ec4307c2f8ae Mon Sep 17 00:00:00 2001 From: machupicchubeta Date: Sun, 29 Oct 2023 21:07:18 +0900 Subject: [PATCH 16/17] Move Rustup completion scripts under XDG Base Directory Refs. - https://rust-lang.github.io/rustup/installation/index.html#enable-tab-completion-for-bash-fish-zsh-or-powershell --- .zsh/completions.zsh | 5 ++++- bin/setup_rust.sh | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.zsh/completions.zsh b/.zsh/completions.zsh index e5cc89be..3f451c2a 100644 --- a/.zsh/completions.zsh +++ b/.zsh/completions.zsh @@ -4,7 +4,10 @@ elif [ "$(uname -m)" = "arm64" ]; then : "${HOMEBREW_PREFIX:=/opt/homebrew}" fi -fpath=($HOME/.zfunc $HOMEBREW_PREFIX/opt/zsh-completions/share/zsh-completions $fpath) +: "${XDG_DATA_HOME:=$HOME/.local/share}" +: "${RUSTUP_HOME:=$XDG_DATA_HOME/rustup}" + +fpath=("$RUSTUP_HOME" "$HOMEBREW_PREFIX/opt/zsh-completions/share/zsh-completions" $fpath) _cache_hosts=(`ruby -ne 'if /^Host\s+(.+)$/; print $1.strip, "\n"; end' $HOME/.ssh/config`) autoload -Uz colors diff --git a/bin/setup_rust.sh b/bin/setup_rust.sh index 25b52571..da000a7b 100755 --- a/bin/setup_rust.sh +++ b/bin/setup_rust.sh @@ -2,6 +2,7 @@ set -eu : "${XDG_DATA_HOME:=$HOME/.local/share}" +: "${RUSTUP_HOME:=$XDG_DATA_HOME/rustup}" : "${CARGO_HOME:=$XDG_DATA_HOME/cargo}" # if [[ ! -d "$HOME/.cargo/bin" ]]; then RUSTUP_INIT_SKIP_PATH_CHECK=yes rustup-init -y --no-modify-path --default-host x86_64-apple-darwin --default-toolchain stable --profile default; fi @@ -13,6 +14,6 @@ if [ "$(uname -m)" = "x86_64" ]; then elif [ "$(uname -m)" = "arm64" ]; then : "${HOMEBREW_PREFIX:=/opt/homebrew}" fi -if [[ ! -f $HOMEBREW_PREFIX/etc/bash_completion.d/rustup.bash-completion ]]; then rustup completions bash > $HOMEBREW_PREFIX/etc/bash_completion.d/rustup.bash-completion; fi -if [[ ! -d "$HOME/.zfunc" ]]; then mkdir -p "$HOME/.zfunc"; fi -if [[ ! -f $HOME/.zfunc/_rustup ]]; then rustup completions zsh > $HOME/.zfunc/_rustup; fi +if [[ ! -f "$HOMEBREW_PREFIX/etc/bash_completion.d/rustup.bash-completion" ]]; then rustup completions bash > "$HOMEBREW_PREFIX/etc/bash_completion.d/rustup.bash-completion"; fi +if [[ ! -d "$RUSTUP_HOME" ]]; then mkdir -p "$RUSTUP_HOME"; fi +if [[ ! -f "$RUSTUP_HOME/completions" ]]; then rustup completions zsh > "$RUSTUP_HOME/completions"; fi From 75657851ad97232fe9e145b91c28c8d79050f0fd Mon Sep 17 00:00:00 2001 From: machupicchubeta Date: Sun, 29 Oct 2023 21:26:07 +0900 Subject: [PATCH 17/17] Move ENHANCD_DIR under XDG Base Directory Refs. - https://github.com/babarot/enhancd/blob/230695f8da8463b18121f58d748851a67be19a00/README.md#configuration --- .bash/variables.sh | 1 + .zsh/variables.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/.bash/variables.sh b/.bash/variables.sh index 75dde8d8..4acbf95c 100644 --- a/.bash/variables.sh +++ b/.bash/variables.sh @@ -49,6 +49,7 @@ export NODENV_ROOT="$XDG_DATA_HOME/nodenv" export PYENV_ROOT="$XDG_DATA_HOME/pyenv" export GOENV_ROOT="$XDG_DATA_HOME/goenv" export GOENV_GOPATH_PREFIX="$XDG_DATA_HOME/goenv/modules" +export ENHANCD_DIR="$XDG_DATA_HOME/enhancd" export PATH="$GOENV_ROOT/shims:$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$CARGO_HOME/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" if [ -n "$(echo $CPU_BRAND | grep -o 'Apple')" -a "$(uname -m)" = "arm64" ]; then diff --git a/.zsh/variables.zsh b/.zsh/variables.zsh index 8c2552fc..2c0efc8c 100644 --- a/.zsh/variables.zsh +++ b/.zsh/variables.zsh @@ -52,6 +52,7 @@ export NODENV_ROOT="$XDG_DATA_HOME/nodenv" export PYENV_ROOT="$XDG_DATA_HOME/pyenv" export GOENV_ROOT="$XDG_DATA_HOME/goenv" export GOENV_GOPATH_PREFIX="$XDG_DATA_HOME/goenv/modules" +export ENHANCD_DIR="$XDG_DATA_HOME/enhancd" export PATH="$GOENV_ROOT/shims:$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$HOME/.docker/bin:$CARGO_HOME/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" if [ -n "$(echo $CPU_BRAND | grep -o 'Apple')" -a "$(uname -m)" = "arm64" ]; then