开发者

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

开发者 https://www.devze.com 2023-04-08 18:47 出处:网络
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.

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

精彩评论

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

关注公众号