vim-matchup icon indicating copy to clipboard operation
vim-matchup copied to clipboard

Cannot correctly jump backward with matchup-Z%

Open egovelox opened this issue 5 months ago • 0 comments

Hi, First, let me thank you for this plugin ! 😸

Explain the issue

Using the following keybinding in my config :

vim.keymap.set('n', '<C-p>', '<plug>(matchup-Z%)')

I noticed that the backward-jump gets blocked when encountering such pattern : ((

// cursor gets blocked on the second parenthesis after array.map : array.map((
const array = [1, 2, 3];
const newArray = array.map((n) => n+1);
console.log(newArray); // place cursor here, and start jumping backward with matchup-Z%

If I would simply add a space just after the .map(, like this .map( (n) =>, cursor would not be blocked anymore :

const array = [1, 2, 3];
const newArray = array.map( (n) => n+1); // ok now
console.log(newArray); // place cursor here, and start jumping backward with matchup-Z%

Of course, we got the same problem with e.g

const array = [[]]  // cursor gets blocked on the second [

Versions

This problem occurs with any nvim version, with classic matching OR treesitter integration. This problem occurs with matchup-Z% ( backward jump ) but never with matchup-z% ( forward jump ).

egovelox avatar Sep 29 '24 13:09 egovelox