make: make `vim' target even more lazy

Match the file name without left anchor and look for
a partial directory match if a director was specified.
This commit is contained in:
Franco Fichtner 2026-03-23 09:17:34 +01:00
parent 854238a1fc
commit 286dfcb6a6

View file

@ -146,8 +146,10 @@ checkout:
vim:
.for DIR in ${.CURDIR}/src
.if exists(${DIR})
@FOUND="$$(find ${.CURDIR}/src -type f -name "$$(basename '${vim_ARG}')*" | \
grep -F '${vim_ARG}')"; \
@FOUND="$$(find ${.CURDIR}/src -type f -iname "*$$(basename '${vim_ARG}')*")"; \
if [ -n "$${FOUND}" -a "$$(dirname '${vim_ARG}')" != "." ]; then \
FOUND="$$(echo "$${FOUND}" | grep -iF "$$(dirname '${vim_ARG}')")"; \
fi; \
if [ -n "$${FOUND}" ]; then \
if [ "$$(echo "$${FOUND}" | wc -l | awk '{ print $$1 }')" = "1" ]; then \
${VIM} "$${FOUND}"; \