Compare commits

..

8 Commits

Author SHA1 Message Date
Dhruva Sagar
63cb175d57 Releasing v4.1.0
* Fixed bad references within plugin.
* Added fixtures for cleaner tests.
* Updated readme, changelog & doc
2014-04-07 19:15:52 +05:30
Dhruva Sagar
4eae4a659d Merge branch 'master' of github.com:dhruvasagar/vim-table-mode 2014-04-07 19:11:05 +05:30
Dhruva Sagar
5012486cbe Fixed function references in plugin 2014-04-07 19:10:26 +05:30
Dhruva Sagar
12f4c39982 Added silent! to ignore errors on disabling errors 2014-04-07 19:09:20 +05:30
Dhruva Sagar
943496c535 Added fixtures 2014-04-07 19:09:02 +05:30
Dhruva Sagar
151d489a53 Update README.md 2014-04-07 17:31:40 +05:30
Dhruva Sagar
aa5b5ef526 Update README.md 2014-04-07 16:17:27 +05:30
Dhruva Sagar
a0207b7895 Updated README & CHANGELOG 2014-04-07 15:37:38 +05:30
18 changed files with 61 additions and 53 deletions

View File

@@ -1,4 +1,15 @@
# Change Log # Change Log
## Version 4.1.0
* Fixed bad references within plugin
* Added fixtures
## Version 4.0.0
* Major refactoring of the codebase.
* Improved modular tests.
* Fixed long standing unicode character alignment issue.
* Moved to providing <Plug> mappings rather than configuration based mappings
which can be more easily overriden by end user.
## Version 3.3.2 ## Version 3.3.2
* Added new mapping \t? to echo a cells representation for use while defining * Added new mapping \t? to echo a cells representation for use while defining
formulas. formulas.

View File

@@ -1,4 +1,4 @@
# VIM Table Mode [![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.1.0 [![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 An awesome automatic table creator & formatter allowing one to create neat
tables as you type. tables as you type.
@@ -72,29 +72,20 @@ $ git submodule add git@github.com:dhruvasagar/vim-table-mode.git bundle/table-m
- **Move between cells** : - **Move between cells** :
Now you can move between cells using table mode motions <kbd>\<Leader\>t[hjkl]</kbd> Now you can move between cells using table mode motions <kbd>[|</kbd>,
to move left | down | up | right cells respectively. You can use <kbd>]|</kbd>, <kbd>{|</kbd> & <kbd>}|</kbd> to move left | right | up |
`g:table_mode_map_prefix` option to define the prefix mapping to be used down cells respectively. The left | right motions wrap around the table
before 'hjkl'. The left | right motions wrap around the table and move to and move to the next | previous row after the last | first cell in the
the next | previous row after the last | first cell in the current row if current row if one exists.
one exists.
- **Manipulating Table** : - **Manipulating Table** :
- **Cell Text Object** : - **Cell Text Object** :
Tableize provides a text object for manipulating table cells. By default Tableize provides a text object for manipulating table cells. Following
it's <kbd>tc</kbd>, but that can be changed if you wish to by setting the the vim philosophy the you have <kbd>i|</kbd> & <kbd>a|</kbd> for the
`g:table_mode_cell_text_object` option. inner and around (including the immidiate right table separator) the
table cell.
This is intelligent in the sense that if you use it to delete the
contents it will delete everything till the `g:table_mode_separator` so
that the cell is removed and you can enter new stuff if you wish to (had
you used 'c' operator), having to input the `g:table_mode_separator`
again to form the cell & realign it (since it can't be done from the
text object itself). However if you were to 'y' or yank the text, it
would copy the right text, i.e. the contents of the cell and nothing
else.
- **Delete Row** : - **Delete Row** :

View File

@@ -4,7 +4,7 @@
" Author: Dhruva Sagar <http://dhruvasagar.com/> " Author: Dhruva Sagar <http://dhruvasagar.com/>
" License: MIT (http://www.opensource.org/licenses/MIT) " License: MIT (http://www.opensource.org/licenses/MIT)
" Website: https://github.com/dhruvasagar/vim-table-mode " Website: https://github.com/dhruvasagar/vim-table-mode
" Version: 4.0.0 " Version: 4.1.0
" Note: This plugin was heavily inspired by the 'CucumberTables.vim' " Note: This plugin was heavily inspired by the 'CucumberTables.vim'
" (https://gist.github.com/tpope/287147) plugin by Tim Pope. " (https://gist.github.com/tpope/287147) plugin by Tim Pope.
" "
@@ -49,7 +49,7 @@ function! s:ToggleMapping() "{{{2
execute "inoremap <silent> <buffer> " . b:table_mode_separator_map . ' ' . execute "inoremap <silent> <buffer> " . b:table_mode_separator_map . ' ' .
\ b:table_mode_separator_map . "<Esc>:call tablemode#TableizeInsertMode()<CR>a" \ b:table_mode_separator_map . "<Esc>:call tablemode#TableizeInsertMode()<CR>a"
else else
execute "iunmap <silent> <buffer> " . b:table_mode_separator_map silent! execute "iunmap <silent> <buffer> " . b:table_mode_separator_map
endif endif
endfunction endfunction

View File

@@ -4,7 +4,7 @@
" Author: Dhruva Sagar <http://dhruvasagar.com/> " Author: Dhruva Sagar <http://dhruvasagar.com/>
" License: MIT (http://www.opensource.org/licenses/MIT) " License: MIT (http://www.opensource.org/licenses/MIT)
" Website: https://github.com/dhruvasagar/vim-table-mode " Website: https://github.com/dhruvasagar/vim-table-mode
" Version: 4.0.0 " Version: 4.1.0
" Note: This plugin was heavily inspired by the 'CucumberTables.vim' " Note: This plugin was heavily inspired by the 'CucumberTables.vim'
" (https://gist.github.com/tpope/287147) plugin by Tim Pope. " (https://gist.github.com/tpope/287147) plugin by Tim Pope.
" "

View File

@@ -4,7 +4,7 @@
" Author: Dhruva Sagar <http://dhruvasagar.com/> " Author: Dhruva Sagar <http://dhruvasagar.com/>
" License: MIT (http://www.opensource.org/licenses/MIT) " License: MIT (http://www.opensource.org/licenses/MIT)
" Website: https://github.com/dhruvasagar/vim-table-mode " Website: https://github.com/dhruvasagar/vim-table-mode
" Version: 4.0.0 " Version: 4.1.0
" Note: This plugin was heavily inspired by the 'CucumberTables.vim' " Note: This plugin was heavily inspired by the 'CucumberTables.vim'
" (https://gist.github.com/tpope/287147) plugin by Tim Pope. " (https://gist.github.com/tpope/287147) plugin by Tim Pope.
" "

View File

@@ -4,7 +4,7 @@
" Author: Dhruva Sagar <http://dhruvasagar.com/> " Author: Dhruva Sagar <http://dhruvasagar.com/>
" License: MIT (http://www.opensource.org/licenses/MIT) " License: MIT (http://www.opensource.org/licenses/MIT)
" Website: https://github.com/dhruvasagar/vim-table-mode " Website: https://github.com/dhruvasagar/vim-table-mode
" Version: 4.0.0 " Version: 4.1.0
" Note: This plugin was heavily inspired by the 'CucumberTables.vim' " Note: This plugin was heavily inspired by the 'CucumberTables.vim'
" (https://gist.github.com/tpope/287147) plugin by Tim Pope. " (https://gist.github.com/tpope/287147) plugin by Tim Pope.
" "

View File

@@ -4,7 +4,7 @@
" Author: Dhruva Sagar <http://dhruvasagar.com/> " Author: Dhruva Sagar <http://dhruvasagar.com/>
" License: MIT (http://www.opensource.org/licenses/MIT) " License: MIT (http://www.opensource.org/licenses/MIT)
" Website: https://github.com/dhruvasagar/vim-table-mode " Website: https://github.com/dhruvasagar/vim-table-mode
" Version: 4.0.0 " Version: 4.1.0
" Note: This plugin was heavily inspired by the 'CucumberTables.vim' " Note: This plugin was heavily inspired by the 'CucumberTables.vim'
" (https://gist.github.com/tpope/287147) plugin by Tim Pope. " (https://gist.github.com/tpope/287147) plugin by Tim Pope.
" "

View File

@@ -1,7 +1,7 @@
*table-mode.txt* Table Mode for easy table formatting. v4.0.0 *table-mode.txt* Table Mode for easy table formatting. v4.1.0
=============================================================================== ===============================================================================
Table Mode, THE AWESOME AUTOMATIC TABLE CREATOR & FORMATTER Table Mode, THE AWESOME AUTOMATIC TABLE CREATOR & FORMATTER
VERSION 4.0.0 VERSION 4.1.0
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/>

View File

@@ -46,7 +46,7 @@ call s:SetGlobalOptDefault('table_mode_corner_corner', '|')
function! s:TableEchoCell() "{{{1 function! s:TableEchoCell() "{{{1
if tablemode#table#IsATableRow('.') if tablemode#table#IsATableRow('.')
echomsg '$' . tablemode#table#RowNr('.') . ',' . tablemode#table#ColumnNr('.') echomsg '$' . tablemode#spreadsheet#RowNr('.') . ',' . tablemode#spreadsheet#ColumnNr('.')
endif endif
endfunction endfunction
@@ -68,10 +68,10 @@ else
endif endif
" }}}2 " }}}2
command! -nargs=? -range Tableize <line1>,<line2>call tablemode#TableizeRange(<q-args>) command! -nargs=? -range Tableize <line1>,<line2>call tablemode#table#TableizeRange(<q-args>)
command! TableAddFormula call tablemode#table#AddFormula() command! TableAddFormula call tablemode#spreadsheet#AddFormula()
command! TableModeRealign call tablemode#table#TableRealign('.') command! TableModeRealign call tablemode#spreadsheet#TableRealign('.')
command! TableEvalFormulaLine call tablemode#table#EvaluateFormulaLine() command! TableEvalFormulaLine call tablemode#spreadsheet#EvaluateFormulaLine()
nnoremap <silent> <Plug>(table-mode-tableize) :Tableize<CR> nnoremap <silent> <Plug>(table-mode-tableize) :Tableize<CR>
xnoremap <silent> <Plug>(table-mode-tableize) :Tableize<CR> xnoremap <silent> <Plug>(table-mode-tableize) :Tableize<CR>
@@ -84,14 +84,14 @@ nnoremap <silent> <Plug>(table-mode-motion-down) :<C-U>call tablemode#table#Tabl
nnoremap <silent> <Plug>(table-mode-motion-left) :<C-U>call tablemode#table#TableMotion('h')<CR> nnoremap <silent> <Plug>(table-mode-motion-left) :<C-U>call tablemode#table#TableMotion('h')<CR>
nnoremap <silent> <Plug>(table-mode-motion-right) :<C-U>call tablemode#table#TableMotion('l')<CR> nnoremap <silent> <Plug>(table-mode-motion-right) :<C-U>call tablemode#table#TableMotion('l')<CR>
onoremap <silent> <Plug>(table-mode-cell-text-object-a) :<C-U>call tablemode#table#CellTextObject(0)<CR> onoremap <silent> <Plug>(table-mode-cell-text-object-a) :<C-U>call tablemode#spreadsheet#CellTextObject(0)<CR>
onoremap <silent> <Plug>(table-mode-cell-text-object-i) :<C-U>call tablemode#table#CellTextObject(1)<CR> onoremap <silent> <Plug>(table-mode-cell-text-object-i) :<C-U>call tablemode#spreadsheet#CellTextObject(1)<CR>
nnoremap <silent> <Plug>(table-mode-delete-row) :call tablemode#table#DeleteRow()<CR> nnoremap <silent> <Plug>(table-mode-delete-row) :call tablemode#spreadsheet#DeleteRow()<CR>
nnoremap <silent> <Plug>(table-mode-delete-column) :call tablemode#table#DeleteColumn()<CR> nnoremap <silent> <Plug>(table-mode-delete-column) :call tablemode#spreadsheet#DeleteColumn()<CR>
nnoremap <silent> <Plug>(table-mode-add-formula) :call tablemode#table#AddFormula()<CR> nnoremap <silent> <Plug>(table-mode-add-formula) :call tablemode#spreadsheet#AddFormula()<CR>
nnoremap <silent> <Plug>(table-mode-eval-formula) :call tablemode#table#EvaluateFormulaLine()<CR> nnoremap <silent> <Plug>(table-mode-eval-formula) :call tablemode#spreadsheet#EvaluateFormulaLine()<CR>
nnoremap <silent> <Plug>(table-mode-echo-cell) :call <SID>TableEchoCell()<CR> nnoremap <silent> <Plug>(table-mode-echo-cell) :call <SID>TableEchoCell()<CR>

View File

@@ -5,14 +5,10 @@ call vspec#hint({'scope': 'tablemode#align#scope()', 'sid': 'tablemode#align#sid
describe 'Align' describe 'Align'
it 'should align table content correctly' it 'should align table content correctly'
let lines = ['| This | is a | table |', '| This | is also | a table |'] Expect tablemode#align#Align(readfile('t/fixtures/align/simple_before.txt')) == readfile('t/fixtures/align/simple_after.txt')
let result = ['| This | is a | table |', '| This | is also | a table |']
Expect tablemode#align#Align(lines) == result
end end
it 'should align table content with unicode characters correctly' it 'should align table content with unicode characters correctly'
let lines = ['| This | is 測試 | table |', '| This | is also | a table |'] Expect tablemode#align#Align(readfile('t/fixtures/align/unicode_before.txt')) == readfile('t/fixtures/align/unicode_after.txt')
let result = ['| This | is 測試 | table |', '| This | is also | a table |']
Expect tablemode#align#Align(lines) == result
end end
end end

View File

@@ -0,0 +1,2 @@
| This | is a | table |
| This | is also | a table |

View File

@@ -0,0 +1,2 @@
|This|is a|table|
|This|is also|a table|

View File

@@ -0,0 +1,2 @@
| This | is 測試 | table |
| This | is also | a table |

View File

@@ -0,0 +1,2 @@
| This | is 測試 | table |
| This | is also | a table |

4
t/fixtures/sample.txt Normal file
View File

@@ -0,0 +1,4 @@
| test11 | test12 |
| test21 | test22 |

4
t/fixtures/tableize.txt Normal file
View File

@@ -0,0 +1,4 @@
asd,asd;asd,asd
asd,asd;asd,asd

View File

@@ -7,9 +7,7 @@ describe 'spreadsheet'
describe 'API' describe 'API'
before before
new new
normal! ggdG read t/fixtures/sample.txt
call tablemode#TableModeEnable()
normal i
end end
it 'should return the row count' it 'should return the row count'
@@ -79,7 +77,6 @@ describe 'spreadsheet'
describe 'Manipulations' describe 'Manipulations'
before before
new new
before
normal i|test11|test12| normal i|test11|test12|
|test21|test22| |test21|test22|
call cursor(1, 3) call cursor(1, 3)

View File

@@ -7,9 +7,7 @@ describe 'table'
describe 'API' describe 'API'
before before
new new
normal! ggdG read t/fixtures/sample.txt
call tablemode#TableModeEnable()
normal i
end end
it 'should return true when inside a table' it 'should return true when inside a table'
@@ -24,8 +22,7 @@ describe 'table'
describe 'Tableize' describe 'Tableize'
before before
new new
before read t/fixtures/tableize.txt
new
end end
it 'should tableize with default delimiter' it 'should tableize with default delimiter'