macvim-dev / macvim-dev/macvim
CLI tools don't preserve v:progname, v:progpath
まだ誰も着手していません。
- 主要言語
- 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:
- 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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
埋め込まれている mvim スクリプトから始め、シンボリックリンクされた CLI ツールに対して Vim バイナリをどのように呼び出しているかを調べます。ex と echo v:progname および v:progpath を使って再現し、その後、他の起動動作を変更せずに呼び出しがツール名またはパスを保持することを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- macos, shell, vim
- 領域
- cli, operating-systems
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100