mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-16 08:49:52 +00:00
fix(shell): fixed zsh/bash config loading
This commit is contained in:
28
base/bashrc
28
base/bashrc
@@ -4,34 +4,12 @@
|
|||||||
# Defaults
|
# Defaults
|
||||||
export DOTFILES="$HOME/.dotfiles"
|
export DOTFILES="$HOME/.dotfiles"
|
||||||
export DOTFILES_SHARED_LOADED=""
|
export DOTFILES_SHARED_LOADED=""
|
||||||
|
export DOTFILES_CURRENT_SHELL="bash"
|
||||||
# shellcheck source=scripts/shared.sh
|
# shellcheck source=scripts/shared.sh
|
||||||
source "$DOTFILES/scripts/shared.sh"
|
source "$DOTFILES/scripts/shared.sh"
|
||||||
|
path_prepend "$DOTFILES/local/bin"
|
||||||
|
|
||||||
# Run x-load-configs in your terminal to reload the files.
|
|
||||||
function x-load-configs()
|
|
||||||
{
|
|
||||||
# Load the shell dotfiles, and then some:
|
|
||||||
for file in $DOTFILES/config/{exports,alias,functions}; do
|
|
||||||
HOST="$(hostname -s)"
|
|
||||||
# global (exports|alias|functions) file for all hosts
|
|
||||||
# shellcheck source=../config/exports
|
|
||||||
[ -r "$file" ] && source "$file"
|
|
||||||
# global secret file, git ignored
|
|
||||||
# shellcheck source=../config/exports-secret
|
|
||||||
[ -r "$file-secret" ] && source "$file-secret"
|
|
||||||
# host specific (exports|alias|functions) file
|
|
||||||
# shellcheck source=../config/exports
|
|
||||||
[ -r "$file-$HOST" ] && source "$file-$HOST"
|
|
||||||
# host specific (exports|alias|functions) file, git ignored
|
|
||||||
# shellcheck source=../config/exports
|
|
||||||
[ -r "$file-$HOST-secret" ] && source "$file-$HOST-secret"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
x-load-configs
|
x-load-configs
|
||||||
|
|
||||||
# Import ssh keys in keychain
|
# Import ssh keys in keychain
|
||||||
ssh-add -A 2> /dev/null
|
ssh-add -A 2>/dev/null
|
||||||
|
|
||||||
# shellcheck source=../config/fzf/fzf.bash
|
|
||||||
[ -f "${DOTFILES}/config/fzf/fzf.bash" ] \
|
|
||||||
&& source "${DOTFILES}/config/fzf/fzf.bash"
|
|
||||||
|
|||||||
23
base/zshrc
23
base/zshrc
@@ -3,32 +3,13 @@
|
|||||||
|
|
||||||
# Defaults
|
# Defaults
|
||||||
export DOTFILES="$HOME/.dotfiles"
|
export DOTFILES="$HOME/.dotfiles"
|
||||||
export DOTFILES_SHARED_LOADED=""
|
export DOTFILES_CURRENT_SHELL="zsh"
|
||||||
# shellcheck source=scripts/shared.sh
|
# shellcheck source=scripts/shared.sh
|
||||||
source "$DOTFILES/scripts/shared.sh"
|
source "$DOTFILES/scripts/shared.sh"
|
||||||
|
path_prepend "$DOTFILES/local/bin"
|
||||||
|
|
||||||
export COMPLETION_WAITING_DOTS=true
|
export COMPLETION_WAITING_DOTS=true
|
||||||
|
|
||||||
# Run x-load-configs in your terminal to reload the files.
|
|
||||||
function x-load-configs()
|
|
||||||
{
|
|
||||||
# Load the shell dotfiles, and then some:
|
|
||||||
for file in $DOTFILES/config/{exports,alias,functions}; do
|
|
||||||
HOST="$(hostname -s)"
|
|
||||||
# global (exports|alias|functions) file for all hosts
|
|
||||||
# shellcheck source=../config/exports
|
|
||||||
[ -r "$file" ] && source "$file"
|
|
||||||
# global secret file, git ignored
|
|
||||||
# shellcheck source=../config/exports-secret
|
|
||||||
[ -r "$file-secret" ] && source "$file-secret"
|
|
||||||
# host specific (exports|alias|functions) file
|
|
||||||
# shellcheck source=../config/exports
|
|
||||||
[ -r "$file-$HOST" ] && source "$file-$HOST"
|
|
||||||
# host specific (exports|alias|functions) file, git ignored
|
|
||||||
# shellcheck source=../config/exports
|
|
||||||
[ -r "$file-$HOST-secret" ] && source "$file-$HOST-secret"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
x-load-configs
|
x-load-configs
|
||||||
|
|
||||||
export ZSH_CUSTOM_COMPLETION_PATH="$XDG_CONFIG_HOME/zsh/completion"
|
export ZSH_CUSTOM_COMPLETION_PATH="$XDG_CONFIG_HOME/zsh/completion"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
export DOTFILES="$HOME/.dotfiles"
|
export DOTFILES="$HOME/.dotfiles"
|
||||||
source "$DOTFILES/scripts/shared.sh"
|
source "$DOTFILES/scripts/shared.sh"
|
||||||
path_append "$DOTFILES/local/bin"
|
path_prepend "$DOTFILES/local/bin"
|
||||||
|
|
||||||
# Explicitly set XDG folders
|
# Explicitly set XDG folders
|
||||||
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||||
@@ -21,7 +21,7 @@ path_append "/opt/homebrew/bin"
|
|||||||
have brew && eval "$(brew shellenv)"
|
have brew && eval "$(brew shellenv)"
|
||||||
|
|
||||||
path_append "/usr/local/bin"
|
path_append "/usr/local/bin"
|
||||||
path_append "$XDG_BIN_HOME"
|
path_prepend "$XDG_BIN_HOME"
|
||||||
|
|
||||||
source "$DOTFILES/config/exports-shell"
|
source "$DOTFILES/config/exports-shell"
|
||||||
source "$DOTFILES/config/exports-apps"
|
source "$DOTFILES/config/exports-apps"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# shellcheck enable=external-sources
|
# shellcheck enable=external-sources
|
||||||
# shellcheck disable=1091,2139
|
# shellcheck disable=1091,2139
|
||||||
# vim: filetype=zsh
|
# vim: filetype=bash
|
||||||
|
|
||||||
export DOTFILES="$HOME/.dotfiles"
|
export DOTFILES="$HOME/.dotfiles"
|
||||||
source "$DOTFILES/scripts/shared.sh"
|
source "$DOTFILES/scripts/shared.sh"
|
||||||
@@ -74,8 +74,10 @@ have node && {
|
|||||||
# op (1Password cli) is present
|
# op (1Password cli) is present
|
||||||
export OP_CACHE="$XDG_STATE_HOME/1password"
|
export OP_CACHE="$XDG_STATE_HOME/1password"
|
||||||
have op && {
|
have op && {
|
||||||
eval "$(op completion zsh)"
|
[ "$DOTFILES_CURRENT_SHELL" = "zsh" ] && {
|
||||||
compdef _op op
|
eval "$(op completion zsh)"
|
||||||
|
compdef _op op
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Python
|
# Python
|
||||||
@@ -99,7 +101,10 @@ export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME"/bundle
|
|||||||
export RBENV_ROOT="$XDG_STATE_HOME/rbenv"
|
export RBENV_ROOT="$XDG_STATE_HOME/rbenv"
|
||||||
x-dc "$RBENV_ROOT"
|
x-dc "$RBENV_ROOT"
|
||||||
have gem && path_append "${GEM_HOME}/bin"
|
have gem && path_append "${GEM_HOME}/bin"
|
||||||
have rbenv && eval "$(rbenv init - zsh)"
|
have rbenv && {
|
||||||
|
[ "$DOTFILES_CURRENT_SHELL" = "zsh" ] && eval "$(rbenv init - zsh)"
|
||||||
|
[ "$DOTFILES_CURRENT_SHELL" = "bash" ] && eval "$(rbenv init - bash)"
|
||||||
|
}
|
||||||
|
|
||||||
# Rust / cargo
|
# Rust / cargo
|
||||||
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
|
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
|
||||||
|
|||||||
@@ -44,16 +44,11 @@ export GREP_OPTIONS="--color=auto"
|
|||||||
# update the values of LINES and COLUMNS.
|
# update the values of LINES and COLUMNS.
|
||||||
hash shopt 2> /dev/null && shopt -s checkwinsize
|
hash shopt 2> /dev/null && shopt -s checkwinsize
|
||||||
|
|
||||||
# Load iterm2 shell integration
|
|
||||||
# https://iterm2.com/documentation-shell-integration.html
|
|
||||||
[[ -f "$XDG_BIN_HOME/iterm2_shell_integration.zsh" ]] \
|
|
||||||
&& source "$XDG_BIN_HOME/iterm2_shell_integration.zsh"
|
|
||||||
|
|
||||||
# Set dircolors based on the file, if it exists
|
# Set dircolors based on the file, if it exists
|
||||||
have dircolors && eval $(dircolors "$XDG_CONFIG_HOME/dircolors")
|
have dircolors && eval $(dircolors "$XDG_CONFIG_HOME/dircolors")
|
||||||
|
|
||||||
# If we are using zsh, color our dir lists and such
|
# If we are using zsh, color our dir lists and such
|
||||||
if [ "$SHELL" = "$(which zsh)" ]; then
|
if [ "$DOTFILES_CURRENT_SHELL" = "zsh" ]; then
|
||||||
autoload -U colors zsh/terminfo compinit
|
autoload -U colors zsh/terminfo compinit
|
||||||
colors
|
colors
|
||||||
compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
|
compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
|
||||||
@@ -67,10 +62,16 @@ if [ "$SHELL" = "$(which zsh)" ]; then
|
|||||||
# fzf
|
# fzf
|
||||||
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.zsh ] \
|
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.zsh ] \
|
||||||
&& source "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.zsh
|
&& source "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.zsh
|
||||||
|
|
||||||
|
# Load iterm2 shell integration
|
||||||
|
# https://iterm2.com/documentation-shell-integration.html
|
||||||
|
[[ -f "$XDG_BIN_HOME/iterm2_shell_integration.zsh" ]] \
|
||||||
|
&& source "$XDG_BIN_HOME/iterm2_shell_integration.zsh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If we are using bash
|
# If we are using bash
|
||||||
if [ "$SHELL" = "$(which bash)" ]; then
|
if [ "$DOTFILES_CURRENT_SHELL" = "bash" ]; then
|
||||||
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.bash ] \
|
# shellcheck source=../config/fzf/fzf.bash
|
||||||
&& source "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.bash
|
[ -f "${DOTFILES}/config/fzf/fzf.bash" ] &&
|
||||||
|
source "${DOTFILES}/config/fzf/fzf.bash"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ export DOTFILES_SHARED_LOADED=""
|
|||||||
# shellcheck source=./../../scripts/shared.sh
|
# shellcheck source=./../../scripts/shared.sh
|
||||||
source "$SHARED_SCRIPT"
|
source "$SHARED_SCRIPT"
|
||||||
|
|
||||||
|
# Loads configs for better installation experience
|
||||||
|
x-load-configs
|
||||||
|
|
||||||
function section_install
|
function section_install
|
||||||
{
|
{
|
||||||
USAGE_PREFIX="$SCRIPT install <command>"
|
USAGE_PREFIX="$SCRIPT install <command>"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
# Install cargo/rust packages.
|
# Install cargo/rust packages.
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
DOTFILES_SHARED_LOADED=""
|
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
source "$HOME/.dotfiles/scripts/shared.sh"
|
||||||
|
|
||||||
! have cargo && {
|
! have cargo && {
|
||||||
@@ -10,6 +9,8 @@ source "$HOME/.dotfiles/scripts/shared.sh"
|
|||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
source "$CARGO_HOME/env"
|
||||||
|
|
||||||
packages=(
|
packages=(
|
||||||
# a subprocess caching utility
|
# a subprocess caching utility
|
||||||
"bkt"
|
"bkt"
|
||||||
|
|||||||
@@ -8,6 +8,27 @@
|
|||||||
|
|
||||||
source "$DOTFILES/local/bin/msgr"
|
source "$DOTFILES/local/bin/msgr"
|
||||||
|
|
||||||
|
# Run x-load-configs in your terminal to reload the files.
|
||||||
|
function x-load-configs()
|
||||||
|
{
|
||||||
|
# Load the shell dotfiles, and then some:
|
||||||
|
for file in $DOTFILES/config/{exports,alias,functions}; do
|
||||||
|
HOST="$(hostname -s)"
|
||||||
|
# global (exports|alias|functions) file for all hosts
|
||||||
|
# shellcheck source=../config/exports
|
||||||
|
[ -r "$file" ] && source "$file"
|
||||||
|
# global secret file, git ignored
|
||||||
|
# shellcheck source=../config/exports-secret
|
||||||
|
[ -r "$file-secret" ] && source "$file-secret"
|
||||||
|
# host specific (exports|alias|functions) file
|
||||||
|
# shellcheck source=../config/exports
|
||||||
|
[ -r "$file-$HOST" ] && source "$file-$HOST"
|
||||||
|
# host specific (exports|alias|functions) file, git ignored
|
||||||
|
# shellcheck source=../config/exports
|
||||||
|
[ -r "$file-$HOST-secret" ] && source "$file-$HOST-secret"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# -- Menu builder -- #
|
# -- Menu builder -- #
|
||||||
function menu_section()
|
function menu_section()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user