flash.nvim icon indicating copy to clipboard operation
flash.nvim copied to clipboard

feature: Is any way to use '/' but don't use '?'

Open Mr-LLLLL opened this issue 1 year ago • 4 comments

Did you check the docs?

  • [X] I have read all the flash.nvim docs

Is your feature request related to a problem? Please describe.

I want to use '/' to flash any where with flash.nvim, but keep '?' to search any word in old way. I test bind '/' to flash.jump(), but sometimes i want to '/' to search word like old way, i call flash.toggle() is not work. cause flash.toggle() control the search not flash.jump().

Describe the solution you'd like

I think diff the '/' and '?' in config, make flash search use '/' or '?' is good way?

Describe alternatives you've considered

nope

Additional context

No response

Mr-LLLLL avatar Dec 01 '23 07:12 Mr-LLLLL

If I understand right:

  • / should do flash jump (not search)
  • ? should do a normal backwards search, as vim does without this plugin?

Then you can achieve that with config like

{
  "folke/flash.nvim",
  keys = {
    { "/", mode = { "n", "x", "v" }, function() require("flash").jump(); end, desc = "Flash Jump" },
    { "?", mode = { "n", "x", "v" }, function() require("flash").toggle(false); vim.api.nvim_feedkeys('?', 'n', true) end, desc = "Normal backward search" },
  }
}

If you wanted ? to do what nvim does normally on / (forward search) just change the feedkeys bit.

artfulrobot avatar Feb 20 '24 09:02 artfulrobot

**artfulrobot ** commented Feb 20, 2024

But i notice in your mapping, here always call require("flash").toggle(false), this will change the flash setting, is that OK?

Mr-LLLLL avatar Mar 11 '24 08:03 Mr-LLLLL

@Mr-LLLLL well it's fine by me because / will do the flash jump type search always anyway. Basically, I only want flash search for / and any other search should be normal search.

artfulrobot avatar Mar 12 '24 17:03 artfulrobot

hope can help you / for old way

vim.keymap.set('n', '/', function() 
          require("flash").toggle(false)

        vim.fn.feedkeys("/", "n")
end)
      
vim.api.nvim_create_autocmd("CmdlineLeave", {
  pattern = "*",
  callback = function()
    require("flash").toggle(true)
  end,
})

mycf avatar May 06 '24 04:05 mycf

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jul 06 '24 01:07 github-actions[bot]