diff --git a/sack b/sack index be9aae2..c0da78f 100755 --- a/sack +++ b/sack @@ -126,7 +126,7 @@ process_shorcut_paths() { # Using : as the delimiter here should be fine, because : is not used in file names awk -F':' ' { - print $2 " " $1; + print $2 ";" $1; };' } @@ -152,8 +152,17 @@ create_shortcut_cmd() { # The following literally writes the shorcut command and makes it executable sack__shortcut_cmd_path=~/bin/$sack__shortcut_cmd echo "#!/bin/bash" > $sack__shortcut_cmd_path - echo "sack__vim_shortcut=\$(sed -n \"\$1p\" < $sack__shortcut_file)" >> $sack__shortcut_cmd_path - echo "$sack__default_editor +\$sack__vim_shortcut" >> $sack__shortcut_cmd_path + echo "OIFS=\$IFS" >> $sack__shortcut_cmd_path + echo "IFS=';'" >> $sack__shortcut_cmd_path + echo "read -a sack__editor_shortcut <<< \"\$(sed -n \"\$1p\" < $sack__shortcut_file)\"" >> $sack__shortcut_cmd_path + echo "IFS=\$OIFS" >> $sack__shortcut_cmd_path + + if [[ $sack__default_editor == vi* ]] || [[ $sack__default_editor == emacs* ]]; then + echo "$sack__default_editor +\${sack__editor_shortcut[0]} \${sack__editor_shortcut[1]}" >> $sack__shortcut_cmd_path + elif [[ $sack__default_editor == subl* ]]; then + echo "$sack__default_editor \${sack__editor_shortcut[1]}:\${sack__editor_shortcut[0]} &" >> $sack__shortcut_cmd_path + fi + chmod +x $sack__shortcut_cmd_path }