Skip to content

Commit

Permalink
Fix F with vim when there is no line number
Browse files Browse the repository at this point in the history
Addresses issue sampson-chen#50 in the parent repo.

When there were no line numbers in results (e.g., sag -g), F would fail.
This switches from cutting based on space-delimited fields to simply
removing everything after the first non-alphanumeric character (I tried
to use \s instead of \W, but it didn't seem to work).
  • Loading branch information
SnoringFrog committed Feb 12, 2020
1 parent 3276440 commit 203a3d2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sack
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ create_shortcut_cmd_vim() {
cat > $sack__shortcut_cmd_path <<SHORTCUT
#!/bin/bash
sack__vim_shortcut=\$(sed -n "\$1p" < $sack__shortcut_file)
sack__line=\`echo \$sack__vim_shortcut | cut -d" " -f1\`
sack__line=\`echo \$sack__vim_shortcut | sed 's/\W.*//'\`
sack__file=\`echo \$sack__vim_shortcut | sed 's/'\$sack__line' //'\`
if [ -z "\$EDITOR" ]; then
sack__editor="$sack__default_editor"
Expand Down

0 comments on commit 203a3d2

Please sign in to comment.