简体   繁体   English

我怎么知道是否用文件名调用了vim?

[英]How can I tell if vim was called with a filename?

I'd like to add a switch in my .vimrc to do one thing if vim is being started up to edit an existing file or a new, empty buffer. 如果要启动vim编辑现有文件或新的空缓冲区,我想在.vimrc中添加一个开关来做一件事。 In other words, I want to know if the command line call looked like this: 换句话说,我想知道命令行调用是否看起来像这样:

> vim

or this: 或这个:

> vim myfile.txt

Is there a flag, argument, or file list I can examine to get this information? 是否可以检查标志,参数或文件列表以获取此信息?

You probably want to check ifeq (argc(),0) . 您可能要检查ifeq (argc(),0) http://vimhelp.appspot.com/eval.txt.html#argc%28%29 http://vimhelp.appspot.com/eval.txt.html#argc%28%29

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM