parity(6): insert-mode <Tab>/<S-Tab> table cell nav

`<Tab>` / `<S-Tab>` in insert mode navigate between table cells when
the cursor is on a `|…|` row, otherwise they pass through to their
default insert-mode behaviour (literal tab / shift-tab). Same
`<expr>`-mapping idiom as Cluster 5's smart_return.

  <Tab>    next cell; creates a fresh row below if past the last cell
  <S-Tab>  previous cell; no-op past the first

Cursor lands immediately after the destination cell's leading `|`,
matching upstream vimwiki's `vimwiki#tbl#go_*_cell` behaviour.

Both Lua and VimL counterparts wired into ftplugin's existing
table_editing block (gated alongside `gqq`/`<A-Left>`).

Tests: 4 new in scripts/test-keymaps.lua — next cell, new-row
overflow, previous cell, and pass-through outside a table.

Gates: 421 Rust / 39 Neovim / 12 Vim.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-12 21:37:53 +00:00
parent e347f605ff
commit 2562a046db
5 changed files with 172 additions and 0 deletions
+39
View File
@@ -433,6 +433,45 @@ vim.defer_fn(function()
wait_ms = 100,
})
-- ===== Insert-mode table navigation (Cluster 6) =====
run('tab.next_cell_in_table', {
lines = { '| a | b |' },
cursor = { 1, 2 }, -- inside cell `a`
keys = 'A<Tab>x<Esc>',
-- After A: cursor at end. <Tab>: no cell-start strictly after end
-- so creates new row. Try cursor on inside-first-cell case below.
-- Here cursor at end has no next cell so a new row is added.
expect_lines = { '| a | b |', '|x | |' },
wait_ms = 100,
})
run('tab.from_first_cell_moves_to_second', {
lines = { '| a | b |' },
cursor = { 1, 0 },
keys = 'lli<Tab>x<Esc>',
-- `ll` from col 0 → col 2 (on `a`). `i` enters insert. `<Tab>`
-- jumps to col after next `|`. `x` types in second cell.
expect_lines = { '| a |x b |' },
wait_ms = 100,
})
run('shift_tab.prev_cell_in_table', {
lines = { '| a | b |' },
cursor = { 1, 6 }, -- inside cell `b`
keys = 'i<S-Tab>x<Esc>',
-- Cursor lands just after the previous cell's `|`; typing `x`
-- inserts at col 2 (before the leading space inside cell 1).
expect_lines = { '|x a | b |' },
wait_ms = 100,
})
run('tab.outside_table_passes_through', {
lines = { 'plain text' },
cursor = { 1, 0 },
keys = 'i<Tab>x<Esc>',
-- Default Tab inserts a literal tab.
expect_lines = { '\tx' .. 'plain text' },
wait_ms = 100,
})
-- ===== Diary nav =====
-- Tested via the LSP open-* responses; can't fully validate without
-- a populated diary, but at least confirm the maps fire without