mirror of
https://github.com/dhruvasagar/vim-table-mode.git
synced 2025-11-09 11:33:47 -05:00
Fixed tablemode#TableMotion
This commit is contained in:
@@ -789,14 +789,16 @@ function! tablemode#ColumnNr(pos) "{{{2
|
||||
return s:Strlen(substitute(getline(pos[0])[(row_start):pos[1]-2], '[^' . g:table_mode_separator . ']', '', 'g'))
|
||||
endfunction
|
||||
|
||||
function! tablemode#TableMotion(direction) "{{{2
|
||||
function! tablemode#TableMotion(direction, ...) "{{{2
|
||||
let l:count = a:0 ? a:1 : v:count1
|
||||
if tablemode#IsATableRow('.')
|
||||
for ii in range(l:count)
|
||||
if a:direction ==# 'l'
|
||||
if s:IsLastCell()
|
||||
if !tablemode#IsATableRow(line('.') + s:RowGap()) || (tablemode#IsATableHeader(line('.') + s:RowGap()) && tablemode#IsATableRow(line('.') + 2 * s:RowGap()))
|
||||
if !tablemode#IsATableRow(line('.') + s:RowGap()) || (tablemode#IsATableHeader(line('.') + s:RowGap()) && !tablemode#IsATableRow(line('.') + 2 * s:RowGap()))
|
||||
return
|
||||
endif
|
||||
call tablemode#TableMotion('j')
|
||||
call tablemode#TableMotion('j', 1)
|
||||
normal! 0
|
||||
endif
|
||||
|
||||
@@ -808,10 +810,10 @@ function! tablemode#TableMotion(direction) "{{{2
|
||||
endif
|
||||
elseif a:direction ==# 'h'
|
||||
if s:IsFirstCell()
|
||||
if !tablemode#IsATableRow(line('.') - s:RowGap()) || (tablemode#IsATableHeader(line('.') - s:RowGap()) && tablemode#IsATableRow(line('.') - 2 * s:RowGap()))
|
||||
if !tablemode#IsATableRow(line('.') - s:RowGap()) || (tablemode#IsATableHeader(line('.') - s:RowGap()) && !tablemode#IsATableRow(line('.') - 2 * s:RowGap()))
|
||||
return
|
||||
endif
|
||||
call tablemode#TableMotion('k')
|
||||
call tablemode#TableMotion('k', 1)
|
||||
normal! $
|
||||
endif
|
||||
|
||||
@@ -834,6 +836,7 @@ function! tablemode#TableMotion(direction) "{{{2
|
||||
execute 'normal! ' . (s:RowGap() + 1) . 'k'
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
Reference in New Issue
Block a user