我发现vimdiff实用程序只是一个指向vim的软链接。这两个文件都位于my Suse11框中的/usr/bin/下。而vimdfiff是vim的软链接。有趣的是,vimdiff file1 file2实际上等同于vim -d file1 file2,所以从这个意义上说,-d选项会自动嵌入到软链接中,所以我的问题很简单:如何实现?
发布于 2012-01-16 14:11:45
Vim在其main()函数中使用argv[0]来区分其可执行文件名vim或vimdiff等。
执行此检查以区分rvim、rview、gvim、gview、vimdiff、gvimdiff、ex和exim的Link to vim main.c。
/*
* 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.
*/https://stackoverflow.com/questions/8876323
复制相似问题