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.
|
||||
See |vimwiki-lists| for details and for how to
|
||||
configure the behavior.
|
||||
Remap command: `<Plug>VimwikiReturn15`
|
||||
|
||||
*vimwiki_i_<S-CR>*
|
||||
<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
|
||||
default map may not work in all terminals and may
|
||||
need to be remapped.
|
||||
Remap command: `<Plug>VimwikiReturn22`
|
||||
|
||||
*vimwiki_i_<C-T>*
|
||||
<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
|
||||
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>
|
||||
or press <CR> and <C-L><C-M>.
|
||||
is in a list item. If you use hard line wraps within your lists then you will
|
||||
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.
|
||||
|
||||
Furthermore, <CR> and <S-CR> behave differently when the cursor is behind an
|
||||
empty list item. See the table below.
|
||||
|
||||
To remap the default behavior: >
|
||||
:imap <Leader>e <Plug>VimwikiReturn15
|
||||
:imap <Leader>r <Plug>VimwikiReturn22
|
||||
To customize the behavior you should use an autocmd or place the mappings in
|
||||
`~/.vim/after/ftplugin/vimwiki.vim`. This is necessary to avoid an error that
|
||||
the command `VimwikiReturn` doesn't exist when editing non Vimwiki files.: >
|
||||
|
||||
To customize the behavior: >
|
||||
inoremap <CR> <Esc>:VimwikiReturn 1 1<CR>
|
||||
inoremap <S-CR> <Esc>:VimwikiReturn 3 5<CR>
|
||||
autocmd FileType vimwiki inoremap <silent><buffer> <CR>
|
||||
\ <C-]><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
|
||||
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>
|
||||
nnoremap <silent><buffer> <Plug>VimwikiListO
|
||||
\ :<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
|
||||
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', '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
|
||||
for s:char in vimwiki#vars#get_syntaxlocal('bullet_types')
|
||||
@ -521,13 +522,11 @@ if str2nr(vimwiki#vars#get_global('key_mappings').lists)
|
||||
endif
|
||||
|
||||
function! s:CR(normal, just_mrkr)
|
||||
if str2nr(vimwiki#vars#get_global('key_mappings').table_mappings)
|
||||
let res = vimwiki#tbl#kbd_cr()
|
||||
if res != ""
|
||||
exe "normal! " . res . "\<Right>"
|
||||
startinsert
|
||||
return
|
||||
endif
|
||||
let res = vimwiki#tbl#kbd_cr()
|
||||
if res != ""
|
||||
exe "normal! " . res . "\<Right>"
|
||||
startinsert
|
||||
return
|
||||
endif
|
||||
call vimwiki#lst#kbd_cr(a:normal, a:just_mrkr)
|
||||
endfunction
|
||||
|
Loading…
Reference in New Issue
Block a user