]> Sergey Matveev's repositories - nnn.git/commitdiff
fix bookmarks plugin on empty output (#762)
authorPlacido Fernandez <9625282+fdplacido@users.noreply.github.com>
Thu, 15 Oct 2020 17:36:36 +0000 (17:36 +0000)
committerGitHub <noreply@github.com>
Thu, 15 Oct 2020 17:36:36 +0000 (23:06 +0530)
* fix bookmarks plugin on empty output

* fix indentation

* remove redundant new line

plugins/bookmarks

index b25e8e5fe28e01812eb801618704d7803fb53981..9bf491ee2a3390ab50fbe6876294ffbd74c03b91 100755 (executable)
@@ -44,7 +44,11 @@ get_links() {
         [ -d "$entry" ] || continue
 
         printf "%20s -> %s\n" "$(basename "$entry")" "$(readlink -f "$entry")"
-    done | fzf | awk 'END { print "'"$BOOKMARKS_DIR"'/"$1 }'
+    done | fzf |
+    awk 'END {
+        if (length($1) == 0) { print "'"$PWD"'" }
+        else { print "'"$BOOKMARKS_DIR"'/"$1 }
+    }'
 }
 
 # Choose symlink with fzf