diff options
author | Benjamin Chausse <benjamin@chausse.xyz> | 2024-01-20 03:41:29 -0500 |
---|---|---|
committer | Benjamin Chausse <benjamin@chausse.xyz> | 2024-01-20 03:41:29 -0500 |
commit | d49c79933e7b85a24238f6f373261de1d71d7072 (patch) | |
tree | 677bebe3b68c1c31125be064ba1a746f44c7a52f /.local/bin/shortcutgen | |
parent | 06185bde8c8beadecab629eaff51835244ff748a (diff) |
Wallpapers from lf + fix shortcutgen
Diffstat (limited to '.local/bin/shortcutgen')
-rwxr-xr-x | .local/bin/shortcutgen | 68 |
1 files changed, 10 insertions, 58 deletions
diff --git a/.local/bin/shortcutgen b/.local/bin/shortcutgen index 0020ec9..08164f0 100755 --- a/.local/bin/shortcutgen +++ b/.local/bin/shortcutgen @@ -1,63 +1,15 @@ #!/bin/sh -# Removing unecessary comments and documentation -raw=$(cat $HOME/.config/shortcutrc | tail -n +19 "$HOME/.config/shortcutrc" | sed "s/^|\s*//g; - s/\(.*\)|\(.*\)|\(.*\)|/\1|\2|\3/g; - s/\s*$//g; - /^$/d" | head -n -1) -# #---NERDTREE---# # -echo "$raw" | sed "s/\(.*\)\s*|.*|\s\(.*\)/\1\2/g; - s/ \{1,\}/ /g; - s/.HOME/~/g; - s/-*+-*+-*|//g" > $HOME/.NERDTreeBookmarks +# raw (basic processing before converting to specific formats) +# - remove comments +# - remove empty lines +# - remove spacing (keep commas between columns) +# - remove trailing whitespace -# #---ZSH---# # -# be sure to source $HOME/.cache/zsh-shortcuts in your .zshrc -echo "$raw" | sed 's/^.*|\s\([A-Za-z0-9]*\)\s*|\s\(.*\)$/alias\ g\1="cd\ \2"/g; /^-*+-*+-*|$/d' > $HOME/.cache/zsh-shortcuts +raw="$(sed 's/#.*//g;s/,\s*/,/g;/^$/d;s/\s*$//g' <"$XDG_CONFIG_HOME/shortcutrc")" -# #---RANGER---# # -# Commands implemented: -# g -> go -# m -> move to... -# t -> new tab -# Y -> copy to... -# awk '{print "map g"$1" cd "$2"\nmap t"$1" tab_new "$2"\nmap m"$1" shell mv -v %s "$2"\nmap Y"$1" shell cp -rv %s "$2}' >> "$ranger_shortcuts" -manual=$(sed -n '/Automated Shortcut Generation/q;p' $HOME/.config/ranger/shortcuts.conf) -printf '\n\n# #---Automated Shortcut Generation---#' >> $HOME/.config/ranger/shortcuts.conf -echo "$raw" | sed 's/^.*|\s\(.*\)\s|\s\(.*\)$/map\ g\1\ cd\ \2\nmap\ t\1\ tab_new\ \2\nmap\ m\1\ shell\ mv\ -v\ %s\ \2\nmap\ Y\1\ shell\ cp\ -rv\ %s\ \2\n/g; - s/.HOME/~/g; - s/^-*+-*+-*|$//g' >> $HOME/.config/ranger/shortcuts.conf +# lf +echo "$raw" | sed 's/\(.*\),\(.*\),\(.*\)/map g\2 cd \3/' >"$XDG_CONFIG_HOME/lf/shortcuts" -# #---ENVIRONMENTAL VARIABLES---# # -echo "$raw" | sed 's/[A-z,a-z,0-9]*\s*|\s*/g/; - s/\s*|\s*/=/; s/$/"/; - s/-*+-*+.*$// - s/^[A-z]*=/\U&/g - s/"$//g' > ~/.cache/shell-vars - -# #---Vifm---# # -vifm=$(echo "$raw" | sed " - s/^[A-Z,a-z,0-9]*\s*|//; - s/\$HOME/~/; - s/$/<cr>/" -) -vifmcd=$( echo "$vifm" | sed " - s/^\s*/nnoremap\ g/; - s/|/:cd/;" -) -vifmv=$( echo "$vifm" | sed " - s/^\s*/nnoremap\ m/; - s/|/:move/") -vifmy=$( echo "$vifm" | sed " - s/^\s*/nnoremap\ y/; - s/|/:copy/") -echo "$vifmcd\n\n$vifmv\n\n$vifmy" > ~/.cache/vifm-shortcuts - - - -# #---Testing---# # -# echo "$raw" | sed "s/[A-z,a-z,0-9]*\s*|//" - -# clear -# echo "$vifmv" -# cat ~/.cache/vifm-shortcuts +# shell (aliases and environment variables) +echo "$raw" | sed 's/\(.*\),\(.*\),\(.*\)/alias g\2="cd \3"\nexport G\U\2="\3"/' >"$HOME/.cache/zsh-shortcuts" |