diff --git a/autoload/tablemode.vim b/autoload/tablemode.vim index 11eea8e..1b86d60 100644 --- a/autoload/tablemode.vim +++ b/autoload/tablemode.vim @@ -53,35 +53,37 @@ function! s:ToggleMapping() "{{{2 " '|' is a special character, we need to map instead if g:table_mode_separator ==# '|' | let separator_map = '' | endif - if tablemode#IsActive() - call s:Map('(table-mode-tableize)', separator_map, 'i') - call s:Map('(table-mode-motion-up)', '{', 'n') - call s:Map('(table-mode-motion-down)', '}', 'n') - call s:Map('(table-mode-motion-left)', '[', 'n') - call s:Map('(table-mode-motion-right)', ']', 'n') + if !exists('g:table_mode_disable_mappings') + if tablemode#IsActive() + call s:Map('(table-mode-tableize)', separator_map, 'i') + call s:Map('(table-mode-motion-up)', '{', 'n') + call s:Map('(table-mode-motion-down)', '}', 'n') + call s:Map('(table-mode-motion-left)', '[', 'n') + call s:Map('(table-mode-motion-right)', ']', 'n') - call s:Map('(table-mode-cell-text-object-a)', 'a', 'ox') - call s:Map('(table-mode-cell-text-object-i)', 'i', 'ox') + call s:Map('(table-mode-cell-text-object-a)', 'a', 'ox') + call s:Map('(table-mode-cell-text-object-i)', 'i', 'ox') - call s:Map('(table-mode-realign)', 'tr', 'n') - call s:Map('(table-mode-delete-row)', 'tdd', 'n') - call s:Map('(table-mode-delete-column)', 'tdc', 'n') - call s:Map('(table-mode-add-formula)', 'tfa', 'n') - call s:Map('(table-mode-eval-formula)', 'tfe', 'n') - call s:Map('(table-mode-echo-cell)', 't?', 'n') - else - call s:UnMap(separator_map, 'i') - call s:UnMap('{', 'n') - call s:UnMap('}', 'n') - call s:UnMap('[', 'n') - call s:UnMap(']', 'n') - call s:UnMap('a', 'o') - call s:UnMap('i', 'o') - call s:UnMap('tdd', 'n') - call s:UnMap('tdc', 'n') - call s:UnMap('tfa', 'n') - call s:UnMap('tfe', 'n') - call s:UnMap('t?', 'n') + call s:Map('(table-mode-realign)', 'tr', 'n') + call s:Map('(table-mode-delete-row)', 'tdd', 'n') + call s:Map('(table-mode-delete-column)', 'tdc', 'n') + call s:Map('(table-mode-add-formula)', 'tfa', 'n') + call s:Map('(table-mode-eval-formula)', 'tfe', 'n') + call s:Map('(table-mode-echo-cell)', 't?', 'n') + else + call s:UnMap(separator_map, 'i') + call s:UnMap('{', 'n') + call s:UnMap('}', 'n') + call s:UnMap('[', 'n') + call s:UnMap(']', 'n') + call s:UnMap('a', 'o') + call s:UnMap('i', 'o') + call s:UnMap('tdd', 'n') + call s:UnMap('tdc', 'n') + call s:UnMap('tfa', 'n') + call s:UnMap('tfe', 'n') + call s:UnMap('t?', 'n') + endif endif endfunction diff --git a/doc/table-mode.txt b/doc/table-mode.txt index 944af2f..94ac6be 100644 --- a/doc/table-mode.txt +++ b/doc/table-mode.txt @@ -20,7 +20,7 @@ CONTENTS *table-mode-contents* INTRODUCTION *table-mode-introduction* Table Mode is simple plugin that makes building tables in vim a breeze. It is -inspired from tpope's auto aligning script for creating tables in vim - +inspired from tpope's auto aligning script for creating tables in vim - https://gist.github.com/tpope/287147, which in turn utilizes the Tabular Plugin. @@ -57,7 +57,7 @@ Move between cells : You can use |table-mode-map-prefix| option to define the prefix mapping to be used before 'hjkl'. The left | right motions wrap around the table and move to the next | previous row after the last | first - cell in the current row if one exists. + cell in the current row if one exists. Manipulation of tables: Tableize provides 3 easy ways to quickly manipulate tables. @@ -213,6 +213,9 @@ g:table_mode_align_char *table-mode-align-char* alignments for columns in the table header border. > let g:table_mode_align_char = ':' < +g:table_mode_disable_mappings table-mode-disable-mappings + Set this to true to disable all mappings. + let g:table_mode_disable_mappings = 1 =============================================================================== MAPPINGS *table-mode-mappings* @@ -224,7 +227,7 @@ MAPPINGS *table-mode-mappings* *table-mode-mappings-toggle* tm Toggle table mode for the current buffer. You can change this using the |toggle-mode-options-toggle-map| option. - + NOTE This is applicable only if |table-mode-always-active| is not set. @@ -272,7 +275,7 @@ MAPPINGS *table-mode-mappings* accordingly. This invokes the |TableEvalFormulaLine| command. || Expands to a header border. You can change this by changing - |table-mode-separator| option. You can change the character to + |table-mode-separator| option. You can change the character to be used for te extreme corners of the border by changing |table-mode-corner-corner| option. @@ -298,7 +301,7 @@ COMMANDS *table-mode-commands* *:TableModeDisable* *table-mode-:TableModeDisable* :TableModeDisable - Disables Table Mode. + Disables Table Mode. NOTE this is applicable only if |table-mode-always-active| is not set.