ziontee113/syntax-tree-surfer

Same-line jumps

mpasa opened this issue · 2 comments

mpasa commented

I'm trying to define a keymap to jump between Markdown table cells. Generally, there will be more than one cell per line. I'm trying it with the following commands:

local sts = require("syntax-tree-surfer")

vim.keymap.set("n", "<Tab>", function()
  sts.filtered_jump({"pipe_table_cell"}, true)
end, { noremap=true })

vim.keymap.set("n", "<S-Tab>", function()
  sts.filtered_jump({"pipe_table_cell"}, false)
end, { noremap=true })

These work, but going forward will jump to the next cell in a non-current line, even if there are more cells in the current one. Moving back will do the same, but jumping to the last occurrence of the previous non-current line.

In this case, I'd expect the plugin to jump to the next real node, first in the current line and then forward.

The problem can be reproduced using the following markdown file:

| head a | head b |
| ------ | ------ |
| foo    | bar    |
| foo    | bar    |
| foo    | bar    |

Hi @mpasa , I'm sorry for the unexpected behavior of the plugin for your use case. I didn't plan for multiple targets in the same line back when I was making the filtered_jump feature. And I can't implement it for your use case any time soon.

I'm working on something else at the moment. Sorry I can't help you. Hopefully I can bring you a better implementation (whether an update for this plugin or a different better plugin) in the future :)

mpasa commented

No problem! Thanks for the plugin nevertheless. I will leave the issue open in case it can be recovered in the future.