2022-04-06 13:08:42 -07:00
|
|
|
#!/bin/sh
|
2022-03-18 17:50:20 -07:00
|
|
|
# Blake's environment variables
|
|
|
|
# This file should be compatible with standard sh
|
2022-03-30 11:40:06 -07:00
|
|
|
# shellcheck disable=SC2034
|
2022-03-18 17:50:20 -07:00
|
|
|
|
BIG UPDATE: shell: add profile, move calc and mkcd to files, move
shell-independent config (aliases, functions, env vars, options) to
.config/shell/shrc, make bashrc and zshrc use the same shrc, add TTY
detection for changing caps lock to escape in a TTY, add option for
skipping plugin loading, and maybe a few other things
If this goes well, I'll be tempted to call this version 1.0. Things
have been very stable for the last few months. Although, since it's the
first really big change in a while, that might make it version 2.0?
Should dotfiles have big version numbers at all? Probably not.
2022-04-08 13:36:29 -07:00
|
|
|
export SHELL_CONFIG_DIR="${SHELL_CONFIG_DIR:-"${XDG_CONFIG_HOME:-"$HOME/.config"}/shell"}"
|
2022-04-06 13:08:42 -07:00
|
|
|
if ! [ -d "$SHELL_CONFIG_DIR" ]; then
|
2022-05-15 01:47:16 -07:00
|
|
|
echo "FATAL ERROR: \$SHELL_CONFIG_DIR is not set to a real directory: $SHELL_CONFIG_DIR" >&2
|
2022-04-06 13:08:42 -07:00
|
|
|
fi
|
|
|
|
|
2022-09-17 20:01:28 -07:00
|
|
|
if [ -z "$PROFILE_LOADED" ] && [ -f ~/.profile ]; then
|
2022-10-18 02:55:41 -07:00
|
|
|
# shellcheck source=/home/blake/.profile
|
2022-09-17 20:01:28 -07:00
|
|
|
. ~/.profile
|
|
|
|
fi
|
|
|
|
|
2022-03-18 17:50:20 -07:00
|
|
|
# Intelligently set $EDITOR
|
|
|
|
if command -v nvim > /dev/null;then
|
|
|
|
export EDITOR=nvim
|
|
|
|
elif command -v vim > /dev/null;then
|
|
|
|
export EDITOR=vim
|
|
|
|
elif command -v vi > /dev/null;then
|
|
|
|
export EDITOR=vi
|
|
|
|
fi
|
2022-04-06 13:08:42 -07:00
|
|
|
export SYSTEMD_EDITOR="$EDITOR"
|
2022-05-22 08:43:59 -07:00
|
|
|
export VISUAL="$EDITOR"
|
2022-04-06 13:08:42 -07:00
|
|
|
|
2022-06-05 11:43:32 -07:00
|
|
|
# Add local bin path and shell bin path to PATH
|
2022-03-18 17:50:20 -07:00
|
|
|
export PATH="$PATH:${XDG_DATA_HOME:-$HOME/.local}/bin:$SHELL_CONFIG_DIR/bin"
|
2022-04-06 13:08:42 -07:00
|
|
|
|
2022-10-18 02:55:41 -07:00
|
|
|
# Shell to use for commands like `nix-shell -p`
|
|
|
|
export NIX_BUILD_SHELL=zsh
|
|
|
|
|
2022-06-05 11:43:32 -07:00
|
|
|
# Basic default LS colors
|
2022-03-18 17:50:20 -07:00
|
|
|
export LSCOLORS="Gxfxcxdxbxegedabagacad"
|
|
|
|
|
2022-07-24 02:06:47 -07:00
|
|
|
# `less` colors
|
|
|
|
# shellcheck disable=SC2016
|
|
|
|
export LESS='-R --use-color -Dd+g$Du+b'
|
|
|
|
export MANPAGER="less -R --use-color -Dd+g -Du+b"
|
|
|
|
|
2022-06-05 11:43:32 -07:00
|
|
|
# Theme for zsh and nvim (soon™)
|
|
|
|
COLOR_SCHEME=tokyonight
|
2022-04-06 13:08:42 -07:00
|
|
|
|
2022-06-05 11:43:32 -07:00
|
|
|
# move zsh cache to where it should go
|
2022-03-18 17:50:20 -07:00
|
|
|
export ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/zsh"
|
2022-06-05 11:43:32 -07:00
|
|
|
|
2022-03-18 17:50:20 -07:00
|
|
|
# Don't add extra space to the right side of the prompt
|
|
|
|
export ZLE_RPROMPT_INDENT=0
|
|
|
|
|
2022-06-05 11:43:32 -07:00
|
|
|
# Move zinit to where it should go
|
2022-04-14 10:40:33 -07:00
|
|
|
export ZINIT_HOME_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/zinit"
|
2022-03-18 17:50:20 -07:00
|
|
|
|
2022-08-26 21:07:38 -07:00
|
|
|
# Add cargo to PATH if it exists
|
2022-12-16 22:21:39 -08:00
|
|
|
[ -d "$HOME/.cargo/bin" ] && export PATH="$PATH:$HOME/.cargo/bin"
|
2022-04-06 13:08:42 -07:00
|
|
|
|
2022-03-18 17:50:20 -07:00
|
|
|
# Set documents directory (auto set to the repo the file ~/todo points to is in)
|
2022-05-22 02:25:54 -07:00
|
|
|
if [ -h ~/todo ] && command -v git > /dev/null; then
|
2022-05-15 01:47:16 -07:00
|
|
|
# shellcheck disable=SC2155
|
|
|
|
export DOCS_DIR="$(git -C "$(dirname "$(realpath ~/todo)" 2>&1)" rev-parse --show-toplevel | head -1)"
|
|
|
|
elif [ -d "$HOME/Documents/docs" ]; then
|
|
|
|
export DOCS_DIR="$HOME/Documents/docs/"
|
|
|
|
else
|
2022-05-22 02:25:54 -07:00
|
|
|
echo "Error: couldn't find the documents repo" > /dev/null
|
2022-05-15 01:47:16 -07:00
|
|
|
fi
|
2022-03-18 17:50:20 -07:00
|
|
|
|
2023-01-21 02:57:10 -08:00
|
|
|
if [ -d "/etc/nixos" ]; then
|
|
|
|
export NIXOS_DIR=/etc/nixos
|
|
|
|
fi
|
|
|
|
|
2022-04-06 13:08:42 -07:00
|
|
|
## Working directory save settings (see things at bottom of zshrc)
|
2022-03-18 17:50:20 -07:00
|
|
|
WORKING_DIR_SAVE_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/last-working-dir"
|
|
|
|
# make the dir for the file if needed
|
2022-04-06 13:08:42 -07:00
|
|
|
test -d "$(dirname "$WORKING_DIR_SAVE_FILE")" || mkdir -p "$(dirname "$WORKING_DIR_SAVE_FILE")"
|
2022-03-18 17:50:20 -07:00
|
|
|
|
2022-04-06 13:08:42 -07:00
|
|
|
# ZSH plugin settings >>>
|
2022-03-18 17:50:20 -07:00
|
|
|
# ZSH Vi Mode
|
|
|
|
export ZVM_VI_HIGHLIGHT_FOREGROUND=#BBC2CF
|
|
|
|
export ZVM_VI_HIGHLIGHT_BACKGROUND=#515860
|
|
|
|
# ZVM_VI_HIGHLIGHT_EXTRASTYLE=bold,underline # bold and underline
|
|
|
|
|
2022-04-06 13:08:42 -07:00
|
|
|
# vim-mode cursor
|
|
|
|
# syntax: "[color] [blinking] [style]" see: https://github.com/softmoth/zsh-vim-mode#mode-in-prompt
|
|
|
|
export MODE_CURSOR_VIINS="blinking bar"
|
|
|
|
export MODE_CURSOR_REPLACE="steady bar"
|
|
|
|
export MODE_CURSOR_VICMD="steady block"
|
|
|
|
export MODE_CURSOR_SEARCH="blinking underline"
|
|
|
|
export MODE_CURSOR_VISUAL="steady block"
|
|
|
|
export MODE_CURSOR_VLINE="steady block"
|
|
|
|
|
2022-03-18 17:50:20 -07:00
|
|
|
# OMZ Completion
|
|
|
|
export COMPLETION_WAITING_DOTS=true
|
|
|
|
|
|
|
|
# Powerlevel 10k
|
|
|
|
export POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD="${POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD:-true}"
|
2022-04-06 13:08:42 -07:00
|
|
|
export POWERLEVEL9K_INSTANT_PROMPT="${POWERLEVEL9K_INSTANT_PROMPT:-quiet}"
|
|
|
|
# TODO?: maybe add a bit of code to select a random theme if none is detected (make sure to disable instant prompt if this happens)
|
BIG UPDATE: shell: add profile, move calc and mkcd to files, move
shell-independent config (aliases, functions, env vars, options) to
.config/shell/shrc, make bashrc and zshrc use the same shrc, add TTY
detection for changing caps lock to escape in a TTY, add option for
skipping plugin loading, and maybe a few other things
If this goes well, I'll be tempted to call this version 1.0. Things
have been very stable for the last few months. Although, since it's the
first really big change in a while, that might make it version 2.0?
Should dotfiles have big version numbers at all? Probably not.
2022-04-08 13:36:29 -07:00
|
|
|
export P10K_CONFIG_LOCATION="${P10K_CONFIG_LOCATION:-"$SHELL_CONFIG_DIR/p10k/current"}"
|
2022-03-18 17:50:20 -07:00
|
|
|
# <<<
|
|
|
|
|
2022-03-30 11:40:06 -07:00
|
|
|
###########################################
|
|
|
|
### Directory and file quick access ###
|
|
|
|
###########################################
|
2022-04-06 13:08:42 -07:00
|
|
|
S="$SHELL_CONFIG_DIR"
|
2023-01-21 02:57:10 -08:00
|
|
|
SS="$S/shrc"
|
2022-04-06 13:08:42 -07:00
|
|
|
DD="$DOCS_DIR"
|
2022-04-13 01:37:49 -07:00
|
|
|
C=~/code/spu/ds2/src
|
2023-01-21 02:57:10 -08:00
|
|
|
N="${NIXOS_DIR:-}"
|
2022-03-30 11:40:06 -07:00
|
|
|
|
2023-01-21 02:57:10 -08:00
|
|
|
export S SS # this makes it easier to load the shrc while in posix sh
|
2022-08-09 18:36:28 -07:00
|
|
|
|
2022-04-06 13:08:42 -07:00
|
|
|
# vim:fdm=marker:fmr=>>>,<<<:et:ft=sh:sw=3:ts=3
|