syntax-tree-surfer icon indicating copy to clipboard operation
syntax-tree-surfer copied to clipboard

Same-line jumps

Open mpasa opened this issue 2 years ago • 2 comments

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    |

mpasa avatar Oct 24 '22 14:10 mpasa

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 :)

ziontee113 avatar Oct 24 '22 15:10 ziontee113

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

mpasa avatar Oct 24 '22 15:10 mpasa