From dcd29060a4b2025f16a138daa4db6b378f660355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannu=20K=C3=A4m=C3=A4r=C3=A4inen?= Date: Sun, 11 Jan 2015 18:21:08 +0100 Subject: [PATCH 1/2] Compare sack__default_editor against vi*, emacs* etc to take into account for example emacs -nw --- sack | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sack b/sack index be9aae2..ed22c84 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,15 @@ 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 + fi + chmod +x $sack__shortcut_cmd_path } From d20ee5ddceac89350d2c310b6c739be8460b2146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannu=20K=C3=A4m=C3=A4r=C3=A4inen?= Date: Sun, 11 Jan 2015 18:21:58 +0100 Subject: [PATCH 2/2] Add shortcut support for sublimetext2 --- sack | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sack b/sack index ed22c84..c0da78f 100755 --- a/sack +++ b/sack @@ -159,6 +159,8 @@ create_shortcut_cmd() { 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