mirror of
https://github.com/dhruvasagar/vim-table-mode.git
synced 2025-11-08 11:03:47 -05:00
Add option to auto align table while editing #73
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# VIM Table Mode v4.6.4.4 [](https://travis-ci.org/dhruvasagar/vim-table-mode)
|
||||
# VIM Table Mode v4.6.5 [](https://travis-ci.org/dhruvasagar/vim-table-mode)
|
||||
|
||||
An awesome automatic table creator & formatter allowing one to create neat
|
||||
tables as you type.
|
||||
|
||||
@@ -91,10 +91,25 @@ function! s:ToggleSyntax() "{{{2
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:ToggleAutoAlign() "{{{2
|
||||
if !g:table_mode_auto_align | return | endif
|
||||
|
||||
if tablemode#IsActive()
|
||||
augroup TableModeAutoAlign
|
||||
au!
|
||||
|
||||
autocmd CursorHold,CursorHoldI * nested silent! call tablemode#table#Realign('.')
|
||||
augroup END
|
||||
else
|
||||
silent! augroup! TableModeAutoAlign
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:SetActive(bool) "{{{2
|
||||
let b:table_mode_active = a:bool
|
||||
call s:ToggleSyntax()
|
||||
call s:ToggleMapping()
|
||||
call s:ToggleAutoAlign()
|
||||
if tablemode#IsActive()
|
||||
doautocmd User TableModeEnabled
|
||||
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.4
|
||||
VERSION 4.6.5
|
||||
|
||||
Author: Dhruva Sagar <http://dhruvasagar.com/>
|
||||
License: MIT <http://opensource.org/licenses/MIT/>
|
||||
@@ -170,6 +170,8 @@ Overview:
|
||||
|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
|
||||
|table-mode-auto-align| ......... Set if the table mode should auto
|
||||
align as you type
|
||||
|
||||
g:loaded_table_mode *table-mode-loaded*
|
||||
Use this option to disable the plugin: >
|
||||
@@ -302,6 +304,11 @@ g:table_mode_syntax *table-mode-syntax*
|
||||
not. >
|
||||
let g:table_mode_syntax = 1
|
||||
<
|
||||
g:table_mode_auto_align *table-mode-auto-align*
|
||||
Set if the table mode should auto align as you type when table mode is
|
||||
active. >
|
||||
let g:table_mode_auto_align = 1
|
||||
<
|
||||
|
||||
===============================================================================
|
||||
MAPPINGS *table-mode-mappings*
|
||||
|
||||
@@ -45,6 +45,7 @@ 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)
|
||||
call s:SetGlobalOptDefault('table_mode_auto_align', 1)
|
||||
|
||||
function! s:TableEchoCell() "{{{1
|
||||
if tablemode#table#IsRow('.')
|
||||
|
||||
@@ -27,3 +27,4 @@ let g:table_mode_echo_cell_map = '<Leader>t?'
|
||||
let g:table_mode_sort_map = '<Leader>ts'
|
||||
|
||||
let g:table_mode_syntax = 1
|
||||
let g:table_mode_auto_align = 1
|
||||
|
||||
Reference in New Issue
Block a user