2022-12-01 20:53:42 -08:00
|
|
|
|
#!/usr/bin/env sh
|
2023-04-15 19:11:31 -07:00
|
|
|
|
# @file Shared Profile
|
2023-04-12 18:44:59 -07:00
|
|
|
|
# @brief Main shell profile that is used to combine the shared profile configurations that are used by both the `~/.bashrc` and `~/.zshrc` files
|
|
|
|
|
# @description
|
|
|
|
|
# This script is included by `~/.bashrc` and `~/.zshrc` to include imports and settings that are common to both the Bash
|
|
|
|
|
# and ZSH shells.
|
2022-12-01 20:53:42 -08:00
|
|
|
|
|
2022-11-21 20:25:30 -08:00
|
|
|
|
# shellcheck disable=SC1090,SC1091
|
|
|
|
|
|
|
|
|
|
# Aliases / Functions / Exports
|
2022-11-22 16:15:36 -08:00
|
|
|
|
export XDG_CONFIG_HOME="$HOME/.config"
|
2022-12-01 20:53:42 -08:00
|
|
|
|
if [ -f "$XDG_CONFIG_HOME/shell/exports.sh" ]; then
|
|
|
|
|
. "$XDG_CONFIG_HOME/shell/exports.sh"
|
2022-11-21 20:25:30 -08:00
|
|
|
|
fi
|
2022-12-01 20:53:42 -08:00
|
|
|
|
if [ -f "$XDG_CONFIG_HOME/shell/aliases.sh" ]; then
|
|
|
|
|
. "$XDG_CONFIG_HOME/shell/aliases.sh"
|
2022-11-21 20:25:30 -08:00
|
|
|
|
fi
|
2022-12-01 20:53:42 -08:00
|
|
|
|
if [ -f "$XDG_CONFIG_HOME/shell/functions.sh" ]; then
|
|
|
|
|
. "$XDG_CONFIG_HOME/shell/functions.sh"
|
2022-11-21 20:25:30 -08:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
### Bash / ZSH
|
|
|
|
|
if [ "$BASH_SUPPORT" = 'true' ]; then
|
|
|
|
|
### OS Detection
|
|
|
|
|
if [ -f /etc/os-release ]; then
|
|
|
|
|
. /etc/os-release
|
|
|
|
|
if [ "$ID" = 'alpine' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'arch' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'centos' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'coreos' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'debian' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'deepin' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'elementary' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'endeavour' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'freebsd' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'gentoo' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'kali' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'linuxmint' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'manjaro' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'nixos' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'openbsd' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'opensuse' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'parrot' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'pop_os' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'raspberry_pi' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'redhat' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'fedora' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
elif [ "$ID" = 'ubuntu' ]; then
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
else
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
if [ -d /Applications ] && [ -d /Library ] && [ -d /System ]; then
|
|
|
|
|
# macOS
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
else
|
|
|
|
|
OS_ICON=""
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
### ASDF
|
|
|
|
|
if [ -f "$ASDF_DIR/asdf.sh" ]; then
|
|
|
|
|
. "$ASDF_DIR/asdf.sh"
|
|
|
|
|
fi
|
Update dotfiles/.bashrc, dotfiles/.local/share/chezmoi/dot_bashrc.tmpl, dotfiles/.local/share/chezmoi/dot_ssh/private_id_rsa.tmpl, dotfiles/.local/share/chezmoi/dot_ssh/id_rsa.pub, dotfiles/.local/share/chezmoi/dot_ssh/authorized_keys.github.tmpl, dotfiles/.local/share/chezmoi/private_dot_config/brew/Brewfile.tmpl, dotfiles/.local/share/chezmoi/.chezmoidata.yaml, dotfiles/.local/share/chezmoi/private_dot_config/oh-my-posh/Betelgeuse.omp.json, dotfiles/.local/share/chezmoi/private_dot_config/oh-my-posh/Betelgeuse-minimal.omp.json, dotfiles/.local/share/chezmoi/private_dot_config/powershell/user_profile.ps1, dotfiles/.local/share/chezmoi/dot_profile.tmpl, dotfiles/.local/share/chezmoi/private_dot_config/mimeapps.list, dotfiles/.local/share/chezmoi/private_dot_config/chromium-flags.conf, dotfiles/.local/share/chezmoi/private_dot_config/pgcli/config, dotfiles/.local/share/chezmoi/private_dot_config/private_Code/User/settings.json, dotfiles/.local/share/chezmoi/private_dot_config/private_Code/User/extensions.json, dotfiles/.vscode/settings.json, dotfiles/.local/share/chezmoi/private_dot_config/private_Code/User/extensions/theme-betelgeuse-vscode/themes/themer-dark-color-theme.json, dotfiles/.local/share/chezmoi/private_dot_config/private_Code/User/extensions/theme-betelgeuse-vscode/themes/themer-light-color-theme.json, dotfiles/.local/share/chezmoi/private_dot_config/private_Code/User/extensions/theme-betelgeuse-vscode/README.md, dotfiles/.local/share/chezmoi/private_dot_config/private_Code/User/extensions/theme-betelgeuse-vscode/icon.svg, dotfiles/.local/share/chezmoi/private_dot_config/private_Code/User/extensions/theme-betelgeuse-vscode/package.json
Deleted dotfiles/.local/share/chezmoi/private_dot_config/powershell/takuya.omp.json
2022-11-22 02:33:57 -08:00
|
|
|
|
|
|
|
|
|
### Directory Colors
|
2022-11-22 07:30:02 -08:00
|
|
|
|
if [ -f "$XDG_CONFIG_HOME/shell/lscolors.sh" ]; then
|
|
|
|
|
. "$XDG_CONFIG_HOME/shell/lscolors.sh"
|
|
|
|
|
fi
|
2022-11-21 20:25:30 -08:00
|
|
|
|
|
2022-11-22 10:02:44 -08:00
|
|
|
|
### fzf-git
|
2022-11-30 01:25:58 -08:00
|
|
|
|
#if [ -f "$HOME/.local/scripts/fzf-git.bash" ]; then
|
|
|
|
|
# . "$HOME/.local/scripts/fzf-git.bash"
|
|
|
|
|
#fi
|
2022-11-22 10:02:44 -08:00
|
|
|
|
|
2022-12-06 14:56:58 -08:00
|
|
|
|
### git-fuzzy
|
|
|
|
|
if [ -d "$HOME/.local/src/git-fuzzy/bin" ]; then
|
|
|
|
|
export PATH="$HOME/.local/src/git-fuzzy/bin:$PATH"
|
|
|
|
|
fi
|
|
|
|
|
|
2022-11-22 07:30:02 -08:00
|
|
|
|
### MOTD
|
2022-12-01 20:53:42 -08:00
|
|
|
|
if [ -f "$XDG_CONFIG_HOME/shell/motd.sh" ]; then
|
|
|
|
|
. "$XDG_CONFIG_HOME/shell/motd.sh"
|
2022-11-22 07:30:02 -08:00
|
|
|
|
fi
|
|
|
|
|
fi
|
2022-11-21 20:25:30 -08:00
|
|
|
|
|
|
|
|
|
### Cargo
|
|
|
|
|
if [ -f "$CARGO_HOME/env" ]; then
|
|
|
|
|
. "$CARGO_HOME/env"
|
|
|
|
|
fi
|
|
|
|
|
|
2022-11-22 10:02:44 -08:00
|
|
|
|
### Docker Functions / Aliases
|
2022-12-24 08:23:35 -08:00
|
|
|
|
# This file is used as an example file since it conflicts with the installation process of many libraries.
|
|
|
|
|
# Also, using Firejail is the preferred method of limiting the permissions of a process so there is no need
|
|
|
|
|
# to use Docker aliases since Firejail is superior (according to: https://news.ycombinator.com/item?id=21497677)
|
|
|
|
|
# if [ -f "$HOME/.local/scripts/docker-functions.bash" ]; then
|
|
|
|
|
# . "$HOME/.local/scripts/docker-functions.bash"
|
|
|
|
|
# fi
|
2022-11-22 10:02:44 -08:00
|
|
|
|
|
|
|
|
|
### fzf-tmux
|
2022-11-30 01:25:58 -08:00
|
|
|
|
#if [ -f "$HOME/.local/scripts/fzf-tmux.bash" ]; then
|
|
|
|
|
# . "$HOME/.local/scripts/fzf-tmux.bash"
|
|
|
|
|
#fi
|
2022-11-22 10:02:44 -08:00
|
|
|
|
|
2023-06-22 23:03:27 -07:00
|
|
|
|
### iTerm2
|
|
|
|
|
if [ -f "$HOME/.local/src/iterm2/shell-integration.sh" ]; then
|
|
|
|
|
source "$HOME/.local/src/iterm2/shell-integration.sh"
|
|
|
|
|
fi
|
|
|
|
|
|
2023-05-22 12:11:13 -07:00
|
|
|
|
### McFly
|
|
|
|
|
export MCFLY_PROMPT="❯"
|
|
|
|
|
if [ -d /Applications ] && [ -d /System ]; then
|
|
|
|
|
if [[ "$(defaults read -g AppleInterfaceStyle 2&>/dev/null)" != "Dark" ]]; then
|
|
|
|
|
export MCFLY_LIGHT=TRUE
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2022-11-21 20:25:30 -08:00
|
|
|
|
### SDKMan
|
|
|
|
|
if command -v brew > /dev/null && command -v sdkman-cli > /dev/null; then
|
|
|
|
|
export SDKMAN_DIR="$(brew --prefix sdkman-cli)/libexec"
|
|
|
|
|
. "$SDKMAN_DIR/bin/sdkman-init.sh"
|
|
|
|
|
elif [ -f "$SDKMAN_DIR/bin/sdkman-init.sh" ]; then
|
|
|
|
|
export SDKMAN_DIR="$XDG_DATA_HOME/sdkman"
|
|
|
|
|
. "$SDKMAN_DIR/bin/sdkman-init.sh"
|
|
|
|
|
fi
|
Update dotfiles/.local/share/chezmoi/private_dot_config/Brewfile.tmpl, dotfiles/.local/share/chezmoi/private_dot_config/fd/ignore, dotfiles/.local/share/chezmoi/private_dot_config/git/ignore, dotfiles/.local/share/chezmoi/private_dot_config/git/config.tmpl, dotfiles/.local/share/chezmoi/private_dot_config/k9s/plugin.yml, dotfiles/.local/share/chezmoi/private_dot_config/shell/aliases, dotfiles/.local/share/chezmoi/private_dot_config/shell/functions, dotfiles/.local/share/chezmoi/private_dot_config/shell/exports.sh, dotfiles/.local/share/chezmoi/private_dot_config/asdf/default-npm-packages, dotfiles/.profile, dotfiles/.local/share/chezmoi/private_dot_config/shell/motd, dotfiles/.bash_profile, dotfiles/.bashrc, dotfiles/.zshrc, dotfiles/.local/share/chezmoi/private_dot_config/ripgrep/config, dotfiles/.local/share/chezmoi/private_dot_config/readline/inputrc, dotfiles/.local/share/chezmoi/private_dot_config/pg/.gitkeep, dotfiles/.local/share/chezmoi/private_dot_config/putty/.gitkeep, dotfiles/.npmrc, dotfiles/.local/share/chezmoi/private_dot_config/npm/npmrc.tmpl, dotfiles/.local/share/chezmoi/dot_local/state/bash/.gitkeep, dotfiles/.local/share/chezmoi/dot_vim/vimrc, dotfiles/.local/share/chezmoi/dot_profile.tmpl
2022-11-21 20:00:41 -08:00
|
|
|
|
|
2023-06-13 11:24:24 -07:00
|
|
|
|
### Tea
|
2023-06-13 22:08:18 -07:00
|
|
|
|
# TODO: Fix this so it does not cause errors as Chezmoi runs
|
|
|
|
|
# if command -v tea > /dev/null; then
|
|
|
|
|
# source <(tea --magic)
|
|
|
|
|
# fi
|
2023-06-13 11:24:24 -07:00
|
|
|
|
|
Update dotfiles/.local/share/chezmoi/private_dot_config/Brewfile.tmpl, dotfiles/.local/share/chezmoi/private_dot_config/fd/ignore, dotfiles/.local/share/chezmoi/private_dot_config/git/ignore, dotfiles/.local/share/chezmoi/private_dot_config/git/config.tmpl, dotfiles/.local/share/chezmoi/private_dot_config/k9s/plugin.yml, dotfiles/.local/share/chezmoi/private_dot_config/shell/aliases, dotfiles/.local/share/chezmoi/private_dot_config/shell/functions, dotfiles/.local/share/chezmoi/private_dot_config/shell/exports.sh, dotfiles/.local/share/chezmoi/private_dot_config/asdf/default-npm-packages, dotfiles/.profile, dotfiles/.local/share/chezmoi/private_dot_config/shell/motd, dotfiles/.bash_profile, dotfiles/.bashrc, dotfiles/.zshrc, dotfiles/.local/share/chezmoi/private_dot_config/ripgrep/config, dotfiles/.local/share/chezmoi/private_dot_config/readline/inputrc, dotfiles/.local/share/chezmoi/private_dot_config/pg/.gitkeep, dotfiles/.local/share/chezmoi/private_dot_config/putty/.gitkeep, dotfiles/.npmrc, dotfiles/.local/share/chezmoi/private_dot_config/npm/npmrc.tmpl, dotfiles/.local/share/chezmoi/dot_local/state/bash/.gitkeep, dotfiles/.local/share/chezmoi/dot_vim/vimrc, dotfiles/.local/share/chezmoi/dot_profile.tmpl
2022-11-21 20:00:41 -08:00
|
|
|
|
### VIM
|
|
|
|
|
export GVIMINIT='let $MYGVIMRC="$XDG_CONFIG_HOME/vim/gvimrc" | source $MYGVIMRC'
|
|
|
|
|
export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC'
|
2023-05-06 18:39:55 -07:00
|
|
|
|
|
|
|
|
|
### NVIM
|
|
|
|
|
VIM_NEOVIM_INTEGRATION='vim.cmd([[
|
|
|
|
|
set runtimepath^=~/.vim runtimepath+=~/.vim/after
|
|
|
|
|
let &packpath = &runtimepath
|
|
|
|
|
source ~/.vimrc
|
|
|
|
|
]])'
|
|
|
|
|
if command -v nvim > /dev/null && cat ~/.config/nvim/init.lua | grep 'set runtimepath^=~/.vim runtimepath+=~/.vim/after' > /dev/null; then
|
|
|
|
|
### Setup Neovim to work with Vim setup and plugins
|
|
|
|
|
echo -e "$VIM_NEOVIM_INTEGRATION\n$(cat ~/.config/nvim/init.lua)" > ~/.config/nvim/init.lua || echo ''
|
|
|
|
|
if -d ~/.var/app/io.neovim.nvim/config/nvim; then
|
|
|
|
|
echo -e "$VIM_NEOVIM_INTEGRATION\n$(cat ~/.var/app/io.neovim.nvim/config/nvim/init.lua)" > ~/.var/app/io.neovim.nvim/config/nvim/init.lua || echo ''
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
unset VIM_NEOVIM_INTEGRATION
|