hank511
hank511

Reputation: 117

Auto open vimwiki when vim start

I'm using vimwiki's managing todo-list feature as task management tool. So I edit the todo.wiki file frequently.

Everytime when I starting the todo list, I must type some command to open vim.exe(I use Launchy indeed), while the vim started,and then type \ww or :VimwikiIndex, I am tired of this way.

Is there any method that can auto load todo list when I want to ?I mean sometimes I just want to start vim for coding,and I have try the config below in .vimrc

autocmd VimEnter * VimwikiIndex

but vim open the todo-list everytime.So I want something like starting argument etc

Upvotes: 7

Views: 1520

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172570

When you start your coding sessions by passing file(s) to Vim, you could check for that:

autocmd VimEnter * if argc() == 0 | execute 'VimwikiIndex' | endif

Alternatively, you could pass a dummy file wiki to Vim, and open the Wiki on that trigger:

autocmd VimEnter * if argv() ==# ['wiki'] | execute 'VimwikiIndex' | endif

But I would probably solve this outside of Vim through shell aliases

alias vimwiki='vim -c VimwikiIndex'

or a small vimwiki wrapper batch file on Windows

@vim -c VimwikiIndex %*

Upvotes: 13

Related Questions