mirror of
https://github.com/dhruvasagar/vim-table-mode.git
synced 2025-11-08 11:03:47 -05:00
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:
@@ -1,4 +1,4 @@
|
||||
# VIM Table Mode v4.6.4.3 [](https://travis-ci.org/dhruvasagar/vim-table-mode)
|
||||
# VIM Table Mode v4.6.4.4 [](https://travis-ci.org/dhruvasagar/vim-table-mode)
|
||||
|
||||
An awesome automatic table creator & formatter allowing one to create neat
|
||||
tables as you type.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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*
|
||||
|
||||
@@ -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>"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user