Skip to content

How to map TSToggle to J and have the fallback be the original J? #152

Answered by Wansmer
lfilho asked this question in Q&A
Discussion options

You must be logged in to vote

There's nothing wrong with your code. I guess I was wrong to advise you on this, sorry. Do this:

require("treesj").setup({
  on_error = function()
    vim.cmd.join()
  end,
})

vim.keymap.set("n", "J", require("treesj").join)

This will do what you want in all cases where treesj gets an error that for some reason it can't do join for a node.

2024-05-17.21.04.55.mov

it mentions containing a comment but as you can see in the screenshot, there isn't a comment in the code?!

Read how the plugin works.

The nearest matching node has a comment

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@Wansmer
Comment options

@lfilho
Comment options

@Wansmer
Comment options

Answer selected by lfilho
@lfilho
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants