Compare commits

..

2 Commits

Author SHA1 Message Date
Dhruva Sagar
5a6a9b3473 Fixed motions to wrap around edges incorporating table header 2013-10-07 15:07:55 +05:30
Dhruva Sagar
aa8817621c Fixed doc #11 2013-09-25 09:29:37 +05:30
2 changed files with 21 additions and 5 deletions

View File

@@ -696,6 +696,10 @@ function! tablemode#IsATableRow(line) "{{{2
\ g:table_mode_fillchar . ']*[^' . g:table_mode_corner . ']*$')
endfunction
function! tablemode#IsATableHeader(line) "{{{2
return getline(a:line) =~# s:HeaderBorderExpr()
endfunction
function! tablemode#LineNr(row) "{{{2
if tablemode#IsATableRow('.')
let line = s:Line('.')
@@ -760,7 +764,9 @@ function! tablemode#TableMotion(direction) "{{{2
if tablemode#IsATableRow('.')
if a:direction ==# 'l'
if s:IsLastCell()
if !tablemode#IsATableRow(line('.') + s:RowGap()) | return | endif
if !tablemode#IsATableHeader(line('.') + s:RowGap()) && !tablemode#IsATableRow(line('.') + s:RowGap())
return
endif
call tablemode#TableMotion('j')
normal! 0
endif
@@ -773,7 +779,9 @@ function! tablemode#TableMotion(direction) "{{{2
endif
elseif a:direction ==# 'h'
if s:IsFirstCell()
if !tablemode#IsATableRow(line('.') - s:RowGap()) | return | endif
if !tablemode#IsATableHeader(line('.') - s:RowGap()) && !tablemode#IsATableRow(line('.') - s:RowGap())
return
endif
call tablemode#TableMotion('k')
normal! $
endif
@@ -785,9 +793,17 @@ function! tablemode#TableMotion(direction) "{{{2
execute 'normal! 2F' . g:table_mode_separator . '2l'
endif
elseif a:direction ==# 'j'
if tablemode#IsATableRow(line('.') + s:RowGap()) | execute 'normal ' . s:RowGap() . 'j' | endif
if tablemode#IsATableRow(line('.') + s:RowGap())
execute 'normal ' . s:RowGap() . 'j'
elseif tablemode#IsATableHeader(line('.') + s:RowGap())
execute 'normal ' . (s:RowGap() + 1) . 'j'
endif
elseif a:direction ==# 'k'
if tablemode#IsATableRow(line('.') - s:RowGap()) | execute 'normal ' . s:RowGap() . 'k' | endif
if tablemode#IsATableRow(line('.') - s:RowGap())
execute 'normal ' . s:RowGap() . 'k'
elseif tablemode#IsATableHeader(line('.') - s:RowGap())
execute 'normal ' . (s:RowGap() + 1) . 'k'
endif
endif
endif
endfunction

View File

@@ -29,7 +29,7 @@ GETTING STARTED *table-mode-getting-started*
Create Table on the fly:
Using Table Mode is dead simple. You simply start typing on a new line
with the table separator - |g:table-mode-separator|, and you just type
with the table separator - |table-mode-separator|, and you just type
away! The plugin does the rest automatically for you as you type. With
each additional separator you add, it aligns the table properly,
without having to do anything else.