mirror of
https://github.com/dhruvasagar/vim-table-mode.git
synced 2025-11-08 19:13:46 -05:00
Fixed delete column api with header changes
This commit is contained in:
@@ -803,7 +803,21 @@ endfunction
|
|||||||
function! tablemode#DeleteColumn() "{{{2
|
function! tablemode#DeleteColumn() "{{{2
|
||||||
if tablemode#IsATableRow('.')
|
if tablemode#IsATableRow('.')
|
||||||
for i in range(v:count1)
|
for i in range(v:count1)
|
||||||
call s:MoveToFirstRow()
|
call s:MoveToStartOfCell()
|
||||||
|
|
||||||
|
if tablemode#IsATableRow(line('.') + 1)
|
||||||
|
call s:MoveToFirstRow()
|
||||||
|
" If we have a header delete it first
|
||||||
|
if tablemode#IsATableRow(line('.')-2)
|
||||||
|
call cursor(line('.')-2, col('.'))
|
||||||
|
silent! execute "normal! h\<C-V>f" . g:table_mode_separator
|
||||||
|
normal! jdjj
|
||||||
|
endif
|
||||||
|
else " We're already on the header
|
||||||
|
silent! execute "normal! h\<C-V>f" . g:table_mode_separator
|
||||||
|
normal! jdjj
|
||||||
|
endif
|
||||||
|
|
||||||
call s:MoveToStartOfCell()
|
call s:MoveToStartOfCell()
|
||||||
silent! execute "normal! h\<C-V>f" . g:table_mode_separator
|
silent! execute "normal! h\<C-V>f" . g:table_mode_separator
|
||||||
call s:MoveToLastRow()
|
call s:MoveToLastRow()
|
||||||
@@ -817,15 +831,11 @@ endfunction
|
|||||||
function! tablemode#DeleteRow() "{{{2
|
function! tablemode#DeleteRow() "{{{2
|
||||||
if tablemode#IsATableRow('.')
|
if tablemode#IsATableRow('.')
|
||||||
for i in range(v:count1)
|
for i in range(v:count1)
|
||||||
if tablemode#RowCount('.') ==# 1
|
if tablemode#IsATableRow('.')
|
||||||
normal! kVjjd
|
normal! dd
|
||||||
else
|
|
||||||
normal! kVjd
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if tablemode#IsATableRow(line('.')+1)
|
if !tablemode#IsATableRow('.')
|
||||||
normal! j
|
|
||||||
else
|
|
||||||
normal! k
|
normal! k
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|||||||
Reference in New Issue
Block a user