aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vis-cmds.c8
-rwxr-xr-xvis-open1
2 files changed, 7 insertions, 2 deletions
diff --git a/vis-cmds.c b/vis-cmds.c
index 83f16ea..bc4e6bd 100644
--- a/vis-cmds.c
+++ b/vis-cmds.c
@@ -344,8 +344,12 @@ static bool cmd_set(Vis *vis, Filerange *range, enum CmdOpt cmdopt, const char *
}
static bool is_file_pattern(const char *pattern) {
- return pattern && (strcmp(pattern, ".") == 0 || strchr(pattern, '*') ||
- strchr(pattern, '[') || strchr(pattern, '{'));
+ if (!pattern)
+ return false;
+ struct stat meta;
+ if (stat(pattern, &meta) == 0 && S_ISDIR(meta.st_mode))
+ return true;
+ return strchr(pattern, '*') || strchr(pattern, '[') || strchr(pattern, '{');
}
static const char *file_open_dialog(Vis *vis, const char *pattern) {
diff --git a/vis-open b/vis-open
index 0bcdd5c..a47249f 100755
--- a/vis-open
+++ b/vis-open
@@ -32,6 +32,7 @@ if ! type "$VIS_MENU" >/dev/null 2>&1; then
fi
DIR=""
+[ ! -z "$PATTERN" -a "$PATTERN" != "." -a -d "$PATTERN" ] && DIR="$PATTERN"
while true; do
SEL=$({ echo ..; ls -1 $PATTERN; } | $VIS_MENU $VIS_MENU_ARGS)