Improve distrobox detection
This commit is contained in:
parent
c06a7bffee
commit
b2e82b80d3
10
init.zsh
10
init.zsh
@ -32,9 +32,9 @@ function source_user_file {
|
||||
source_user_file "early-init"
|
||||
|
||||
# Load distrobox early init file
|
||||
local is_in_container=false
|
||||
if [[ -e /run/.containerenv ]]; then
|
||||
is_in_container=true
|
||||
local is_in_distrobox=false
|
||||
if [[ -e /run/.containerenv ]] && cmd_exists distrobox-host-exec; then
|
||||
is_in_distrobox=true
|
||||
local ctenv=("${(@f)"$(</run/.containerenv)"}")
|
||||
for line in ${ctenv}; do
|
||||
if [[ "${line}" == 'name='* ]]; then
|
||||
@ -96,7 +96,7 @@ if [[ -v NVIM ]]; then
|
||||
alias nvim=nvr
|
||||
alias e=nvr
|
||||
alias emacs=nvr
|
||||
elif [[ "${is_in_container}" == true ]]; then
|
||||
elif [[ "${is_in_distrobox}" == true ]]; then
|
||||
if [[ -v INSIDE_EMACS ]]; then
|
||||
[[ -z "${XDG_RUNTIME_DIR}" ]] && \
|
||||
export XDG_RUNTIME_DIR="/run/user/${UID}"
|
||||
@ -363,7 +363,7 @@ fi
|
||||
unfunction load_plugin
|
||||
unfunction cmd_exists
|
||||
unfunction source_user_file
|
||||
unset is_in_container
|
||||
unset is_in_distrobox
|
||||
|
||||
let ZSH_INIT_TIME="$(( EPOCHREALTIME - __init_zsh_start ))"
|
||||
function zsh-init-time {
|
||||
|
Loading…
x
Reference in New Issue
Block a user