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

question: how to *not* override neovim's default search behavior #207

Closed dhazel closed 1 year ago

dhazel commented 1 year ago

Did you check the docs?

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

I would like a way to prevent Flash.nvim from overriding the default search behavior, and I would instead like to bind Flash.nvim's search behavior to a different keyboard shortcut.

Describe the solution you'd like

There may already be an easy way to do this, but I do not see it mentioned in the docs.

Describe alternatives you've considered

n/a

Additional context

Thanks for the great plugin!

IndianBoy42 commented 1 year ago

expand the Default Settings section, it is mentioned there already

dhazel commented 1 year ago

Ha! I had expanded and read the Default Settings section several times, but missed the specific setting every time.

For others with the same question, the setting is under modes > search.

So, if you are using Lazy.nvim, your config might look something like this:

{
  "folke/flash.nvim",
  event = "VeryLazy",
  ---@type Flash.Config
  opts = {
    modes = {
      search = {
        enabled = false,
      },
    },
  },
  -- stylua: ignore
  keys = {
    {  -- rebind the search feature to a different keystroke, in this case pressing `/` twice
      "//", mode = { "n", "x", "o" },
      function() require("flash").jump() end,
      desc = "Flash"
    },
  },
  -- { ... other config items ... }
}