Manage zellij configuration via chezmoi init

This commit is contained in:
Lockszmith (VAST@MacBook) 2025-05-08 02:57:34 -04:00
parent 4e6da56adf
commit 5835cd53f0
5 changed files with 55 additions and 30 deletions

View file

@ -0,0 +1,18 @@
#! /usr/bin/env bash
set -e
echo "Generating zellij/config.kdl.tmpl..."
is_cmd() { [[ -n "$(command -v "${1}")" ]] ; }
if is_cmd zellij; then
zellij setup --dump-config \
| sed -Ee '
s/^keybinds {/keybinds clear-defaults=true{/;
s/"Ctrl g"/{''{ list (dig "style" "zellij" "leader-modifer" "Alt" .) (dig "style" "zellij" "leader-key" "a" .) | join " " | quote }''}/g;
s/"Ctrl ([a-z])"/"{''{ dig "style" "zellij" "leader-modifer" "Alt" . }''} \1"/g;
s!^// theme "default"$!theme {''{ dig "style" "zellij" "theme" "default" . | quote }''}!
' \
> "$CHEZMOI_SOURCE_DIR/private_dot_config/zellij/config.kdl.tmpl"
fi