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

feature: casing options for each mode

Open Reisen opened this issue 1 year ago • 7 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.

In standard vim, ignorecase/smartcase does not apply to f behaviour, I.E: nvim -u NONE:

Searching with / for qui with ignorecase+smartcase hits the first result:

image

Searching with f for q with ignorecase+smartcase hits the second result:

image

It's intuitive that flash respects these settings for /, but for f this was a surprise compared to vanilla behaviour and breaks the utility of plugins like quickscope which now highlight the wrong symbols, so in my example here while my eyes are trained on q, pressing q actually takes me to Q.

image

So I repeatedly find myself often accidentally jumping earlier than I expected.

Describe the solution you'd like

To be able to disable case settings on a mode by mode basis:

config = {
    modes = {
        char = {
            case = 'sensitive'
         }
     }
}

Where a default of inherit might imply the current behaviour, I don't have a good idea in mind for how this option might exactly look though this is just a quick scrappy explanation of what I would like to be able to do.

Alternatively, to change f to not rely on ignorecase/smartcase so it matches vanilla nvim behaviour:

  'smartcase' 'scs'       boolean (default off)                                                                                                                                                                                                                                                  
                          global                                                                                                                                                                                                                                                                 
          Override the 'ignorecase' option if the search pattern contains upper                                                                                                                                                                                                                  
          case characters.  Only used when the search pattern is typed and                                                                                                                                                                                                                       
          'ignorecase' option is on.  Used for the commands "/", "?", "n", "N",                                                                                                                                                                                                                  
          ":g" and ":s".  Not used for "*", "#", "gd", tag search, etc.  After                                                                                                                                                                                                                   
          "*" and "#" you can make 'smartcase' used by doing a "/" command,                                                                                                                                                                                                                      
          recalling the search pattern from history and hitting <Enter>. 

Describe alternatives you've considered

  1. Disable flash for f and stick to only s and / benefits of flash.
  2. Disable uppercase searches for quickscope as most of the time I'm searching lowercase, but this isn't ideal as quickscope requires listing every possible matchable char if you try and override the allowable characters so you have to maintain a whitelist. This would reduce the amount of matchable positions as well which is unfortunate.

Additional context

While It's not related to the feature I'm requesting here, I was wondering what your thoughts might be on adding quickscopes functionality to flash? Quickscope is a pretty old plugin at this point as far as I can tell, and flash's f behaviour is very nice. Having the ability to show the first non-conflicting f jump in each word, but being able to do it over multiple lines would be incredibly useful.

Reisen avatar Jul 24 '23 17:07 Reisen

Based on this comment, an alternative approach would be to override the jump behavior as follows:

function()
    local ignorecase = vim.go.ignorecase
    vim.go.ignorecase = false
    require('flash').something({    I'm not sure what to put here    })
    vim.go.ignorecase = ignorecase
end

However, I don't know where this would go in the flash config, as I do not see an option for supplying a custom function for the f/F/t/T feature.

Any tips on how to use this approach would be much appreciated since I am a bit confused about how to set this up.

@Reisen did you ever find another workaround?

nullromo avatar Oct 25 '23 23:10 nullromo

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]

This has not been addressed, so the stale label should be removed.

nullromo avatar Jul 06 '24 05:07 nullromo

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 Aug 07 '24 01:08 github-actions[bot]

Still not stale.

nullromo avatar Aug 07 '24 16:08 nullromo

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 Sep 07 '24 01:09 github-actions[bot]

Nope

nullromo avatar Sep 07 '24 06:09 nullromo

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 Oct 08 '24 02:10 github-actions[bot]

the default behavior doesnt match native nvim so in cases is not expected. would be lovely to have that option in flash natively

miki725 avatar Oct 08 '24 13:10 miki725