Some container stuff
This commit is contained in:
parent
5ff2811927
commit
b8c898b3cc
21
init.zsh
21
init.zsh
@ -32,7 +32,9 @@ function source_user_file {
|
||||
source_user_file "early-init"
|
||||
|
||||
# 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)"}")
|
||||
for line in ${ctenv}; do
|
||||
if [[ "${line}" == 'name='* ]]; then
|
||||
@ -94,16 +96,22 @@ if [[ -v NVIM ]]; then
|
||||
alias nvim=nvr
|
||||
alias e=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
|
||||
export EDITOR='emacsclient'
|
||||
alias e='emacsclient '
|
||||
alias emacs='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
|
||||
export EDITOR='emacsclient -a nvim -nw'
|
||||
# Because I keep using n by mistake
|
||||
@ -354,6 +362,7 @@ fi
|
||||
unfunction load_plugin
|
||||
unfunction cmd_exists
|
||||
unfunction source_user_file
|
||||
unset is_in_container
|
||||
|
||||
let ZSH_INIT_TIME="$(( EPOCHREALTIME - __init_zsh_start ))"
|
||||
function zsh-init-time {
|
||||
|
Loading…
x
Reference in New Issue
Block a user