folke / flash.nvim

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

feature: Case-insensitive labels #348

Closed angles-n-daemons closed 2 weeks ago

angles-n-daemons commented 2 weeks ago

Did you check the docs?

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

Hi there,

First off, thanks so much for this plugin. I've just gotten started and I'm really enjoying using it.

This feature request is related to the label casing in flash. I find that while lowercase letters are easier to type, uppercase letters serve as much better visual indicators.

Describe the solution you'd like

Something where the labelset can be something like "ABCDEFGHIJKLMNOPQRSTUVWXYZ" but the actual typing of the labels would be case insensitive. In that way the label may be SK, but I could type sk to jump to the location.

Perhaps it could be a flag, perhaps it could be the default behavior.

Describe alternatives you've considered

The alternatives I've considered is modifying my labelset to be more visually clear (capitals as above) while typing them in a case-sensitive fashion. eg:

opts = {
    labels="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
}

Additional context

I'm happy to open a PR if there's interest, it matches my experience with the vimium chrome plugin (image attached).

image

angles-n-daemons commented 2 weeks ago

Solved my own question, read the docs a little closer and there's an option for label formatting. This supports what I'm looking for in an easy enough way:

  opts = {
    label = {
      uppercase = true,
      format = function(opts)
        return { { string.upper(opts.match.label), opts.hl_group } }
      end,
    },
  }