Skip to content

Commit

Permalink
vis-open: allow to show files vertically
Browse files Browse the repository at this point in the history
It might be more comfortable to navigate through the files
arranged vertically.

Add ability to specify VIS_OPEN_LINES environment variable
which is passed to vis-menu as -l option.

It would be better to add vis option for this to set it
via lua config, but it might be added later.

Signed-off-by: Vadym Kochan <[email protected]>
  • Loading branch information
vkochan authored and rnpnr committed Aug 1, 2023
1 parent 5d7d62c commit 32e20a2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion vis-open
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ set -e
NL='
'

if [ -z "$VIS_OPEN_LINES" ]; then
VIS_OPEN_LINES='0'
fi

VIS_MENU_PROMPT=''
ALLOW_AUTO_SELECT='1'

Expand Down Expand Up @@ -66,7 +70,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' '..' "$@" | wrap_dirs | vis-menu -b -p "$VIS_MENU_PROMPT")"
CHOICE="$(printf '%s\n' '..' "$@" | wrap_dirs | vis-menu -b -l "$VIS_OPEN_LINES" -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"

0 comments on commit 32e20a2

Please sign in to comment.