Don't use <Plug> definitions for VimwikiReturn mappings.
This is necessary to properly allow the user to remap these since there are different arguments to the command. The documentation regarding this command was also updated to be more clear.
This commit is contained in:
parent
28d78b0d39
commit
b5d808b440
@ -620,7 +620,6 @@ LIST MAPPINGS, INSERT MODE *vimwiki-list-mappings*
|
|||||||
useful to end a list, simply press <CR> twice.
|
useful to end a list, simply press <CR> twice.
|
||||||
See |vimwiki-lists| for details and for how to
|
See |vimwiki-lists| for details and for how to
|
||||||
configure the behavior.
|
configure the behavior.
|
||||||
Remap command: `<Plug>VimwikiReturn15`
|
|
||||||
|
|
||||||
*vimwiki_i_<S-CR>*
|
*vimwiki_i_<S-CR>*
|
||||||
<S-CR> Does not insert a new list item, useful to create
|
<S-CR> Does not insert a new list item, useful to create
|
||||||
@ -628,7 +627,6 @@ LIST MAPPINGS, INSERT MODE *vimwiki-list-mappings*
|
|||||||
details and for how to configure the behavior. The
|
details and for how to configure the behavior. The
|
||||||
default map may not work in all terminals and may
|
default map may not work in all terminals and may
|
||||||
need to be remapped.
|
need to be remapped.
|
||||||
Remap command: `<Plug>VimwikiReturn22`
|
|
||||||
|
|
||||||
*vimwiki_i_<C-T>*
|
*vimwiki_i_<C-T>*
|
||||||
<C-T> Increase the level of a list item.
|
<C-T> Increase the level of a list item.
|
||||||
@ -1619,20 +1617,26 @@ used.
|
|||||||
|
|
||||||
While writing lists, the keys <CR>, o and O insert new bullets or numbers as
|
While writing lists, the keys <CR>, o and O insert new bullets or numbers as
|
||||||
you would expect it. A new bullet/number is inserted if and only if the cursor
|
you would expect it. A new bullet/number is inserted if and only if the cursor
|
||||||
is in a list item. To make a list item with more than one line, press <S-CR>
|
is in a list item. If you use hard line wraps within your lists then you will
|
||||||
or press <CR> and <C-L><C-M>.
|
need to remap `<CR>` to `VimwikiReturn 3 5`, use <S-CR>, or press <CR> and
|
||||||
|
<C-L><C-M>.
|
||||||
|
|
||||||
Note that the mapping <S-CR> is not available in all terminals.
|
Note that the mapping <S-CR> is not available in all terminals.
|
||||||
|
|
||||||
Furthermore, <CR> and <S-CR> behave differently when the cursor is behind an
|
Furthermore, <CR> and <S-CR> behave differently when the cursor is behind an
|
||||||
empty list item. See the table below.
|
empty list item. See the table below.
|
||||||
|
|
||||||
To remap the default behavior: >
|
To customize the behavior you should use an autocmd or place the mappings in
|
||||||
:imap <Leader>e <Plug>VimwikiReturn15
|
`~/.vim/after/ftplugin/vimwiki.vim`. This is necessary to avoid an error that
|
||||||
:imap <Leader>r <Plug>VimwikiReturn22
|
the command `VimwikiReturn` doesn't exist when editing non Vimwiki files.: >
|
||||||
|
|
||||||
To customize the behavior: >
|
autocmd FileType vimwiki inoremap <silent><buffer> <CR>
|
||||||
inoremap <CR> <Esc>:VimwikiReturn 1 1<CR>
|
\ <C-]><Esc>:VimwikiReturn 3 5<CR>
|
||||||
inoremap <S-CR> <Esc>:VimwikiReturn 3 5<CR>
|
autocmd FileType vimwiki inoremap <silent><buffer> <S-CR>
|
||||||
|
\ <Esc>:VimwikiReturn 2 2<CR>
|
||||||
|
|
||||||
|
Note: Prefixing the mapping with `<C-]>` expands iabbrev definitions and
|
||||||
|
requires Vim > 7.3.489.
|
||||||
|
|
||||||
The first argument of the command :VimwikiReturn is a number that specifies
|
The first argument of the command :VimwikiReturn is a number that specifies
|
||||||
when to insert a new bullet/number and when not, depending on whether the
|
when to insert a new bullet/number and when not, depending on whether the
|
||||||
|
@ -438,16 +438,6 @@ nnoremap <silent><buffer> <Plug>VimwikiListo
|
|||||||
\ :<C-U>call vimwiki#lst#kbd_o()<CR>
|
\ :<C-U>call vimwiki#lst#kbd_o()<CR>
|
||||||
nnoremap <silent><buffer> <Plug>VimwikiListO
|
nnoremap <silent><buffer> <Plug>VimwikiListO
|
||||||
\ :<C-U>call vimwiki#lst#kbd_O()<CR>
|
\ :<C-U>call vimwiki#lst#kbd_O()<CR>
|
||||||
if has('patch-7.3.489')
|
|
||||||
" expand iabbrev on enter
|
|
||||||
inoremap <silent><buffer> <Plug>VimwikiReturn15
|
|
||||||
\ <C-]><Esc>:VimwikiReturn 1 5<CR>
|
|
||||||
else
|
|
||||||
inoremap <silent><buffer> <Plug>VimwikiReturn15
|
|
||||||
\ <Esc>:VimwikiReturn 1 5<CR>
|
|
||||||
endif
|
|
||||||
inoremap <silent><buffer> <Plug>VimwikiReturn22
|
|
||||||
\ <Esc>:VimwikiReturn 2 2<CR>
|
|
||||||
|
|
||||||
" default lists key mappings
|
" default lists key mappings
|
||||||
if str2nr(vimwiki#vars#get_global('key_mappings').lists)
|
if str2nr(vimwiki#vars#get_global('key_mappings').lists)
|
||||||
@ -482,8 +472,19 @@ if str2nr(vimwiki#vars#get_global('key_mappings').lists)
|
|||||||
call vimwiki#u#map_key('n', 'gL', '<Plug>VimwikiRemoveCBInList')
|
call vimwiki#u#map_key('n', 'gL', '<Plug>VimwikiRemoveCBInList')
|
||||||
call vimwiki#u#map_key('n', 'o', '<Plug>VimwikiListo')
|
call vimwiki#u#map_key('n', 'o', '<Plug>VimwikiListo')
|
||||||
call vimwiki#u#map_key('n', 'O', '<Plug>VimwikiListO')
|
call vimwiki#u#map_key('n', 'O', '<Plug>VimwikiListO')
|
||||||
call vimwiki#u#map_key('i', '<CR>', '<Plug>VimwikiReturn15')
|
|
||||||
call vimwiki#u#map_key('i', '<S-CR>', '<Plug>VimwikiReturn22')
|
" handle case of existing VimwikiReturn mappings outside the <Plug> definition
|
||||||
|
if maparg('<CR>', 'i') !~# '.*VimwikiReturn*.'
|
||||||
|
if has('patch-7.3.489')
|
||||||
|
" expand iabbrev on enter
|
||||||
|
inoremap <silent><buffer> <CR> <C-]><Esc>:VimwikiReturn 1 5<CR>
|
||||||
|
else
|
||||||
|
inoremap <silent><buffer> <CR> <Esc>:VimwikiReturn 1 5<CR>
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
if maparg('<S-CR>', 'i') !~# '.*VimwikiReturn*.'
|
||||||
|
inoremap <silent><buffer> <S-CR> <Esc>:VimwikiReturn 2 2<CR>
|
||||||
|
endif
|
||||||
|
|
||||||
" change symbol for bulleted lists
|
" change symbol for bulleted lists
|
||||||
for s:char in vimwiki#vars#get_syntaxlocal('bullet_types')
|
for s:char in vimwiki#vars#get_syntaxlocal('bullet_types')
|
||||||
@ -521,14 +522,12 @@ if str2nr(vimwiki#vars#get_global('key_mappings').lists)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
function! s:CR(normal, just_mrkr)
|
function! s:CR(normal, just_mrkr)
|
||||||
if str2nr(vimwiki#vars#get_global('key_mappings').table_mappings)
|
|
||||||
let res = vimwiki#tbl#kbd_cr()
|
let res = vimwiki#tbl#kbd_cr()
|
||||||
if res != ""
|
if res != ""
|
||||||
exe "normal! " . res . "\<Right>"
|
exe "normal! " . res . "\<Right>"
|
||||||
startinsert
|
startinsert
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
call vimwiki#lst#kbd_cr(a:normal, a:just_mrkr)
|
call vimwiki#lst#kbd_cr(a:normal, a:just_mrkr)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user