diff --git a/init.zsh b/init.zsh index 8b907d9..f825b27 100644 --- a/init.zsh +++ b/init.zsh @@ -55,8 +55,23 @@ unsetopt beep notify # Some general, random configuration # History stuff +if [[ -v INSIDE_EMACS ]]; then + () { + emulate -L zsh + set -o rematchpcre + if [[ "${HISTFILE}" =~ '^~([^/]*)($|/.*)' ]]; then + local user="${match[1]}" + local rest="${match[2]}" + if [[ -z "${user}" ]]; then + HISTFILE="${HOME}${rest}" + else + HISTFILE="${userdirs[${user}]}" + fi + fi + } +fi +[[ "${HISTFILE}" == '~'* ]] && HISTFILE="${HISTFILE}" [ -v HISTFILE ] || HISTFILE="${HOME}/.cache/zsh/history" -[ ! -d "${HISTFILE:h}" ] && mkdir -p "${HISTFILE:h}" HISTSIZE=1000 SAVEHIST=10000