Skip to content
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
8 changes: 8 additions & 0 deletions sack
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,15 @@ create_shortcut_cmd_vim() {
sack__shortcut_cmd_path=$sack__shortcut_path/$sack__shortcut_cmd
cat > $sack__shortcut_cmd_path <<SHORTCUT
#!/bin/bash

function die() {
echo >&2 "Invalid result index"
exit 1
}

[[ ! "\$1" =~ ^[1-9][0-9]*$ ]] && die
sack__vim_shortcut=\$(sed -n "\$1p" < $sack__shortcut_file)
[[ -z \$sack__vim_shortcut ]] && die
sack__line=\`echo \$sack__vim_shortcut | cut -d" " -f1\`
sack__file=\`echo \$sack__vim_shortcut | sed 's/'\$sack__line' //'\`
if [ -z "\$EDITOR" ]; then
Expand Down