dotfiles

beau's configuration files
git clone https://git.beauhilton.com/dotfiles.git
Log | Files | Refs | README

shortcuts (1680B)


      1 #!/usr/bin/env bash
      2 # Output locations. Unactivated progs should go to /dev/null.
      3 shell_shortcuts="$HOME/.config/shortcutrc"
      4 ranger_shortcuts="/dev/null"
      5 qute_shortcuts="/dev/null"
      6 fish_shortcuts="/dev/null"
      7 vifm_shortcuts="$HOME/.config/vifm/vifmshortcuts"
      8 
      9 # Remove, prepare files
     10 rm -f "$ranger_shortcuts" "$qute_shortcuts" 2>/dev/null
     11 printf "# vim: filetype=sh\\n" > "$fish_shortcuts"
     12 printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts"
     13 printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts"
     14 
     15 # Format the `bmdirs` file in the correct syntax and sent it to all three configs.
     16 sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmdirs" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \
     17 	>(awk '{print "abbr", $1, "\"cd " $2 "; and ls -a\""}' >> "$fish_shortcuts") \
     18 	>(awk '{print "map g" $1, ":cd", $2 "<CR>\nmap t" $1, "<tab>:cd", $2 "<CR><tab>\nmap M" $1, "<tab>:cd", $2 "<CR><tab>:mo<CR>\nmap Y" $1, "<tab>:cd", $2 "<CR><tab>:co<CR>" }' >> "$vifm_shortcuts") \
     19 	>(awk '{print "config.bind(\";"$1"\", \"set downloads.location.directory "$2" ;; hint links download\")"}' >> "$qute_shortcuts") \
     20 	| 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"
     21 
     22 # Format the `configs` file in the correct syntax and sent it to both configs.
     23 sed "s/\s*#.*$//;/^\s*$/d"  "$HOME/.config/bmfiles" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \
     24 	>(awk '{print "abbr", $1, "\"$EDITOR "$2"\""}' >> "$fish_shortcuts") \
     25 	>(awk '{print "map", $1, ":e", $2 "<CR>" }' >> "$vifm_shortcuts") \
     26 	| awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts"