Merge branch 'master' of 192.168.1.2:PowerUser/dotfiles
This commit is contained in:
commit
78edcec21e
2 changed files with 54 additions and 30 deletions
|
@ -3,11 +3,54 @@
|
|||
# This file should be compatible with standard sh
|
||||
# shellcheck disable=SC2034
|
||||
|
||||
export SHELL_CONFIG_DIR="${SHELL_CONFIG_DIR:-"${XDG_CONFIG_HOME:-"$HOME/.config"}/shell"}"
|
||||
# path_append from https://superuser.com/questions/39751/add-directory-to-path-if-its-not-already-there
|
||||
# checks if a path is already in the PATH and if it exists
|
||||
path_append() {
|
||||
if [ -d "$1" ]; then
|
||||
# posix SH doesn't have [[, so we skip testing if the path is already in the PATH for simplicity
|
||||
# shellcheck disable=SC3010
|
||||
if command '[[' > /dev/null 2>&1 && [[ ":$PATH:" != *":$1:"* ]]; then
|
||||
PATH="${PATH:+"$PATH:"}$1"
|
||||
else
|
||||
PATH="$PATH:$1"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
path_prepend() {
|
||||
if [ -d "$1" ]; then
|
||||
# posix SH doesn't have [[, so we skip testing if the path is in the PATH already for simplicity
|
||||
# shellcheck disable=SC3010
|
||||
if command '[[' > /dev/null 2>&1 && [[ ":$PATH:" != *":$1:"* ]]; then
|
||||
PATH="$1${PATH:+":$PATH"}"
|
||||
else
|
||||
PATH="$1:$PATH"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# these would be temp vars, but ZSH does something weird where it makes them evaluate at runtime instead of
|
||||
export CONFIG_HOME="${XDG_DATA_HOME:-$HOME/.config}"
|
||||
export CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
|
||||
export DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
||||
export LOCAL_HOME="$HOME/.local"
|
||||
|
||||
export SHELL_CONFIG_DIR="${SHELL_CONFIG_DIR:-"$CONFIG_HOME/shell"}"
|
||||
if ! [ -d "$SHELL_CONFIG_DIR" ]; then
|
||||
echo "FATAL ERROR: \$SHELL_CONFIG_DIR is not set to a real directory: $SHELL_CONFIG_DIR" >&2
|
||||
fi
|
||||
|
||||
## PATH MODIFICATION
|
||||
# add local bin path and shell bin path to PATH
|
||||
path_append "$LOCAL_HOME/bin"
|
||||
# add shell bin files
|
||||
path_append "$SHELL_CONFIG_DIR/bin"
|
||||
# add doom emacs bin folder to path if it exists
|
||||
path_append "$CONFIG_HOME/emacs/bin"
|
||||
# add nixvim path if it exists
|
||||
path_prepend "/home/blake/code/nixvim-config/result/bin"
|
||||
|
||||
export PATH
|
||||
|
||||
if [ -z "$PROFILE_LOADED" ] && [ -f ~/.profile ]; then
|
||||
# shellcheck source=/home/blake/.profile
|
||||
. ~/.profile
|
||||
|
@ -26,14 +69,6 @@ fi
|
|||
export SYSTEMD_EDITOR="$EDITOR"
|
||||
export VISUAL="$EDITOR"
|
||||
|
||||
# Add local bin path and shell bin path to PATH
|
||||
export PATH="$PATH:${XDG_DATA_HOME:-$HOME/.local}/bin:$SHELL_CONFIG_DIR/bin"
|
||||
|
||||
# Add doom emacs bin folder to path if it exists
|
||||
doom_bin_dir="${XDG_DATA_HOME:-$HOME/.config}/emacs/bin"
|
||||
if [ -d "$doom_bin_dir" ]; then export PATH="$PATH:$doom_bin_dir"; fi
|
||||
unset doom_bin_dir
|
||||
|
||||
# Tell zellij to auto attach by default instead of opening a new session
|
||||
export ZELLIJ_AUTO_ATTACH=true
|
||||
|
||||
|
@ -54,13 +89,13 @@ export MANPAGER="less -R --use-color -Dd+g -Du+b"
|
|||
COLOR_SCHEME=tokyonight
|
||||
|
||||
# move zsh cache to where it should go
|
||||
export ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/zsh"
|
||||
export ZSH_CACHE_DIR="$CACHE_HOME/zsh"
|
||||
|
||||
# Don't add extra space to the right side of the prompt
|
||||
export ZLE_RPROMPT_INDENT=0
|
||||
|
||||
# Move zinit to where it should go
|
||||
export ZINIT_HOME_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/zinit"
|
||||
export ZINIT_HOME_DIR="$DATA_HOME/zinit"
|
||||
|
||||
# Add cargo to PATH if it exists
|
||||
[ -d "$HOME/.cargo/bin" ] && export PATH="$PATH:$HOME/.cargo/bin"
|
||||
|
@ -80,7 +115,7 @@ if [ -d "/etc/nixos" ]; then
|
|||
fi
|
||||
|
||||
## Working directory save settings (see things at bottom of zshrc)
|
||||
WORKING_DIR_SAVE_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/last-working-dir"
|
||||
WORKING_DIR_SAVE_FILE="$CACHE_HOME/zsh/last-working-dir"
|
||||
# make the dir for the file if needed
|
||||
test -d "$(dirname "$WORKING_DIR_SAVE_FILE")" || mkdir -p "$(dirname "$WORKING_DIR_SAVE_FILE")"
|
||||
|
||||
|
@ -118,6 +153,7 @@ DD="$DOCS_DIR"
|
|||
C=~/code/spu/ds2/src
|
||||
N="${NIXOS_DIR:-}"
|
||||
DP=~/'Documents/0 D'i'gi'P'e'n
|
||||
DPC="$DP/classes"
|
||||
|
||||
export S SS # this makes it easier to load the shrc while in posix sh
|
||||
|
||||
|
|
24
.zshrc
24
.zshrc
|
@ -56,6 +56,8 @@ ${SKIP_PLUGINS:-false} || {
|
|||
zinit snippet OMZL::termsupport.zsh
|
||||
# Required lib functions (specifically omz_urlencode)
|
||||
zinit snippet OMZL::functions.zsh
|
||||
# Compaudit
|
||||
zinit snippet OMZL::compfix.zsh
|
||||
|
||||
|
||||
# Quality of life
|
||||
|
@ -203,6 +205,9 @@ bindkey '^[[A' history-substring-search-up
|
|||
bindkey '^[[B' history-substring-search-down
|
||||
bindkey -M vicmd 'k' history-substring-search-up
|
||||
bindkey -M vicmd 'j' history-substring-search-down
|
||||
|
||||
# Run compaudit and such, from OMZL::compfix.zsh
|
||||
handle_completion_insecurities &|
|
||||
# <<<
|
||||
|
||||
# Colors and compinit >>>
|
||||
|
@ -216,24 +221,7 @@ export LESS_TERMCAP_us=$'\E[01;36m'
|
|||
export LESS=-R
|
||||
autoload -Uz compinit colors zcalc
|
||||
# only do full compinit once per day, use cached version usually
|
||||
# if ! compaudit &>/dev/null; then
|
||||
# echo "WARNING!"
|
||||
# echo " the following directories contain completions that have the wrong file permissions to be considered safe."
|
||||
# compaudit
|
||||
# echo " completions not loaded"
|
||||
# echo
|
||||
# echo "Please fix this and then continue"
|
||||
# echo " (note, this command might help: compaudit | xargs chmod g-w,o-w)"
|
||||
# echo
|
||||
# else
|
||||
if ! [[ -o extendedglob ]]; then setopt extendedglob; undo_setopt=true; fi
|
||||
if [[ -n ${ZDOTDIR}/.zcompdump(#qN.mh+24) ]]; then
|
||||
compinit
|
||||
else
|
||||
compinit -C
|
||||
fi
|
||||
if [[ undo_setopt = true ]]; then unsetopt extendedglob; fi
|
||||
# fi
|
||||
|
||||
colors
|
||||
# <<<
|
||||
# auto save and load working dir (allow `cd -` on start) >>>
|
||||
|
|
Loading…
Add table
Reference in a new issue