Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vim 什么保证“查看”命令以只读方式打开文件?_Vim - Fatal编程技术网

Vim 什么保证“查看”命令以只读方式打开文件?

Vim 什么保证“查看”命令以只读方式打开文件?,vim,Vim,查看命令以仅就绪模式打开文件。 然而,我发现在我的mac中,view命令实际上是到vim的软链接: ll/usr/bin/view输出: lrwxr-xr-x 1根轮3B 11月19日14:25/usr/bin/view->vim 所以我想知道:当我用这个命令打开一个文件时:/usr/bin/view/path/to/file。由于我没有设置任何特定参数,vim如何自动打开只读模式?命令可以查找调用它们的名称(例如,使用C中的argv[0]),并相应地更改它们的行为。因此,在这种情况下,vim知

查看
命令以仅就绪模式打开文件。 然而,我发现在我的mac中,
view
命令实际上是到vim的软链接:

ll/usr/bin/view
输出:

lrwxr-xr-x 1根轮3B 11月19日14:25/usr/bin/view->vim


所以我想知道:当我用这个命令打开一个文件时:
/usr/bin/view/path/to/file
。由于我没有设置任何特定参数,vim如何自动打开只读模式?

命令可以查找调用它们的名称(例如,使用C中的
argv[0]
),并相应地更改它们的行为。因此,在这种情况下,
vim
知道,如果is作为
视图运行,它的行为应该与只读
-R
标志被设置一样

vim
手册页:

   Vim behaves differently, depending on the name of the command (the exe‐
   cutable may still be the same file).

   vim       The "normal" way, everything is default.

   view      Start in read-only mode.  You will be protected from  writing
             the files.  Can also be done with the "-R" argument.

命令可以查找调用它们的名称(例如,在C中使用
argv[0]
),并相应地更改它们的行为。因此,在这种情况下,
vim
知道,如果is作为
视图运行,它的行为应该与只读
-R
标志被设置一样

vim
手册页:

   Vim behaves differently, depending on the name of the command (the exe‐
   cutable may still be the same file).

   vim       The "normal" way, everything is default.

   view      Start in read-only mode.  You will be protected from  writing
             the files.  Can also be done with the "-R" argument.