qqzsxyz / vimwiki

Automatically exported from code.google.com/p/vimwiki
0 stars 0 forks source link

Remapping inside vimwiki auto-command doesn't work #312

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
I am following the advice given in the docs (:help vimwiki), where it suggests 
remapping i.e.

 * `:nmap <Leader>wc <Plug>Vimwiki2HTML`

However, I put the mapping inside an autocommand, like this:

 * `au FileType vimwiki nmap <Leader>wo <Plug>Vimwiki2HTML`

What is the expected output? What do you see instead?

The trouble is, the original mapping is still being created by Vimwiki, as can 
be seen by:

 * `map <Leader>wh`

 > n  \whh         @<Plug>Vimwiki2HTMLBrowse
 > n  \wh          @<Plug>Vimwiki2HTML
 > s  \           * b<BS>\
 > n  \whh          :tabnew $NOTES/HomePage.md<CR>
 > n  \wh           :e $NOTES/HomePage.md<CR>

For reference, here is what the re-mappings look like (missing @ symbol!?)

 * `map <Leader>wo`

 > n  \woo          <Plug>Vimwiki2HTMLBrowse
 > n  \wo           <Plug>Vimwiki2HTML
 > s  \           * b<BS>\

Please use labels and text to provide additional information.

Vimwiki r7d28f798b643 (Thu May 17 07:51:30 2012)

Original issue reported on code.google.com by stu.andrews on 17 May 2012 at 1:55

GoogleCodeExporter commented 8 years ago
I just noticed that this problem only affects the first vimwiki file that I 
open.  

Could it be that my auto-command is running after vimwiki's ftplugin code ??

Original comment by stu.andrews on 17 May 2012 at 4:44

GoogleCodeExporter commented 8 years ago
Sure it is.
FileType event is triggered by changing/setting a filetype thus by the time 
your autocommand is run vimwiki's default bindings are set.

Perhaps you should use another event?

Original comment by habamax on 17 May 2012 at 5:26

GoogleCodeExporter commented 8 years ago
I found that the following works for me ...

au BufNewFile,BufRead {*.md,*.mkd,*.wiki,*.media} nmap <Leader>wo 
<Plug>Vimwiki2HTML
au BufNewFile,BufRead {*.md,*.mkd,*.wiki,*.media} nmap <Leader>woo 
<Plug>Vimwiki2HTMLBrowse

Original comment by stu.andrews on 18 May 2012 at 2:03

GoogleCodeExporter commented 8 years ago

Original comment by stu.andrews on 18 May 2012 at 2:07