macvim-dev / macvim-dev/macvim
CLI tools don't preserve v:progname, v:progpath
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Vim Script
- Star
- 7.9k
- Fork
- 691
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với script mvim được nhúng và kiểm tra cách nó gọi binary Vim cho các công cụ CLI được liên kết bằng symbolic link. Tái hiện bằng ex và echo v:progname cùng v:progpath, sau đó xác minh rằng lời gọi vẫn giữ nguyên tên hoặc đường dẫn của công cụ mà không thay đổi các hành vi khởi chạy khác.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- macos, shell, vim
- Lĩnh vực
- cli, operating-systems
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100