From fbcc3dce4caa6196b4b727e815e07b9941ce1709 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Sat, 27 Jan 2024 14:01:01 -0500 Subject: shortcutgen writes separate files for profile and zshrc --- .local/bin/shortcutgen | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.local/bin/shortcutgen b/.local/bin/shortcutgen index 08164f0..ce29ffb 100755 --- a/.local/bin/shortcutgen +++ b/.local/bin/shortcutgen @@ -6,10 +6,15 @@ # - remove spacing (keep commas between columns) # - remove trailing whitespace +# Strip comments, remove empty lines, condense spacing, remove trailing whitespace raw="$(sed 's/#.*//g;s/,\s*/,/g;/^$/d;s/\s*$//g' <"$XDG_CONFIG_HOME/shortcutrc")" -# lf +# lf (sourced by lfrc) echo "$raw" | sed 's/\(.*\),\(.*\),\(.*\)/map g\2 cd \3/' >"$XDG_CONFIG_HOME/lf/shortcuts" -# shell (aliases and environment variables) -echo "$raw" | sed 's/\(.*\),\(.*\),\(.*\)/alias g\2="cd \3"\nexport G\U\2="\3"/' >"$HOME/.cache/zsh-shortcuts" +# Shell aliases (read by zshrc) +echo "$raw" | sed 's/\(.*\),\(.*\),\(.*\)/alias g\2="cd \3"/' >"$HOME/.cache/zsh-shortcuts" + +# Environment variables (read by .profile) +echo "$raw" | sed 's/\(.*\),\(.*\),\(.*\)/export G\U\2="\3"/' >"$HOME/.cache/env-shortcuts" + -- cgit v1.2.3