From 609fc5f50966dfe5ef06ecd8eca3bdfcba9d37f4 Mon Sep 17 00:00:00 2001 From: Amit Beka Date: Thu, 19 Nov 2020 14:55:19 +0200 Subject: [PATCH] Map: Enable changing insert mode table mappings (#1048) Mapping `` and `` at insert mode sometimes collide with other plugins which utilize these for completions (e.g. coc example mapping). Since for many users the case for completion is more frequent than table editing, this patch enables changing these mappings using the options `VimwikiTableNextCell` and `VimwikiTablePrevCell`. This patch makes it easier of those using multiple plugins and have no desire or knowledge in debugging the collision. It complements #1030 by providing a more direct and documented method for setting custom keymappings. Signed-off-by: Amit Beka <---> Co-authored-by: Amit Beka <---> --- doc/vimwiki.txt | 11 ++++++++++- ftplugin/vimwiki.vim | 8 ++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index 6e15d2f..0b21c1b 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -612,7 +612,14 @@ TABLE MAPPINGS, INSERT MODE *vimwiki-table-mappings* *vimwiki_i__table* Go to the next table cell, create a new row if on the - last cell. + last cell. Adjusts the whole column width according + to the largest cell. + Remap command: `VimwikiTableNextCell` + + *vimwiki_i__table* + Go to the previous table cell. Adjusts the whole + column width according to the largest cell. + Remap command: `VimwikiTablePrevCell` LIST MAPPINGS, INSERT MODE *vimwiki-list-mappings* *vimwiki_i_* @@ -3844,6 +3851,7 @@ Contributors and their Github usernames in roughly chronological order: - Daniel Moura (@dmouraneto) - Tomáš Janoušek (@liskin) - Rajesh Sharem (@deepredsky) + - Amit Beka (@amitbeka) ============================================================================== 16. Changelog *vimwiki-changelog* @@ -3855,6 +3863,7 @@ http://code.google.com/p/vimwiki/issues/list. They may be accessible from https://github.com/vimwiki-backup/vimwiki/issues. New:~ + * Feature: enable re-mapping insert mode table mappings * Feature: #954 #1041: Add option |vimwiki-option-listsyms_propagate| to disable todo propagation to parents/children * Issue #1009: |foldmethod| syntax works for markdown (|g:vimwiki_folding|) diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim index d6c8973..cfa7587 100644 --- a/ftplugin/vimwiki.vim +++ b/ftplugin/vimwiki.vim @@ -595,9 +595,13 @@ function! s:CR(normal, just_mrkr) abort endfunction " insert mode table mappings +inoremap VimwikiTableNextCell + \ vimwiki#tbl#kbd_tab() +inoremap VimwikiTablePrevCell + \ vimwiki#tbl#kbd_shift_tab() if str2nr(vimwiki#vars#get_global('key_mappings').table_mappings) - inoremap vimwiki#tbl#kbd_tab() - inoremap vimwiki#tbl#kbd_shift_tab() + call vimwiki#u#map_key('i', '', 'VimwikiTableNextCell') + call vimwiki#u#map_key('i', '', 'VimwikiTablePrevCell') endif " table formatting definitions