macvim-dev / macvim-dev/macvim
CLI tools don't preserve v:progname, v:progpath
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Vim Script
- Estrellas
- 7.9k
- Forks
- 691
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
Describe the bug
Vim exposes the name of the binary that was executed in the v:progname variable. Unfortunately, invoking the various vim CLI tools installed by MacVim always reports v:progname as being Vim. This is because they're all symlinks of the embedded mvim script, which ultimately invokes
exec "$binary" $opts …
In particular, it's not providing the -a flag, so the binary is always invoked with the executable name of Vim.
The same issue also affects v:progpath (for obvious reasons), wherein it always points to the absolute path to the MacVim.app/Contents/MacOS/Vim binary.
This is an issue because v:progname and v:progpath are potentially useful to use in my vimrc to customize based on what binary I used to invoke it.
Replacing this with exec -a "$0" "$binary" … should solve the problem.
On a related note, launching MacVim from the Finder also sets v:progname to Vim. I can't decide if this matters.
To Reproduce
Detailed steps to reproduce the behavior:
- Run
ex - Type
echo v:prognameorecho v:progpath
Expected behavior
It should print "ex" as the progname and either "ex" or the absolute path to ex as the progpath.
Observed behavior
It always prints Vim as the progname and the absolute path to MacVim.app/Contents/MacOS/Vim as the progpath.
Environment (please complete the following information):
- Vim version 8.2.1719
- OS: macOS 11.2.3 (20D91)
- Terminal: Apple Terminal.app or GUI
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con el script mvim integrado e inspecciona cómo invoca el binario de Vim para las herramientas CLI enlazadas simbólicamente. Reprodúcelo con ex y echo v:progname y v:progpath, y verifica después que la invocación conserve el nombre o la ruta de la herramienta sin cambiar ningún otro comportamiento de inicio.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- macos, shell, vim
- Área
- cli, operating-systems
- Tipo de issue
- Error
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100