mirror of
https://github.com/dhruvasagar/vim-table-mode.git
synced 2025-11-09 11:33:47 -05:00
Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e41af8e5f | ||
|
|
35b41e0822 | ||
|
|
f5d4b4e46d | ||
|
|
d4cb68e8e1 | ||
|
|
79bf3f9bb7 | ||
|
|
ef66b3ec2f | ||
|
|
6584cee4a4 | ||
|
|
1eef73fc5b | ||
|
|
d3b70df0a6 | ||
|
|
096165718e | ||
|
|
30a3eba816 | ||
|
|
cc0055f329 | ||
|
|
8d3affcf5f | ||
|
|
9edd6d7d20 | ||
|
|
441c30c35a | ||
|
|
ebd16eef19 | ||
|
|
141efc3edd | ||
|
|
c82bc292c5 | ||
|
|
8209b59215 | ||
|
|
5b3b2f7c05 | ||
|
|
47f60d2972 | ||
|
|
0f680bfd1b | ||
|
|
19f2f5c26f | ||
|
|
e07c240940 | ||
|
|
8bacd0ba66 | ||
|
|
8309a33aa7 | ||
|
|
293c847cdf | ||
|
|
96236638a8 | ||
|
|
1d14a027a8 | ||
|
|
e490373435 | ||
|
|
b420dedbf5 |
@@ -1,4 +1,4 @@
|
|||||||
language: ruby
|
language: ruby
|
||||||
rvm:
|
rvm:
|
||||||
- 2.2.0
|
- 2.3.0
|
||||||
script: rake ci
|
script: rake ci
|
||||||
|
|||||||
2
Gemfile
2
Gemfile
@@ -1,5 +1,5 @@
|
|||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
ruby '2.2.0'
|
ruby '2.3.0'
|
||||||
gem 'rake'
|
gem 'rake'
|
||||||
gem 'vim-flavor', '~> 1.1'
|
gem 'vim-flavor', '~> 1.1'
|
||||||
|
|||||||
30
README.md
30
README.md
@@ -1,4 +1,4 @@
|
|||||||
# VIM Table Mode v4.6.4.1 [](https://travis-ci.org/dhruvasagar/vim-table-mode)
|
# VIM Table Mode v4.6.7 [](https://travis-ci.org/dhruvasagar/vim-table-mode)
|
||||||
|
|
||||||
An awesome automatic table creator & formatter allowing one to create neat
|
An awesome automatic table creator & formatter allowing one to create neat
|
||||||
tables as you type.
|
tables as you type.
|
||||||
@@ -21,6 +21,7 @@ There are several ways to do this
|
|||||||
$ cd ~/.vim
|
$ cd ~/.vim
|
||||||
$ git submodule add git@github.com:dhruvasagar/vim-table-mode.git bundle/table-mode
|
$ git submodule add git@github.com:dhruvasagar/vim-table-mode.git bundle/table-mode
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Copy all files under autoload/, plugin/, doc/ to respective
|
3. Copy all files under autoload/, plugin/, doc/ to respective
|
||||||
~/.vim/autoload/, ~/.vim/plugin and ~/.vim/doc under UNIX or
|
~/.vim/autoload/, ~/.vim/plugin and ~/.vim/doc under UNIX or
|
||||||
vimfiles/autoload/, vimfiles/plugin/ and vimfiles/doc under WINDOWS and
|
vimfiles/autoload/, vimfiles/plugin/ and vimfiles/doc under WINDOWS and
|
||||||
@@ -28,7 +29,26 @@ $ git submodule add git@github.com:dhruvasagar/vim-table-mode.git bundle/table-m
|
|||||||
|
|
||||||
### Creating table on-the-fly
|
### Creating table on-the-fly
|
||||||
|
|
||||||
To start using the plugin in the on-the-fly mode use `:TableModeToggle` mapped to <kbd>\<Leader\>tm</kbd> by default (which means <kbd>\\</kbd> <kbd>t</kbd> <kbd>m</kbd> if you didn't override the <Leader> by `:let mapleader = ","` to have <kbd>,</kbd> <kbd>t</kbd> <kbd>m</kbd>).
|
To start using the plugin in the on-the-fly mode use `:TableModeToggle` mapped to <kbd>\<Leader\>tm</kbd> by default (which means <kbd>\\</kbd> <kbd>t</kbd> <kbd>m</kbd> if you didn't override the <Leader> by `:let mapleader = ','` to have <kbd>,</kbd> <kbd>t</kbd> <kbd>m</kbd>).
|
||||||
|
|
||||||
|
> Tip :
|
||||||
|
> You can use the following to quickly enable / disable table mode in insert
|
||||||
|
> mode by using `||` or `__` :
|
||||||
|
> ```vim
|
||||||
|
> function! s:isAtStartOfLine(mapping)
|
||||||
|
> let text_before_cursor = getline('.')[0 : col('.')-1]
|
||||||
|
> let mapping_pattern = '\V' . escape(a:mapping, '\')
|
||||||
|
> let comment_pattern = '\V' . escape(substitute(&l:commentstring, '%s.*$', '', ''), '\')
|
||||||
|
> return (text_before_cursor =~? '^' . ('\v(' . comment_pattern . '\v)?') . '\s*\v' . mapping_pattern . '\v$')
|
||||||
|
> endfunction
|
||||||
|
>
|
||||||
|
> inoreabbrev <expr> <bar><bar>
|
||||||
|
> \ <SID>isAtStartOfLine('\|\|') ?
|
||||||
|
> \ '<c-o>:TableModeEnable<cr><bar><space><bar><left><left>' : '<bar><bar>'
|
||||||
|
> inoreabbrev <expr> __
|
||||||
|
> \ <SID>isAtStartOfLine('__') ?
|
||||||
|
> \ '<c-o>:silent! TableModeDisable<cr>' : '__'
|
||||||
|
> ```
|
||||||
|
|
||||||
Enter the first line, delimiting columns by the `|` symbol. The plugin reacts by inserting spaces between the text and the separator if you omit them:
|
Enter the first line, delimiting columns by the `|` symbol. The plugin reacts by inserting spaces between the text and the separator if you omit them:
|
||||||
|
|
||||||
@@ -68,7 +88,7 @@ Corner separators are adjustable:
|
|||||||
|
|
||||||
For Markdown-compatible tables use
|
For Markdown-compatible tables use
|
||||||
|
|
||||||
let g:table_mode_corner="|"
|
let g:table_mode_corner='|'
|
||||||
|
|
||||||
|
|
||||||
|-----------------|--------------------------|------------|
|
|-----------------|--------------------------|------------|
|
||||||
@@ -81,8 +101,8 @@ For Markdown-compatible tables use
|
|||||||
|
|
||||||
To get ReST-compatible tables use
|
To get ReST-compatible tables use
|
||||||
|
|
||||||
let g:table_mode_corner_corner="+"
|
let g:table_mode_corner_corner='+'
|
||||||
let g:table_mode_header_fillchar="="
|
let g:table_mode_header_fillchar='='
|
||||||
|
|
||||||
|
|
||||||
+-----------------+--------------------------+------------+
|
+-----------------+--------------------------+------------+
|
||||||
|
|||||||
@@ -65,7 +65,10 @@ function! s:ToggleMapping() "{{{2
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! tablemode#SyntaxEnable()
|
function! s:ToggleSyntax() "{{{2
|
||||||
|
if !g:table_mode_syntax | return | endif
|
||||||
|
|
||||||
|
if tablemode#IsActive()
|
||||||
exec 'syntax match Table'
|
exec 'syntax match Table'
|
||||||
\ '/' . tablemode#table#StartExpr() . '\zs|.\+|\ze' . tablemode#table#EndExpr() . '/'
|
\ '/' . tablemode#table#StartExpr() . '\zs|.\+|\ze' . tablemode#table#EndExpr() . '/'
|
||||||
\ 'contains=TableBorder,TableSeparator,TableColumnAlign containedin=ALL'
|
\ 'contains=TableBorder,TableSeparator,TableColumnAlign containedin=ALL'
|
||||||
@@ -76,11 +79,6 @@ function! tablemode#SyntaxEnable()
|
|||||||
hi! link TableBorder Delimiter
|
hi! link TableBorder Delimiter
|
||||||
hi! link TableSeparator Delimiter
|
hi! link TableSeparator Delimiter
|
||||||
hi! link TableColumnAlign Type
|
hi! link TableColumnAlign Type
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:ToggleSyntax()
|
|
||||||
if tablemode#IsActive()
|
|
||||||
call tablemode#SyntaxEnable()
|
|
||||||
else
|
else
|
||||||
syntax clear Table
|
syntax clear Table
|
||||||
syntax clear TableBorder
|
syntax clear TableBorder
|
||||||
@@ -93,10 +91,35 @@ function! s:ToggleSyntax()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:ToggleAutoAlign() "{{{2
|
||||||
|
if !g:table_mode_auto_align | return | endif
|
||||||
|
|
||||||
|
if tablemode#IsActive()
|
||||||
|
augroup TableModeAutoAlign
|
||||||
|
au!
|
||||||
|
|
||||||
|
autocmd CursorHold <buffer> nested silent! call tablemode#table#Realign('.')
|
||||||
|
augroup END
|
||||||
|
else
|
||||||
|
silent! augroup! TableModeAutoAlign
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:ToggleOptions() "{{{2
|
||||||
|
if tablemode#IsActive()
|
||||||
|
let b:old_update_time = &updatetime
|
||||||
|
exec 'set updatetime='.g:table_mode_update_time
|
||||||
|
else
|
||||||
|
exec 'set updatetime='.get(b:, 'old_update_time', 4000)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:SetActive(bool) "{{{2
|
function! s:SetActive(bool) "{{{2
|
||||||
let b:table_mode_active = a:bool
|
let b:table_mode_active = a:bool
|
||||||
call s:ToggleSyntax()
|
call s:ToggleSyntax()
|
||||||
call s:ToggleMapping()
|
call s:ToggleMapping()
|
||||||
|
call s:ToggleAutoAlign()
|
||||||
|
call s:ToggleOptions()
|
||||||
if tablemode#IsActive()
|
if tablemode#IsActive()
|
||||||
doautocmd User TableModeEnabled
|
doautocmd User TableModeEnabled
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
function! tablemode#logger#log(message)
|
function! tablemode#logger#log(message)
|
||||||
if g:table_mode_verbose
|
if g:table_mode_verbose
|
||||||
echom message
|
echom a:message
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
" Private Functions {{{1
|
" Private Functions {{{1
|
||||||
|
function! s:IsFormulaLine(line) "{{{2
|
||||||
|
return getline(a:line) =~# 'tmf: '
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Public Functions {{{1
|
" Public Functions {{{1
|
||||||
function! tablemode#spreadsheet#formula#Add(...) "{{{2
|
function! tablemode#spreadsheet#formula#Add(...) "{{{2
|
||||||
@@ -105,14 +108,21 @@ function! tablemode#spreadsheet#formula#EvaluateFormulaLine() abort "{{{2
|
|||||||
let line = tablemode#spreadsheet#GetLastRow('.')
|
let line = tablemode#spreadsheet#GetLastRow('.')
|
||||||
let fline = line + 1
|
let fline = line + 1
|
||||||
if tablemode#table#IsBorder(fline) | let fline += 1 | endif
|
if tablemode#table#IsBorder(fline) | let fline += 1 | endif
|
||||||
if getline(fline) =~# 'tmf: '
|
while s:IsFormulaLine(fline)
|
||||||
let exprs = split(matchstr(getline(fline), matchexpr), ';')
|
let exprs += split(matchstr(getline(fline), matchexpr), ';')
|
||||||
endif
|
let fline += 1
|
||||||
elseif getline('.') =~# 'tmf: ' " We're on the formula line
|
endwhile
|
||||||
|
elseif s:IsFormulaLine('.')
|
||||||
|
let fline = line('.')
|
||||||
let line = line('.') - 1
|
let line = line('.') - 1
|
||||||
|
while s:IsFormulaLine(line) | let fline = line | let line -= 1 | endwhile
|
||||||
if tablemode#table#IsBorder(line) | let line -= 1 | endif
|
if tablemode#table#IsBorder(line) | let line -= 1 | endif
|
||||||
if tablemode#table#IsRow(line)
|
if tablemode#table#IsRow(line)
|
||||||
let exprs = split(matchstr(getline('.'), matchexpr), ';')
|
" let exprs = split(matchstr(getline('.'), matchexpr), ';')
|
||||||
|
while s:IsFormulaLine(fline)
|
||||||
|
let exprs += split(matchstr(getline(fline), matchexpr), ';')
|
||||||
|
let fline += 1
|
||||||
|
endwhile
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
" Private Functions {{{1
|
" Private Functions {{{1
|
||||||
|
function! s:blank(string) "{{{2
|
||||||
|
return a:string =~# '^\s*$'
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:BorderExpr() "{{{2
|
function! s:BorderExpr() "{{{2
|
||||||
return tablemode#table#StartExpr() .
|
return tablemode#table#StartExpr() .
|
||||||
\ '[' . g:table_mode_corner . g:table_mode_corner_corner . ']' .
|
\ '[' . g:table_mode_corner . g:table_mode_corner_corner . ']' .
|
||||||
@@ -27,14 +31,11 @@ function! s:GenerateHeaderBorder(line) "{{{2
|
|||||||
endif
|
endif
|
||||||
if tablemode#utils#strlen(line_val) <= 1 | return s:DefaultBorder() | endif
|
if tablemode#utils#strlen(line_val) <= 1 | return s:DefaultBorder() | endif
|
||||||
|
|
||||||
let border = substitute(line_val[stridx(line_val, g:table_mode_separator):strridx(line_val, g:table_mode_separator)], g:table_mode_separator, g:table_mode_corner, 'g')
|
let tline = line_val[stridx(line_val, g:table_mode_separator):strridx(line_val, g:table_mode_separator)]
|
||||||
" To accurately deal with unicode double width characters
|
let fillchar = tablemode#table#IsHeader(line - 1) ? g:table_mode_header_fillchar : g:table_mode_fillchar
|
||||||
if tablemode#table#IsHeader(line - 1)
|
let seperator_match_regex = g:table_mode_separator . '\zs\([^' . g:table_mode_separator . ']*\)\ze' . g:table_mode_separator
|
||||||
let fill_columns = map(split(border, g:table_mode_corner), 'repeat(g:table_mode_header_fillchar, tablemode#utils#StrDisplayWidth(v:val))')
|
let border = substitute(tline, seperator_match_regex, '\=repeat(fillchar, tablemode#utils#StrDisplayWidth(submatch(0)))', 'g')
|
||||||
else
|
let border = substitute(border, g:table_mode_separator, g:table_mode_corner, 'g')
|
||||||
let fill_columns = map(split(border, g:table_mode_corner), 'repeat(g:table_mode_fillchar, tablemode#utils#StrDisplayWidth(v:val))')
|
|
||||||
endif
|
|
||||||
let border = g:table_mode_corner . join(fill_columns, g:table_mode_corner) . g:table_mode_corner
|
|
||||||
let border = substitute(border, '^' . g:table_mode_corner . '\(.*\)' . g:table_mode_corner . '$', g:table_mode_corner_corner . '\1' . g:table_mode_corner_corner, '')
|
let border = substitute(border, '^' . g:table_mode_corner . '\(.*\)' . g:table_mode_corner . '$', g:table_mode_corner_corner . '\1' . g:table_mode_corner_corner, '')
|
||||||
|
|
||||||
" Incorporate header alignment chars
|
" Incorporate header alignment chars
|
||||||
@@ -135,7 +136,7 @@ function! tablemode#table#EndExpr() "{{{2
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! tablemode#table#IsBorder(line) "{{{2
|
function! tablemode#table#IsBorder(line) "{{{2
|
||||||
return !empty(getline(a:line)) && getline(a:line) =~# s:BorderExpr()
|
return !s:blank(getline(a:line)) && getline(a:line) =~# s:BorderExpr()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! tablemode#table#IsHeader(line) "{{{2
|
function! tablemode#table#IsHeader(line) "{{{2
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
*table-mode.txt* Table Mode for easy table formatting
|
*table-mode.txt* Table Mode for easy table formatting
|
||||||
===============================================================================
|
===============================================================================
|
||||||
Table Mode, THE AWESOME AUTOMATIC TABLE CREATOR & FORMATTER
|
Table Mode, THE AWESOME AUTOMATIC TABLE CREATOR & FORMATTER
|
||||||
VERSION 4.6.4.1
|
VERSION 4.6.7
|
||||||
|
|
||||||
Author: Dhruva Sagar <http://dhruvasagar.com/>
|
Author: Dhruva Sagar <http://dhruvasagar.com/>
|
||||||
License: MIT <http://opensource.org/licenses/MIT/>
|
License: MIT <http://opensource.org/licenses/MIT/>
|
||||||
@@ -138,6 +138,7 @@ OPTIONS *table-mode-options*
|
|||||||
|
|
||||||
Overview:
|
Overview:
|
||||||
|table-mode-loaded| ............. Disable the plugin.
|
|table-mode-loaded| ............. Disable the plugin.
|
||||||
|
|table-mode-verbose| ............ Notify when Enabled/Disabled.
|
||||||
|table-mode-corner| ............. Set corner character.
|
|table-mode-corner| ............. Set corner character.
|
||||||
|table-mode-separator| .......... Set separator character.
|
|table-mode-separator| .......... Set separator character.
|
||||||
|table-mode-fillchar| ........... Set table fillchar character.
|
|table-mode-fillchar| ........... Set table fillchar character.
|
||||||
@@ -168,11 +169,18 @@ Overview:
|
|||||||
|table-mode-eval-formula-map| ... Set the eval formula mapping
|
|table-mode-eval-formula-map| ... Set the eval formula mapping
|
||||||
|table-mode-echo-cell-map| ...... Set the echo cell mapping
|
|table-mode-echo-cell-map| ...... Set the echo cell mapping
|
||||||
|table-mode-sort-map| ........... Set the table sort 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*
|
g:loaded_table_mode *table-mode-loaded*
|
||||||
Use this option to disable the plugin: >
|
Use this option to disable the plugin: >
|
||||||
let g:loaded_table_mode = 1
|
let g:loaded_table_mode = 1
|
||||||
<
|
<
|
||||||
|
g:table_mode_verbose *table-mode-verbose*
|
||||||
|
Use this option to disable notifications: >
|
||||||
|
let g:table_mode_verbose = 0
|
||||||
|
<
|
||||||
g:table_mode_corner *table-mode-corner*
|
g:table_mode_corner *table-mode-corner*
|
||||||
Use this option to define the table corner character: >
|
Use this option to define the table corner character: >
|
||||||
let g:table_mode_corner = '+'
|
let g:table_mode_corner = '+'
|
||||||
@@ -291,6 +299,22 @@ g:table_mode_sort_map *table-mode-sort-map*
|
|||||||
current column. >
|
current column. >
|
||||||
let g:table_mode_sort_map = '<Leader>ts'
|
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
|
||||||
|
<
|
||||||
|
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
|
||||||
|
<
|
||||||
|
|
||||||
|
g:table_mode_update_time *table-mode-update-time*
|
||||||
|
Set the value of updatetime to be used when table mode is active,
|
||||||
|
used in combination with |table-mode-auto-align|. >
|
||||||
|
let g:table_mode_update_time = 500
|
||||||
|
<
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
MAPPINGS *table-mode-mappings*
|
MAPPINGS *table-mode-mappings*
|
||||||
@@ -355,7 +379,7 @@ MAPPINGS *table-mode-mappings*
|
|||||||
|
|
||||||
|| Expands to a header border. You can change this by changing
|
|| 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
|
be used for the extreme corners of the border by changing
|
||||||
|table-mode-corner-corner| option.
|
|table-mode-corner-corner| option.
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ endfunction
|
|||||||
|
|
||||||
" Set Global Defaults {{{1
|
" Set Global Defaults {{{1
|
||||||
call s:SetGlobalOptDefault('table_mode_corner', '+')
|
call s:SetGlobalOptDefault('table_mode_corner', '+')
|
||||||
call s:SetGlobalOptDefault('table_mode_verbose', 0)
|
call s:SetGlobalOptDefault('table_mode_verbose', 1)
|
||||||
call s:SetGlobalOptDefault('table_mode_separator', '|')
|
call s:SetGlobalOptDefault('table_mode_separator', '|')
|
||||||
call s:SetGlobalOptDefault('table_mode_fillchar', '-')
|
call s:SetGlobalOptDefault('table_mode_fillchar', '-')
|
||||||
call s:SetGlobalOptDefault('table_mode_header_fillchar', '-')
|
call s:SetGlobalOptDefault('table_mode_header_fillchar', '-')
|
||||||
@@ -44,22 +44,19 @@ 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_echo_cell_map', '<Leader>t?')
|
||||||
call s:SetGlobalOptDefault('table_mode_sort_map', '<Leader>ts')
|
call s:SetGlobalOptDefault('table_mode_sort_map', '<Leader>ts')
|
||||||
|
|
||||||
|
call s:SetGlobalOptDefault('table_mode_syntax', 1)
|
||||||
|
call s:SetGlobalOptDefault('table_mode_auto_align', 1)
|
||||||
|
call s:SetGlobalOptDefault('table_mode_update_time', 500)
|
||||||
|
|
||||||
function! s:TableEchoCell() "{{{1
|
function! s:TableEchoCell() "{{{1
|
||||||
if tablemode#table#IsRow('.')
|
if tablemode#table#IsRow('.')
|
||||||
echomsg '$' . tablemode#spreadsheet#RowNr('.') . ',' . tablemode#spreadsheet#ColumnNr('.')
|
echomsg '$' . tablemode#spreadsheet#RowNr('.') . ',' . tablemode#spreadsheet#ColumnNr('.')
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
augroup TableMode
|
|
||||||
au!
|
|
||||||
|
|
||||||
autocmd Syntax * if tablemode#IsActive() | call tablemode#SyntaxEnable() | endif
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
" Define Commands & Mappings {{{1
|
" Define Commands & Mappings {{{1
|
||||||
if !g:table_mode_always_active "{{{2
|
if !g:table_mode_always_active "{{{2
|
||||||
exec "nnoremap <silent> " . g:table_mode_map_prefix . g:table_mode_toggle_map .
|
exec "nnoremap <silent>" g:table_mode_map_prefix . g:table_mode_toggle_map ":<C-U>call tablemode#Toggle()<CR>"
|
||||||
\ " <Esc>:call tablemode#Toggle()<CR>"
|
|
||||||
command! -nargs=0 TableModeToggle call tablemode#Toggle()
|
command! -nargs=0 TableModeToggle call tablemode#Toggle()
|
||||||
command! -nargs=0 TableModeEnable call tablemode#Enable()
|
command! -nargs=0 TableModeEnable call tablemode#Enable()
|
||||||
command! -nargs=0 TableModeDisable call tablemode#Disable()
|
command! -nargs=0 TableModeDisable call tablemode#Disable()
|
||||||
@@ -111,8 +108,8 @@ nnoremap <silent> <Plug>(table-mode-echo-cell) :call <SID>TableEchoCell()<CR>
|
|||||||
nnoremap <silent> <Plug>(table-mode-sort) :call tablemode#spreadsheet#Sort('')<CR>
|
nnoremap <silent> <Plug>(table-mode-sort) :call tablemode#spreadsheet#Sort('')<CR>
|
||||||
|
|
||||||
if !hasmapto('<Plug>(table-mode-tableize)')
|
if !hasmapto('<Plug>(table-mode-tableize)')
|
||||||
exec "nmap " . g:table_mode_map_prefix . "t <Plug>(table-mode-tableize)"
|
exec "nmap" g:table_mode_map_prefix . "t <Plug>(table-mode-tableize)"
|
||||||
exec "xmap " . g:table_mode_map_prefix . "t <Plug>(table-mode-tableize)"
|
exec "xmap" g:table_mode_map_prefix . "t <Plug>(table-mode-tableize)"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !hasmapto('<Plug>(table-mode-tableize-delimiter)')
|
if !hasmapto('<Plug>(table-mode-tableize-delimiter)')
|
||||||
|
|||||||
@@ -25,3 +25,7 @@ let g:table_mode_add_formula_map = '<Leader>tfa'
|
|||||||
let g:table_mode_eval_formula_map = '<Leader>tfe'
|
let g:table_mode_eval_formula_map = '<Leader>tfe'
|
||||||
let g:table_mode_echo_cell_map = '<Leader>t?'
|
let g:table_mode_echo_cell_map = '<Leader>t?'
|
||||||
let g:table_mode_sort_map = '<Leader>ts'
|
let g:table_mode_sort_map = '<Leader>ts'
|
||||||
|
|
||||||
|
let g:table_mode_syntax = 1
|
||||||
|
let g:table_mode_auto_align = 1
|
||||||
|
let g:table_mode_update_time = 500
|
||||||
|
|||||||
Reference in New Issue
Block a user