macvim-dev / macvim-dev/macvim

CLI tools don't preserve v:progname, v:progpath

Ouverte
#1,192 7 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
Vim Script
Étoiles
7.9k
Forks
691
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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:

  1. Run ex
  2. Type echo v:progname or echo 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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par le script mvim intégré et examinez comment il invoque le binaire Vim pour les outils CLI liés symboliquement. Reproduisez le problème avec ex et echo v:progname et v:progpath, puis vérifiez que l’invocation conserve le nom ou le chemin de l’outil sans modifier les autres aspects du comportement au lancement.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
macos, shell, vim
Domaine
cli, operating-systems
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.