feat(vimwiki_key_mappings):add a flag lists_return

This commit is contained in:
yuuy
2020-12-19 11:12:06 +08:00
committed by Tinmarino
parent dbe332a095
commit 84928f7ace
2 changed files with 17 additions and 14 deletions
+2 -2
View File
@@ -166,8 +166,8 @@ function! s:get_default_global() abort
\ 'key_mappings': {'type': type({}), 'default':
\ {
\ 'all_maps': 1, 'global': 1, 'headers': 1, 'text_objs': 1,
\ 'table_format': 1, 'table_mappings': 1, 'lists': 1, 'links': 1,
\ 'html': 1, 'mouse': 0,
\ 'table_format': 1, 'table_mappings': 1, 'lists': 1, 'lists_return': 1,
\ 'links': 1, 'html': 1, 'mouse': 0,
\ }},
\ 'links_header': {'type': type(''), 'default': 'Generated Links', 'min_length': 1},
\ 'links_header_level': {'type': type(0), 'default': 1, 'min': 1, 'max': 6},
+15 -12
View File
@@ -535,20 +535,23 @@ if str2nr(vimwiki#vars#get_global('key_mappings').lists)
call vimwiki#u#map_key('n', 'o', '<Plug>VimwikiListo')
call vimwiki#u#map_key('n', 'O', '<Plug>VimwikiListO')
" Handle case of existing VimwikiReturn mappings outside the <Plug> definition
" Note: Avoid interfering with popup/completion menu if it's active (#813)
if maparg('<CR>', 'i') !~# '.*VimwikiReturn*.'
if has('patch-7.3.489')
" expand iabbrev on enter
inoremap <expr><silent><buffer> <CR> pumvisible() ? '<CR>' : '<C-]><Esc>:VimwikiReturn 1 5<CR>'
else
inoremap <expr><silent><buffer> <CR> pumvisible() ? '<CR>' : '<Esc>:VimwikiReturn 1 5<CR>'
" Set lists_return to 0, if you don't want <CR> mapped to VimwikiReturn
if str2nr(vimwiki#vars#get_global('key_mappings').lists_return)
" Handle case of existing VimwikiReturn mappings outside the <Plug> definition
" Note: Avoid interfering with popup/completion menu if it's active (#813)
if maparg('<CR>', 'i') !~# '.*VimwikiReturn*.'
if has('patch-7.3.489')
" expand iabbrev on enter
inoremap <expr><silent><buffer> <CR> pumvisible() ? '<CR>' : '<C-]><Esc>:VimwikiReturn 1 5<CR>'
else
inoremap <expr><silent><buffer> <CR> pumvisible() ? '<CR>' : '<Esc>:VimwikiReturn 1 5<CR>'
endif
endif
if maparg('<S-CR>', 'i') !~# '.*VimwikiReturn*.'
inoremap <expr><silent><buffer> <S-CR> pumvisible() ? '<CR>' : '<Esc>:VimwikiReturn 2 2<CR>'
endif
endif
if maparg('<S-CR>', 'i') !~# '.*VimwikiReturn*.'
inoremap <expr><silent><buffer> <S-CR> pumvisible() ? '<CR>' : '<Esc>:VimwikiReturn 2 2<CR>'
endif
" change symbol for bulleted lists
for s:char in vimwiki#vars#get_syntaxlocal('bullet_types')
if !hasmapto(':VimwikiChangeSymbolTo '.s:char.'<CR>')