blob: 2335a924d7c7fd1b718d3d83a6643262a8b58921 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/bin/sh
# raw (basic processing before converting to specific formats)
# - remove comments
# - remove empty lines
# - 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 (sourced by lfrc)
echo "$raw" | sed 's/\(.*\),\(.*\),\(.*\)/map g\2 cd \3/' >"$XDG_CONFIG_HOME/lf/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=,/;s/,\(.*\)/\1/' >"$HOME/.cache/env-shortcuts"
|