current commit
260621.1 · shell: rejigger how we load environment variables
# vim: ft=sh sw=2 ts=2 sts=2

# Various settings.
if command -v nvim &> /dev/null; then
  export EDITOR="nvim"
else
  export EDITOR="vim"
fi
export MOST_EDITOR="$EDITOR"
# export MANPAGER="less -R"
export MANPAGER='nvim +Man!'
export MANPATH="$HOME/man:"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
# shellcheck disable=SC2155
export GPG_TTY="$(tty)"
export SHELLCHECK_OPTS="-e SC2086 -e SC2016 -e SC2046 -e SC1090 -e SC2001 -e SC2236"
export QT_QPA_PLATFORMTHEME=qt5ct
export MAKEOPTS="-j12"
export PYTHONDONTWRITEBYTECODE=1

# Apparently something in groff broke colors in man pages? WTF?
#
# See: https://github.com/jedsoft/most/issues/18
# See: https://gitlab.archlinux.org/archlinux/packaging/packages/groff/-/commit/958e73c5086d99c87c0d2319088931e1771a42d8
# See: https://bbs.archlinux.org/viewtopic.php?id=287185
# See: https://bbs.archlinux.org/viewtopic.php?pid=2113876#p2113876
export GROFF_NO_SGR=1

# Looks like GOPATH has gone the way of the do-do.
unset GOPATH

# For my "kinda high" DPI Framework laptop.
case "$(myhostname)" in
  kang|bart)
    # I also had to combine this with setting 'layout.css.devPixelsPerPx'
    # in firefox to 1.5 as well. The Firefox setting only seems to apply to
    # web page rendering, and GDK_DPI_SCALE applies to the rest of it. This
    # also makes things like 'gmrun' and my NetworkManager tray applet scale
    # correctly.
    #
    # UPDATE: Apparently, GDK_DPI_SCALE is now enough. Setting
    # layout.css.devPixelsPerPx to 1.5 in addition to GDK_DPI_SCALE=1.5 makes
    # everything in Firefox way too big. But setting just GDK_DPI_SCALE=1.5
    # seems to make everything just work. So that's nicer, but man, I wish
    # someone would have, ya know, told me? Blech. This appears to have
    # happened when I upgraded to Firefox 103, but it could have been
    # introduced in a prior version. It had been a while for me since I had
    # last updated. (Not more than 6 months though I'd say.) Looking at my
    # package cache, it looks like the previous version was Firefox 98.0.2.
    # So sometime between 98.0.2 and 103, Firefox seems to have changed how
    # GDK_DPI_SCALE is interpreted...
    export GDK_SCALE=1.5
    export GDK_DPI_SCALE=1.5
    export QT_SCALE_FACTOR=1.5
    ;;
  *)
    ;;
esac

# For whatever reason, this is needed for Firefox to make scrolling buttery
# smooth. Without this, your fingers actually need to travel a fair bit of
# distance before scrolling actually activates. This makes it feel unresponsive
# and janky.
#
# When this is enabled, I also then like to disable kinetic scrolling. I'm used
# to such things on my phone or other touchscreens, but not with a trackpad.
#
# I do also keep smooth scrolling enabled, which makes things like pageup and
# pagedown be less jarring.
#
# Why this isn't the default is beyond me.
export MOZ_USE_XINPUT2=1

# Set config path for ripgrep.
if is-cygwin; then
    RIPGREP_CONFIG_PATH=C:/cygwin/home/andrew/.ripgreprc
else
    RIPGREP_CONFIG_PATH="$HOME/.ripgreprc"
fi
export RIPGREP_CONFIG_PATH

# Set locale config for https://github.com/BurntSushi/bttf
#
# Ideally we wouldn't need this and bttf would pick up on
# the configured POSIX locale automatically and convert it
# to the proper Unicode locale.
export BTTF_LOCALE=en-US

# Set IMDb data directory for imdb-rename.
IMDB_RENAME_DATA_DIR="$HOME/tmp/imdb-rename-data"
export IMDB_RENAME_DATA_DIR

# Set config for fzf.
export FZF_DEFAULT_COMMAND="rg --files"
export FZF_DEFAULT_OPTS="
  --color light
  --multi
  --height 40% --border
  --bind tab:down
  --bind shift-tab:up
  --bind ctrl-x:toggle
  --bind ctrl-s:toggle-all
"

# Set default theme for bat.
export BAT_THEME=ansi

# Considered harmful by https://wiki.archlinux.org/index.php/Locale
export LC_ALL=

# Personal variables.
export LOG="$HOME/data/log"
export EMAIL="jamslam@gmail.com"
export PUBPATH="$HOME/data/pubs"
export BROWSER="google-chrome"
export MOVIES="$HOME/media/movies/sd"
export MOVIESHD="$HOME/media/movies/hd"
export TV="$HOME/media/tv"
export MUSIC="$HOME/media/music"

# Ledger vars.
export LEDGER_FILE=/m/data/home/finance/accounts.ldg
export LEDGER_PRICE_DB=/m/data/home/finance/pricedb.ldg
export FIN_CONFIG=/m/data/home/finance/config.toml

# pyenv vars.
export PYENV_ROOT="$HOME/.pyenv"
export PYENV_SHELL=zsh

# Mac specific overrides.
if is-mac; then
  # Our TERM is typically tmux-256color. macOS doesn't seem to recognize it.
  export TERM=xterm
fi

# Bring in secret environment variables. These live in a separate encrypted
# file because I don't really want them to be public.
. "$HOME/.secretenv"