Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto open vimwiki when vim start

Tags:

vim

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

like image 354
hank511 Avatar asked Aug 16 '12 05:08

hank511


1 Answers

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 %*
like image 129
Ingo Karkat Avatar answered Sep 27 '22 15:09

Ingo Karkat