vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit c73efb2ab06f90e0198401d28bc03da285873fc2
parent e4bfe7e7381ea7cf0ebc6dfde00228260c44ca3c
Author: Tim Allen <screwtape@froup.com>
Date:   Wed, 25 May 2016 20:09:15 +1000

[vis-open] Handle filenames with spaces and tabs.

We still don't handle filenames that contain newlines, but we're
pressing against the limits of what portable POSIX shell can do. Besides
which, we're ultimately plumbing filenames into vis-menu which uses
newlines as a delimiter *anyway*, so there's not much we can do.

Diffstat:
Mvis-open | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/vis-open b/vis-open @@ -1,6 +1,10 @@ #!/bin/sh set -e +# Later, we're going to want to set $IFS to a single newline, so let's prepare one. +NL=' +' + VIS_MENU_PROMPT="" ALLOW_AUTO_SELECT=1 @@ -41,6 +45,7 @@ if [ $# -eq 1 -a "$ALLOW_AUTO_SELECT" = 1 ]; then # We pass -f to force the next iteration to present the # full list, even if it's just an empty directory. cd "$1" + IFS=$NL # Don't split ls output on tabs or spaces. exec "$0" -p "$VIS_MENU_PROMPT" -f .. $(ls -1) else # We've found a single item, and it's not a directory,