开发者

Is there any way in Vim to test that I have no file opened at start?

At the end of my .vimrc I want to conditionally launch a command opening my TODO list.

The problem is that I only want that behaviour when I am using vim or gvim.

And currently, I also load that buffer if I launch vim foo.bar, which is pretty inconvenient because I have to switch back to foo.bar

So basically I want to be able to write something like :

 if (some condition telling me that I am on the defaut buffer)
   开发者_如何学C  silent LaunchTaskList
 endif


Well, you always have a buffer when you're running Vim. It sounds like the check you really want to do is based on whether file arguments were given to Vim, and thus the args list is empty. For that, you can use the argc function.

if argc() == 0
    ...
endif
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜