Search code examples
vimvim-plugin

What is wrong with Vim Wikia plugin example?


the example (link) gives:

E107: Missing parentheses: <SNR>17_StartZekyll

(For exact copy of the example, it is: E107: Missing parentheses: <SNR>16_AppFunction Below is my stripped, faithful version, I've removed comments and the multi-dot parts ("... whatever ...") and modified the first key binding.)

What can be wrong?

" ------------------------------------------------------------------------------
" Exit when your app has already been loaded (or "compatible" mode set)
if exists("g:loaded_zekyll") || &cp
    finish
endif

let g:loaded_zekyll = 1 " your version number
let s:keepcpo = &cpo
set cpo&vim

" Public Interface:
if !hasmapto('<Plug>StartZekyll')
    map <unique> <Leader>c <Plug>StartZekyll
endif

" Global Maps:
"
map <silent> <unique> <script> <Plug>StartZekyll :set lz<CR>:call <SID>StartZekyll<CR>:set nolz<CR>


" Script Variables:
let s:repos_paths = [ $HOME."/.zekyll/repos" ]

" ------------------------------------------------------------------------------
" s:StartZekyll: this function is available via the <Plug>/<script> interface above
fun! s:StartZekyll()
    " content here

    nmap <silent> <Left> :set lz<CR>:silent! call <SID>StartZekyll2<CR>:set nolz<CR>

    call s:render()
endfun

fun! s:render()
endfun


" ------------------------------------------------------------------------------
let &cpo=s:keepcpo
unlet s:keepcpo

Solution

  • The mapping given as an example misses some parentheses for the call command. You have to correct

    map ...  call <SID>StartZekyll<CR> ...
    

    with:

    map ...  call <SID>StartZekyll()<CR> ...
    

    in both mappings you defined.