From a162224c290059be8ab171bc26e6957ee5905977 Mon Sep 17 00:00:00 2001 From: Tom Feiler Date: Wed, 8 Mar 2017 16:59:25 -0500 Subject: [PATCH 1/2] update vim shortcut command to work when shortcuts file has no line numbers When running via -l to just list files that match without line numbers, the "F *" commands didn't work properly. Update the shortcut command to check to see if line numbers are present. If so, open starting at that file. If not, just open the file. --- sack | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sack b/sack index e66dfd9..7fb832b 100755 --- a/sack +++ b/sack @@ -154,14 +154,21 @@ create_shortcut_cmd_vim() { cat > $sack__shortcut_cmd_path < Date: Thu, 9 Mar 2017 13:07:45 -0500 Subject: [PATCH 2/2] fix bug with spaces in filenames "equals 2" fails if the filenames have spaces in them. change to "greaterthan/equal to 2" --- sack | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sack b/sack index 7fb832b..dabbc3a 100755 --- a/sack +++ b/sack @@ -160,7 +160,7 @@ else sack__editor="\$EDITOR" fi num_fields=\`head -n 1 $sack__shortcut_file | awk '{ print NF }'\` -if [ \${num_fields} -eq 2 ]; then +if [ \${num_fields} -ge 2 ]; then sack__line=\`echo \$sack__vim_shortcut | cut -d" " -f1\` sack__file=\`echo \$sack__vim_shortcut | sed 's/'\$sack__line' //'\` \$sack__editor +\$sack__line "\$sack__file"