macvim-dev / macvim-dev/macvim
CLI tools don't preserve v:progname, v:progpath
还没有人认领这个 Issue。
- 主要语言
- 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 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从嵌入式 mvim 脚本开始,检查它如何为符号链接的 CLI 工具调用 Vim 二进制文件。使用 ex 以及 echo v:progname 和 v:progpath 重现,然后验证该调用是否保留工具名称或路径,同时不改变其他启动行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- macos, shell, vim
- 领域
- cli, operating-systems
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100