mirror of
https://github.com/dhruvasagar/vim-table-mode.git
synced 2025-11-09 11:33:47 -05:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63cb175d57 | ||
|
|
4eae4a659d | ||
|
|
5012486cbe | ||
|
|
12f4c39982 | ||
|
|
943496c535 | ||
|
|
151d489a53 | ||
|
|
aa5b5ef526 | ||
|
|
a0207b7895 |
11
CHANGELOG.md
11
CHANGELOG.md
@@ -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.
|
||||||
|
|||||||
29
README.md
29
README.md
@@ -1,4 +1,4 @@
|
|||||||
# VIM Table Mode [](https://travis-ci.org/dhruvasagar/vim-table-mode)
|
# VIM Table Mode v4.1.0 [](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** :
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
||||||
"
|
"
|
||||||
|
|||||||
@@ -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.
|
||||||
"
|
"
|
||||||
|
|||||||
@@ -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.
|
||||||
"
|
"
|
||||||
|
|||||||
@@ -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.
|
||||||
"
|
"
|
||||||
|
|||||||
@@ -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/>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
2
t/fixtures/align/simple_after.txt
Normal file
2
t/fixtures/align/simple_after.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
| This | is a | table |
|
||||||
|
| This | is also | a table |
|
||||||
2
t/fixtures/align/simple_before.txt
Normal file
2
t/fixtures/align/simple_before.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
|This|is a|table|
|
||||||
|
|This|is also|a table|
|
||||||
2
t/fixtures/align/unicode_after.txt
Normal file
2
t/fixtures/align/unicode_after.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
| This | is 測試 | table |
|
||||||
|
| This | is also | a table |
|
||||||
2
t/fixtures/align/unicode_before.txt
Normal file
2
t/fixtures/align/unicode_before.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
| This | is 測試 | table |
|
||||||
|
| This | is also | a table |
|
||||||
4
t/fixtures/sample.txt
Normal file
4
t/fixtures/sample.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
| test11 | test12 |
|
||||||
|
| test21 | test22 |
|
||||||
|
|
||||||
4
t/fixtures/tableize.txt
Normal file
4
t/fixtures/tableize.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
asd,asd;asd,asd
|
||||||
|
asd,asd;asd,asd
|
||||||
|
|
||||||
@@ -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)
|
||||||
|
|||||||
@@ -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'
|
||||||
|
|||||||
Reference in New Issue
Block a user