diff --git a/.bash/variables.sh b/.bash/variables.sh index a0a469a4..4acbf95c 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 @@ -24,8 +37,21 @@ export LESSOPEN="| $HOMEBREW_PREFIX/bin/src-hilite-lesspipe.sh %s" export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 -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 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 _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 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 export PATH="$PATH:/usr/local/bin" fi @@ -49,11 +75,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 @@ -65,6 +86,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 GPG_TTY=$(tty) 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/.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/.zsh/variables.zsh b/.zsh/variables.zsh index 12200523..2c0efc8c 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)" @@ -27,8 +40,21 @@ export LESSOPEN="| $HOMEBREW_PREFIX/bin/src-hilite-lesspipe.sh %s" export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 -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 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 _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 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 export PATH="$PATH:/usr/local/bin" fi @@ -53,12 +79,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" 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) @@ -74,6 +94,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 GPG_TTY=$(tty) 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 f01f4999..9dd40178 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"; 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 @@ -48,23 +49,33 @@ for app in "git" "starship" "lsd" "sheldon"; do if [ "$app" = "sheldon" ]; then for shell in "bash" "zsh"; do - if [ -L "$XDG_CONFIG_HOME/$app"_"$shell" ]; then - unlink "$XDG_CONFIG_HOME/$app"_"$shell" + if [ ! -d "$XDG_DATA_HOME/$app/$shell" ]; then + mkdir --parents "$XDG_DATA_HOME/$app/$shell" fi - if [ -d "$XDG_CONFIG_HOME/$app"_"$shell" ]; then - mv "$XDG_CONFIG_HOME/$app"_"$shell" "$XDG_CONFIG_HOME/$app"_"$shell"_"$timestamp" + 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 "$SETTINGS_PATH/config/$app"_"$shell" ]; then - ln -s "$SETTINGS_PATH/config/$app"_"$shell" "$XDG_CONFIG_HOME/$app"_"$shell" + if [ ! -d "$XDG_DATA_HOME/$app/$arch/plugin" ]; then + mkdir --parents "$XDG_DATA_HOME/$app/$arch/plugin" fi - if [ ! -d "$XDG_DATA_HOME/$app"_"$shell" ]; then - mkdir "$XDG_DATA_HOME/$app"_"$shell" + if [ ! -d "$XDG_CACHE_HOME/$app/$arch" ]; then + mkdir --parents "$XDG_CACHE_HOME/$app/$arch" 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 +unset -v arch find "$SETTINGS_PATH"/.* -maxdepth 0 -type f -exec sh -c ' dot_file=$1 @@ -78,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 @@ -95,17 +99,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/bin/setup_rust.sh b/bin/setup_rust.sh index 53fd753c..da000a7b 100755 --- a/bin/setup_rust.sh +++ b/bin/setup_rust.sh @@ -1,8 +1,12 @@ #!/bin/bash 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 -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 @@ -10,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 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/.gemrc b/config/gem/gemrc similarity index 100% rename from .gemrc rename to config/gem/gemrc 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 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 diff --git a/.inputrc b/config/readline/inputrc similarity index 100% rename from .inputrc rename to config/readline/inputrc diff --git a/.rspec b/config/rspec/options similarity index 100% rename from .rspec rename to config/rspec/options 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 91% rename from config/sheldon_zsh/plugins.toml rename to 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] diff --git a/.tmux.conf b/config/tmux/tmux.conf similarity index 100% rename from .tmux.conf rename to config/tmux/tmux.conf 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