gpt4 book ai didi

linux - 软链接(soft link)vimdiff是如何实现的

转载 作者:IT王子 更新时间:2023-10-29 00:54:13 26 4
gpt4 key购买 nike

我发现 vimdiff 实用程序只是 vim 的软链接(soft link)。两者都位于我的 Suse11 框中的 /usr/bin/ 下。 vimdfiff 是 vim 的软链接(soft link)。有趣的是,vimdiff file1 file2 实际上等同于 vim -d file1 file2,所以在那感觉,-d 选项自动嵌入到软链接(soft link)中,所以我的问题很简单怎么办?

最佳答案

Vim 在其 main() 函数中使用 argv[0] 来区分其可执行文件名 vimvimdiff, 或等等

Link to vim main.c执行此检查以区分 rvimrviewgvimgviewvimdiff , gvimdiff, ex, exim.

/*
* Check for: [r][e][g][vi|vim|view][diff][ex[im]]
* If the next character is "e" we run in Easy mode.
* If the next character is "g" we run the GUI version.
* If the next characters are "view" we start in readonly mode.
* If the next characters are "diff" or "vimdiff" we start in diff mode.
* If the next characters are "ex" we start in Ex mode. If it's followed
* by "im" use improved Ex mode.
*/

关于linux - 软链接(soft link)vimdiff是如何实现的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8876323/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com