Merge pull request #82 from t7ko/custom-map

Allow users to override <Leader>w prefix via config option
This commit is contained in:
EinfachToll 2014-11-06 12:12:16 +01:00
commit f7bacc3e75
3 changed files with 22 additions and 11 deletions

View File

@ -2537,6 +2537,16 @@ mother tongue like this: >
The default is 'Contents'. The default is 'Contents'.
------------------------------------------------------------------------------
*g:vimwiki_map_prefix*
A string which specifies the prefix for all global mappings (and some local).
Use it to avoid conflicts with other plugins. Note that it must be defined
before the plugin loads. >
let g:vimwiki_map_prefix = '<Leader>e'
The default is '<Leader>w'.
============================================================================== ==============================================================================
13. Miscellaneous *vimwiki-misc* 13. Miscellaneous *vimwiki-misc*

View File

@ -324,13 +324,13 @@ endif
if !hasmapto('<Plug>Vimwiki2HTML') if !hasmapto('<Plug>Vimwiki2HTML')
nmap <buffer> <Leader>wh <Plug>Vimwiki2HTML exe 'nmap <buffer> '.g:vimwiki_map_prefix.'h <Plug>Vimwiki2HTML'
endif endif
nnoremap <script><buffer> nnoremap <script><buffer>
\ <Plug>Vimwiki2HTML :Vimwiki2HTML<CR> \ <Plug>Vimwiki2HTML :Vimwiki2HTML<CR>
if !hasmapto('<Plug>Vimwiki2HTMLBrowse') if !hasmapto('<Plug>Vimwiki2HTMLBrowse')
nmap <buffer> <Leader>whh <Plug>Vimwiki2HTMLBrowse exe 'nmap <buffer> '.g:vimwiki_map_prefix.'hh <Plug>Vimwiki2HTMLBrowse'
endif endif
nnoremap <script><buffer> nnoremap <script><buffer>
\ <Plug>Vimwiki2HTMLBrowse :Vimwiki2HTMLBrowse<CR> \ <Plug>Vimwiki2HTMLBrowse :Vimwiki2HTMLBrowse<CR>
@ -397,13 +397,13 @@ nnoremap <silent><script><buffer>
\ <Plug>VimwikiPrevLink :VimwikiPrevLink<CR> \ <Plug>VimwikiPrevLink :VimwikiPrevLink<CR>
if !hasmapto('<Plug>VimwikiDeleteLink') if !hasmapto('<Plug>VimwikiDeleteLink')
nmap <silent><buffer> <Leader>wd <Plug>VimwikiDeleteLink exe 'nmap <silent><buffer> '.g:vimwiki_map_prefix.'d <Plug>VimwikiDeleteLink'
endif endif
nnoremap <silent><script><buffer> nnoremap <silent><script><buffer>
\ <Plug>VimwikiDeleteLink :VimwikiDeleteLink<CR> \ <Plug>VimwikiDeleteLink :VimwikiDeleteLink<CR>
if !hasmapto('<Plug>VimwikiRenameLink') if !hasmapto('<Plug>VimwikiRenameLink')
nmap <silent><buffer> <Leader>wr <Plug>VimwikiRenameLink exe 'nmap <silent><buffer> '.g:vimwiki_map_prefix.'r <Plug>VimwikiRenameLink'
endif endif
nnoremap <silent><script><buffer> nnoremap <silent><script><buffer>
\ <Plug>VimwikiRenameLink :VimwikiRenameLink<CR> \ <Plug>VimwikiRenameLink :VimwikiRenameLink<CR>

View File

@ -418,6 +418,7 @@ call s:default('diary_months',
\ 10: 'October', 11: 'November', 12: 'December' \ 10: 'October', 11: 'November', 12: 'December'
\ }) \ })
call s:default('map_prefix', '<Leader>w')
call s:default('current_idx', 0) call s:default('current_idx', 0)
@ -489,37 +490,37 @@ command! VimwikiDiaryGenerateLinks
" MAPPINGS {{{ " MAPPINGS {{{
if !hasmapto('<Plug>VimwikiIndex') if !hasmapto('<Plug>VimwikiIndex')
nmap <silent><unique> <Leader>ww <Plug>VimwikiIndex exe 'nmap <silent><unique> '.g:vimwiki_map_prefix.'w <Plug>VimwikiIndex'
endif endif
nnoremap <unique><script> <Plug>VimwikiIndex :VimwikiIndex<CR> nnoremap <unique><script> <Plug>VimwikiIndex :VimwikiIndex<CR>
if !hasmapto('<Plug>VimwikiTabIndex') if !hasmapto('<Plug>VimwikiTabIndex')
nmap <silent><unique> <Leader>wt <Plug>VimwikiTabIndex exe 'nmap <silent><unique> '.g:vimwiki_map_prefix.'t <Plug>VimwikiTabIndex'
endif endif
nnoremap <unique><script> <Plug>VimwikiTabIndex :VimwikiTabIndex<CR> nnoremap <unique><script> <Plug>VimwikiTabIndex :VimwikiTabIndex<CR>
if !hasmapto('<Plug>VimwikiUISelect') if !hasmapto('<Plug>VimwikiUISelect')
nmap <silent><unique> <Leader>ws <Plug>VimwikiUISelect exe 'nmap <silent><unique> '.g:vimwiki_map_prefix.'s <Plug>VimwikiUISelect'
endif endif
nnoremap <unique><script> <Plug>VimwikiUISelect :VimwikiUISelect<CR> nnoremap <unique><script> <Plug>VimwikiUISelect :VimwikiUISelect<CR>
if !hasmapto('<Plug>VimwikiDiaryIndex') if !hasmapto('<Plug>VimwikiDiaryIndex')
nmap <silent><unique> <Leader>wi <Plug>VimwikiDiaryIndex exe 'nmap <silent><unique> '.g:vimwiki_map_prefix.'i <Plug>VimwikiDiaryIndex'
endif endif
nnoremap <unique><script> <Plug>VimwikiDiaryIndex :VimwikiDiaryIndex<CR> nnoremap <unique><script> <Plug>VimwikiDiaryIndex :VimwikiDiaryIndex<CR>
if !hasmapto('<Plug>VimwikiDiaryGenerateLinks') if !hasmapto('<Plug>VimwikiDiaryGenerateLinks')
nmap <silent><unique> <Leader>w<Leader>i <Plug>VimwikiDiaryGenerateLinks exe 'nmap <silent><unique> '.g:vimwiki_map_prefix.'<Leader>i <Plug>VimwikiDiaryGenerateLinks'
endif endif
nnoremap <unique><script> <Plug>VimwikiDiaryGenerateLinks :VimwikiDiaryGenerateLinks<CR> nnoremap <unique><script> <Plug>VimwikiDiaryGenerateLinks :VimwikiDiaryGenerateLinks<CR>
if !hasmapto('<Plug>VimwikiMakeDiaryNote') if !hasmapto('<Plug>VimwikiMakeDiaryNote')
nmap <silent><unique> <Leader>w<Leader>w <Plug>VimwikiMakeDiaryNote exe 'nmap <silent><unique> '.g:vimwiki_map_prefix.'<Leader>w <Plug>VimwikiMakeDiaryNote'
endif endif
nnoremap <unique><script> <Plug>VimwikiMakeDiaryNote :VimwikiMakeDiaryNote<CR> nnoremap <unique><script> <Plug>VimwikiMakeDiaryNote :VimwikiMakeDiaryNote<CR>
if !hasmapto('<Plug>VimwikiTabMakeDiaryNote') if !hasmapto('<Plug>VimwikiTabMakeDiaryNote')
nmap <silent><unique> <Leader>w<Leader>t <Plug>VimwikiTabMakeDiaryNote exe 'nmap <silent><unique> '.g:vimwiki_map_prefix.'<Leader>t <Plug>VimwikiTabMakeDiaryNote'
endif endif
nnoremap <unique><script> <Plug>VimwikiTabMakeDiaryNote nnoremap <unique><script> <Plug>VimwikiTabMakeDiaryNote
\ :VimwikiTabMakeDiaryNote<CR> \ :VimwikiTabMakeDiaryNote<CR>