folke / flash.nvim

Navigate your code with search labels, enhanced character motions and Treesitter integration
Apache License 2.0
2.57k stars 34 forks source link

bug: t motion with custom char_actions #152

Closed sudo-tee closed 1 year ago

sudo-tee commented 1 year ago

Did you check docs and existing issues?

Neovim version (nvim -v)

neovim-0.10.0~ubuntu1+git202307111704-06694203e-9b397864c

Operating system/version

WSL Windows 10

Describe the bug

When using jump labels with t-T motion custon char_actions don't work. It does not happen with and f-F motions where custom char_actions works

here is my config example

{
  modes = {
    char = {
      label = { exclude = "hjkliardcn[]" },
      jump_labels = true,
      char_actions = function(motion)
        return {
          ["n"] = "next",
          ["N"] = "prev",
          ["]"] = "next",
          ["["] = "prev",
        }
      end,
    },
  },
  }

If I copy the full char_actions from the default config even the ; , actions don't work anymore in the t-T motion

Steps To Reproduce

  1. start a t motion or a vt
  2. enter the character to find
  3. hit custom keys in the char_actions ex n (I like to have it consistent with nvim / search)
  4. Observe the jump to next or previous not working

If I do the same with a f-F motion it works properly.

Expected Behavior

Hitting the char in the char_actions should behave the same as the f-F motion

Repro

-- My `init.lua` is the one from LazyVim
sudo-tee commented 1 year ago

After more testing, If after the motion t-T I hit the ; or the , then now the registered custom char_actions will start to work.

folke commented 1 year ago

Should be fixed now! Thank you for reporting this.