Update shortcuts script - file overwrite warning

I though this would be useful because when I wasn't sure about the shortcuts after installing via larbs, I just changed the `~/.config/shortcutrc` instead of modifying `bmfiles` & `bmdirs`

(I know I should've read the larbs readme - I did, but coming from windows it was already a little challenging, so I think that this might help both new-commers & prevent accidental confusion:)
This commit is contained in:
Kipras Melnikovas 2019-03-21 20:43:19 +02:00 committed by GitHub
parent 0473c82454
commit 7773c0b6a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,12 +5,14 @@ ranger_shortcuts="$HOME/.config/ranger/shortcuts.conf"
qute_shortcuts="/dev/null" qute_shortcuts="/dev/null"
fish_shortcuts="/dev/null" fish_shortcuts="/dev/null"
vifm_shortcuts="$HOME/.config/vifm/vifmshortcuts" vifm_shortcuts="$HOME/.config/vifm/vifmshortcuts"
filename="$(basename "$0")"
file_overwrite_warning="# Warning! This file is automatically formatted & overwritten by \"$(pwd)/$filename\" script"
# Remove, prepare files # Remove, prepare files
rm -f "$ranger_shortcuts" "$qute_shortcuts" 2>/dev/null rm -f "$ranger_shortcuts" "$qute_shortcuts" 2>/dev/null
printf "# vim: filetype=sh\\n" > "$fish_shortcuts" printf "# vim: filetype=sh\\n$file_overwrite_warning\\n" > "$fish_shortcuts"
printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts" printf "# vim: filetype=sh\\n$file_overwrite_warning\\nalias " > "$shell_shortcuts"
printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts" printf "\" vim: filetype=vim\\n$file_overwrite_warning\\n" > "$vifm_shortcuts"
# Format the `bmdirs` file in the correct syntax and sent it to all three configs. # Format the `bmdirs` file in the correct syntax and sent it to all three configs.
sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmdirs" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \ sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmdirs" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \