I am using vimwiki
, a plugin for Vim, on a daily basis; and I am wondering if I can trigger its <Plug>
mapping "<Plug>VimwikiMakeDiaryNote
" through terminal/command-line arguments? I have found the particular command is defined as follows:
command! -count=1 VimwikiMakeDiaryNote
\ call vimwiki#diary#make_note(v:count1)
The <Plug>
mapping is defined as:
if !hasmapto('<Plug>VimwikiMakeDiaryNote')
exe 'nmap <silent><unique> '.g:vimwiki_map_prefix.'<Leader>w <Plug>VimwikiMakeDiaryNote'
endif
nnoremap <unique><script> <Plug>VimwikiMakeDiaryNote :VimwikiMakeDiaryNote<CR>
Is there a way to trigger the command/mapping VimwikiMakeDiaryNote
through terminal/command-line, by passing something as arguments for Vim?
As the <Plug>
-mapping simply invokes the eponymous command, it's easiest to invoke the command directly. You can execute arbitrary Ex commands with the -c {command}
or +{command}
option:
$ vim +VimwikiMakeDiaryNote
Press Win+i shall either start Gvim, or loop through all existing instances of Gvim.
#i::
IfWinExist ahk_class Vim
groupactivate, VIM, r
else
run C:\Vim\vim80\gvim.exe, +VimwikiMakeDiaryNote, max
return
+#i:: run C:\Vim\vim80\gvim.exe +VimwikiMakeDiaryNote, , max
Added the following entry to ~/.bashrc
alias v='vim +VimwikiMakeDiaryNote'