Add config to disable table mode syntax

Since table mode syntax can hamper performance, it is now possible to
disable it with a global config
This commit is contained in:
Dhruva Sagar
2017-01-04 15:45:48 +05:30
parent 441c30c35a
commit 9edd6d7d20
5 changed files with 15 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
# VIM Table Mode v4.6.4.3 [![Build Status](https://travis-ci.org/dhruvasagar/vim-table-mode.png?branch=master)](https://travis-ci.org/dhruvasagar/vim-table-mode)
# VIM Table Mode v4.6.4.4 [![Build Status](https://travis-ci.org/dhruvasagar/vim-table-mode.png?branch=master)](https://travis-ci.org/dhruvasagar/vim-table-mode)
An awesome automatic table creator & formatter allowing one to create neat
tables as you type.

View File

@@ -65,7 +65,7 @@ function! s:ToggleMapping() "{{{2
endif
endfunction
function! tablemode#SyntaxEnable()
function! tablemode#SyntaxEnable() "{{{2
exec 'syntax match Table'
\ '/' . tablemode#table#StartExpr() . '\zs|.\+|\ze' . tablemode#table#EndExpr() . '/'
\ 'contains=TableBorder,TableSeparator,TableColumnAlign containedin=ALL'
@@ -79,6 +79,8 @@ function! tablemode#SyntaxEnable()
endfunction
function! s:ToggleSyntax()
if !g:table_mode_syntax | return | endif
if tablemode#IsActive()
call tablemode#SyntaxEnable()
else

View File

@@ -1,7 +1,7 @@
*table-mode.txt* Table Mode for easy table formatting
===============================================================================
Table Mode, THE AWESOME AUTOMATIC TABLE CREATOR & FORMATTER
VERSION 4.6.4.3
VERSION 4.6.4.4
Author: Dhruva Sagar <http://dhruvasagar.com/>
License: MIT <http://opensource.org/licenses/MIT/>
@@ -169,6 +169,7 @@ Overview:
|table-mode-eval-formula-map| ... Set the eval formula mapping
|table-mode-echo-cell-map| ...... Set the echo cell mapping
|table-mode-sort-map| ........... Set the table sort mapping
|table-mode-syntax| ............. Control table mode syntax
g:loaded_table_mode *table-mode-loaded*
Use this option to disable the plugin: >
@@ -296,6 +297,11 @@ g:table_mode_sort_map *table-mode-sort-map*
current column. >
let g:table_mode_sort_map = '<Leader>ts'
>
g:table_mode_syntax *table-mode-syntax*
Control whether table mode should define table syntax definitions or
not. >
let g:table_mode_syntax = 1
<
===============================================================================
MAPPINGS *table-mode-mappings*

View File

@@ -44,18 +44,14 @@ call s:SetGlobalOptDefault('table_mode_eval_formula_map', '<Leader>tfe')
call s:SetGlobalOptDefault('table_mode_echo_cell_map', '<Leader>t?')
call s:SetGlobalOptDefault('table_mode_sort_map', '<Leader>ts')
call s:SetGlobalOptDefault('table_mode_syntax', 1)
function! s:TableEchoCell() "{{{1
if tablemode#table#IsRow('.')
echomsg '$' . tablemode#spreadsheet#RowNr('.') . ',' . tablemode#spreadsheet#ColumnNr('.')
endif
endfunction
augroup TableMode
au!
autocmd Syntax * if tablemode#IsActive() | call tablemode#SyntaxEnable() | endif
augroup END
" Define Commands & Mappings {{{1
if !g:table_mode_always_active "{{{2
exec "nnoremap <silent>" g:table_mode_map_prefix . g:table_mode_toggle_map ":<C-U>call tablemode#Toggle()<CR>"

View File

@@ -25,3 +25,5 @@ let g:table_mode_add_formula_map = '<Leader>tfa'
let g:table_mode_eval_formula_map = '<Leader>tfe'
let g:table_mode_echo_cell_map = '<Leader>t?'
let g:table_mode_sort_map = '<Leader>ts'
let g:table_mode_syntax = 1