From 786370ba945ba36a9daf2a91b969013315976298 Mon Sep 17 00:00:00 2001 From: Gal Szkolnik Date: Mon, 6 Jun 2022 10:28:09 -0400 Subject: [PATCH] Cleanup + some chezmoi houskeeping cmds --- _home/dot_sz.shrc.d/91_keyboard_mappings | 2 +- _home/dot_sz.shrc.d/97_chezmoi_aliases | 9 +++++++++ _home/dot_sz.shrc.d/97_keyboard_mappings | 5 ----- 3 files changed, 10 insertions(+), 6 deletions(-) delete mode 100644 _home/dot_sz.shrc.d/97_keyboard_mappings diff --git a/_home/dot_sz.shrc.d/91_keyboard_mappings b/_home/dot_sz.shrc.d/91_keyboard_mappings index 6a475e6..81f6cd3 100644 --- a/_home/dot_sz.shrc.d/91_keyboard_mappings +++ b/_home/dot_sz.shrc.d/91_keyboard_mappings @@ -1,4 +1,4 @@ -if [[ -n "$(type -fP setxkbmap)" ]]; then +if [[ -n "$(type -fP setxkbmap)" && -n "$DISPLAY" ]]; then setxkbmap -option setxkbmap -option caps:escape setxkbmap -option caps:ctrl_modifier diff --git a/_home/dot_sz.shrc.d/97_chezmoi_aliases b/_home/dot_sz.shrc.d/97_chezmoi_aliases index 694df4e..655b239 100644 --- a/_home/dot_sz.shrc.d/97_chezmoi_aliases +++ b/_home/dot_sz.shrc.d/97_chezmoi_aliases @@ -3,6 +3,15 @@ if [[ -n "$(type -fP chezmoi)" ]]; then alias cz-refresh="chezmoi status | cut -d\ -f2 | grep '^\.sz\.shrc\.d' | xargs chezmoi forget --force; chezmoi add ~/.sz.shrc.d --recursive; chezmoi status; chezmoi git status" alias cz-commit="chezmoi git -- commit -a " + function cz-remove-missing() { + pushd ~ > /dev/null + changes=$(chezmoi status | sed -n 's/^DA[ \t]\+//p') + for c in $changes; do + chezmoi rm $c + done + popd > /dev/null + } + function cz-add-changes() { pushd ~ > /dev/null changes=$(chezmoi status | sed -n 's/^MM[ \t]\+//p') diff --git a/_home/dot_sz.shrc.d/97_keyboard_mappings b/_home/dot_sz.shrc.d/97_keyboard_mappings deleted file mode 100644 index 6a475e6..0000000 --- a/_home/dot_sz.shrc.d/97_keyboard_mappings +++ /dev/null @@ -1,5 +0,0 @@ -if [[ -n "$(type -fP setxkbmap)" ]]; then - setxkbmap -option - setxkbmap -option caps:escape - setxkbmap -option caps:ctrl_modifier -fi