Clean your homedir with XDG Base Dir

Xrefs: XDG specification | ArchWiki | Reddit post

In case you are, like me, tired of applications polluting your homedir with config and data files, the XDB Base Directory Specification (ArchWiki) has your back.

You probably saw the ~/.config directory already, and in fact, many programs can be told to use this directory instead of polluting your homedir. The ArchWiki page has a list of many applications and which environment variables need to be set to change the location of their configuration.

My ~/.config/environment.d/xdg.conf currently looks like this:

# Explicitly set the location of the XDG directories.
XDG_CONFIG_HOME=$HOME/.config
XDG_CACHE_HOME=$HOME/.cache
XDG_DATA_HOME=$HOME/.local/share

# Set program specific locations.
LESSHISTFILE=$XDG_CACHE_HOME/lesshst
CARGO_HOME=$XDG_DATA_HOME/cargo
BUNDLE_USER_CONFIG=$XDG_CONFIG_HOME/bundle
BUNDLE_USER_CACHE=$XDG_CACHE_HOME/bundle
BUNDLE_USER_PLUGIN=$XDG_DATA_HOME/bundle
PASSWORD_STORE_DIR=$XDG_DATA_HOME/pass
VIMINIT="set nocp | source $XDG_CONFIG_HOME/vim/vimrc"
TEXMFHOME=$XDG_DATA_HOME/texmf
TEXMFVAR=$XDG_CACHE_HOME/texlive/texmf-var
TEXMFCONFIG=$XDG_CONFIG_HOME/texlive/texmf-config
GNUPGHOME=$XDG_DATA_HOME/gnupg
GOPATH=$XDG_DATA_HOME/go