Some container stuff

This commit is contained in:
Alexander Rosenberg 2025-02-18 06:25:06 -08:00
parent 5ff2811927
commit b8c898b3cc
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

View File

@ -32,7 +32,9 @@ function source_user_file {
source_user_file "early-init" source_user_file "early-init"
# Load distrobox early init file # Load distrobox early init file
if [[ -v DISTROBOX_ENTER_PATH ]] && [[ -e /run/.containerenv ]]; then local is_in_container=false
if [[ -e /run/.containerenv ]]; then
is_in_container=true
local ctenv=("${(@f)"$(</run/.containerenv)"}") local ctenv=("${(@f)"$(</run/.containerenv)"}")
for line in ${ctenv}; do for line in ${ctenv}; do
if [[ "${line}" == 'name='* ]]; then if [[ "${line}" == 'name='* ]]; then
@ -94,16 +96,22 @@ if [[ -v NVIM ]]; then
alias nvim=nvr alias nvim=nvr
alias e=nvr alias e=nvr
alias emacs=nvr alias emacs=nvr
elif [[ "${is_in_container}" == true ]]; then
[[ -z "${XDG_RUNTIME_DIR}" ]] && export XDG_RUNTIME_DIR="/run/user/${UID}"
if [[ -v INSIDE_EMACS ]]; then
export EDITOR='distrobox-host-exec emacsclient -a nvim '
alias emacs='distrobox-host-exec emacsclient -a nvim '
else
export EDITOR='distrobox-host-exec emacsclient -a nvim -c '
alias emacs='distrobox-host-exec emacsclient -a nvim -c '
fi
alias n='emacs '
alias e='emacs '
elif [[ -v INSIDE_EMACS ]]; then elif [[ -v INSIDE_EMACS ]]; then
export EDITOR='emacsclient' export EDITOR='emacsclient'
alias e='emacsclient ' alias e='emacsclient '
alias emacs='emacsclient ' alias emacs='emacsclient '
alias n='emacsclient ' alias n='emacsclient '
elif [[ -v DISTROBOX_ENTER_PATH ]]; then
export EDITOR='distrobox-host-exec emacsclient -a nvim -c'
alias emacs='distrobox-host-exec emacsclient -a nvim -c '
alias n='emacs '
alias e='emacs '
else else
export EDITOR='emacsclient -a nvim -nw' export EDITOR='emacsclient -a nvim -nw'
# Because I keep using n by mistake # Because I keep using n by mistake
@ -354,6 +362,7 @@ fi
unfunction load_plugin unfunction load_plugin
unfunction cmd_exists unfunction cmd_exists
unfunction source_user_file unfunction source_user_file
unset is_in_container
let ZSH_INIT_TIME="$(( EPOCHREALTIME - __init_zsh_start ))" let ZSH_INIT_TIME="$(( EPOCHREALTIME - __init_zsh_start ))"
function zsh-init-time { function zsh-init-time {