macvim-dev / macvim-dev/macvim

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

オープン
#1,192 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Vim Script
スター
7.9k
フォーク
691
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

埋め込まれている mvim スクリプトから始め、シンボリックリンクされた CLI ツールに対して Vim バイナリをどのように呼び出しているかを調べます。ex と echo v:progname および v:progpath を使って再現し、その後、他の起動動作を変更せずに呼び出しがツール名またはパスを保持することを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
macos, shell, vim
領域
cli, operating-systems
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。