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

How to use different options in Operator Mode based on forward/backward? #232

Closed singlexyz closed 11 months ago

singlexyz commented 1 year ago

I have this mapping, it works like dt when jump forward.

{
  "s",
  mode = { "o" },
  function() require("flash").jump({ jump = { offset = -1 } }) end,
}

But when jump backward, I hope it works like dF.

Is there a way to make a judgment?

IndianBoy42 commented 1 year ago

maybe override the action callback and adjust the target based on whether its before or after

singlexyz commented 11 months ago

I figure out:

require("flash").jump({ jump = { inclusive = false } })