Skip to content

Change shortcurts to allow easy adding of other editors. Add support for sublimetext2 #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions sack
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};'
}

Expand All @@ -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
}

Expand Down