简体   繁体   中英

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. 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) . http://vimhelp.appspot.com/eval.txt.html#argc%28%29

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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