1
0
Fork 0
dotfiles/.local/bin/shortcuts

25 lines
1.1 KiB
Plaintext
Raw Normal View History

2022-07-04 21:36:33 +02:00
#!/bin/sh
2023-03-29 16:15:06 +02:00
# Inputs
2023-07-01 14:38:31 +02:00
bmdirs="$XDG_CONFIG_HOME/bookmarks/directories"
bmfiles="$XDG_CONFIG_HOME/bookmarks/files"
2022-07-04 21:36:33 +02:00
2023-03-29 16:15:06 +02:00
# Outputs
shell_shortcuts="$ZDOTDIR/configs/autogenerated/shortcuts"
zsh_named_dirs="$ZDOTDIR/configs/autogenerated/hashes"
lf_files="$XDG_DATA_HOME/lf/shortcut-files"
lf_dirs="$XDG_DATA_HOME/lf/shortcut-dirs"
lf_shortcuts="$XDG_CONFIG_HOME/lf/shortcutrc"
2022-07-04 21:36:33 +02:00
2023-06-14 22:08:16 +02:00
rm -f "$shell_shortcuts" "$lf_files" "$lf_dirs" "$lf_shortcuts" "$zsh_named_dirs" 2>/dev/null
2023-02-07 17:19:53 +01:00
printf "# vim: filetype=sh\\nalias " >"$shell_shortcuts"
2022-07-04 21:36:33 +02:00
2022-10-21 17:52:11 +02:00
eval "echo \"$(cat "$bmdirs")\"" | awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
2022-10-22 16:35:17 +02:00
printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ;
2022-10-21 17:52:11 +02:00
printf(\"map g%s cd \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" ;
2023-06-14 22:08:16 +02:00
printf(\"%s\n\",\$2) >> \"$lf_dirs\" }"
2022-07-04 21:36:33 +02:00
2022-10-21 17:52:11 +02:00
eval "echo \"$(cat "$bmfiles")\"" | awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
2022-10-22 16:35:17 +02:00
printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ;
2023-12-14 13:36:26 +01:00
printf(\"%s\n\",\$2) >> \"$lf_files\" }"