vis

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

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

commit 5fb8b3033ff7c814ceafc475ed7425b0d3d5e616
parent bdf74d0669d0c151d75d30a2c318163ee5c097fd
Author: Vadym Kochan <vadim4j@gmail.com>
Date:   Wed,  1 Jul 2020 09:24:24 +0300

vis-open: add trailing "/" for the folders

Add trailing "/" for the folder entries which allows to easy
differentiate folders and the regular files. Additionally it allows
easy filter only folders by simply enter "/" in the vis-open prompt.

Signed-off-by: Vadym Kochan <vadim4j@gmail.com>

Diffstat:
Mvis-open | 11++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/vis-open b/vis-open @@ -8,6 +8,15 @@ NL=' VIS_MENU_PROMPT="" ALLOW_AUTO_SELECT=1 +wrap_dirs() { + local o + + while read o + do + [ -d "$o" ] && printf "%s/\n" "$o" || printf "%s\n" "$o" + done +} + while [ $# -gt 0 ]; do case "$1" in -h|--help) @@ -63,7 +72,7 @@ fi # At this point, we have a bunch of options we need to present to the # user so they can pick one. -CHOICE=$(printf "%s\n" "$@" | vis-menu -b -p "$VIS_MENU_PROMPT") +CHOICE=$(printf "%s\n" "$@" | wrap_dirs | vis-menu -b -p "$VIS_MENU_PROMPT") # Did they pick a file or directory? Who knows, let's let the next iteration figure it out. exec "$0" -p "$VIS_MENU_PROMPT" -- "$CHOICE"