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

Is it possible to use the semicolon to repeat (continue actually) a jump?

Open svanharmelen opened this issue 1 year ago • 6 comments

My config looks like below, so I primarily use flash by hitting s or S, typing some chars and then select the label of the thing I'm aiming for (my target).

Now more then often I find myself updating or changing something at the target location and then realize I want to repeat that action in a similar part of my code so my muscle memory makes me hit ; to repeat the action and somehow I expect it to repeat hitting s again and typing in the same chars to get the labels again allowing me to choose the next target.

Would something like that be possible somehow? I thought maybe the continue option was for that, but that doesn't seem the case.

Thanks!

return {
  'folke/flash.nvim',
  event = "VeryLazy",

  keys = {
    {
      's',
      mode = { 'n', 'x', 'o' },
      function()
        require('flash').jump({
          search = { forward = true, wrap = false, multi_window = false },
        })
      end,
    },
    {
      'S',
      mode = { 'n', 'x', 'o' },
      function()
        require('flash').jump({
          search = { forward = false, wrap = false, multi_window = false },
        })
      end,
    },
  },

  config = function()
    require('flash').setup {
      continue = true,
      modes = {
        char = {
          enabled = false,
        },
        search = {
          enabled = false,
        }
      }
    }
  end,
}

svanharmelen avatar May 29 '24 06:05 svanharmelen

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 is still something that I would love to be able to do... Is there any way to do/configure this?

svanharmelen avatar Jul 06 '24 06:07 svanharmelen

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]

This is still something that I would love to be able to do... Is there any way to do/configure this?

svanharmelen avatar Aug 07 '24 06:08 svanharmelen

I'm also very interested in this feature. I simply want to continue my jump after performing some action, like replacing text.

dimroc avatar Sep 01 '24 00:09 dimroc

That is exactly my usecase/flow as well...

@folke I'm willing to put in some time and effort to (help) add something for this if you are open to it and think it can be done? But if so, it would be great if you could maybe get me started with a high level idea on how or where (in code) to add this.

Thanks!

svanharmelen avatar Sep 07 '24 06:09 svanharmelen

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

Would still like this 😊

svanharmelen avatar Oct 25 '24 08:10 svanharmelen

I would also like to see this implemented. I think there should be a key to move between jump matches, similar to a few other plugins in this style.

srcrip avatar Nov 21 '24 15:11 srcrip

I will note however if you enable:

        history = true,

as a param to jump, the jump search will get added to search history, so you can at that point hit n to go to the next match.

srcrip avatar Nov 21 '24 15:11 srcrip

at least that is how its supposed to work I think but I've had some trouble with getting this to work consistently...

srcrip avatar Nov 21 '24 15:11 srcrip

OK played with this just a little today and found out it can already be done 🙈

Given this config:

return {
  'folke/flash.nvim',
  event = "VeryLazy",

  keys = {
    {
      's',
      mode = { 'n', 'x' },
      function()
        require('flash').jump({
          continue = true, -- this is the line I added
          search = { forward = true, wrap = false, multi_window = false },
        })
      end,
    },
    {
      'S',
      mode = { 'n', 'x' },
      function()
        require('flash').jump({
          continue = true, -- this is the line I added
          search = { forward = false, wrap = false, multi_window = false },
        })
      end,
    },
  },

  config = function()
    -- Configure flash.nvim
    require('flash').setup {
      label = {
        uppercase = false,
      },
      modes = {
        char = {
          enabled = false,
        },
        prompt = {
          enabled = false,
        },
        search = {
          enabled = false,
        }
      }
    }
  end,
}

When I press s or S again it continues the search where it left off. Wonder how I missed that before, but adding the continue = true lines fixed this issue.

svanharmelen avatar Nov 22 '24 13:11 svanharmelen

OK played with this just a little today and found out it can already be done 🙈

Given this config:

return {
  'folke/flash.nvim',
  event = "VeryLazy",

  keys = {
    {
      's',
      mode = { 'n', 'x' },
      function()
        require('flash').jump({
          continue = true, -- this is the line I added
          search = { forward = true, wrap = false, multi_window = false },
        })
      end,
    },
    {
      'S',
      mode = { 'n', 'x' },
      function()
        require('flash').jump({
          continue = true, -- this is the line I added
          search = { forward = false, wrap = false, multi_window = false },
        })
      end,
    },
  },

  config = function()
    -- Configure flash.nvim
    require('flash').setup {
      label = {
        uppercase = false,
      },
      modes = {
        char = {
          enabled = false,
        },
        prompt = {
          enabled = false,
        },
        search = {
          enabled = false,
        }
      }
    }
  end,
}

When I press s or S again it continues the search where it left off. Wonder how I missed that before, but adding the continue = true lines fixed this issue.

I think this works until you want to start a new jump. Did you end up finding a workaround for resetting the jump search term?

raymond-van avatar Jan 08 '25 22:01 raymond-van

Yes I realized that quite quickly as well 😏 As I almost never search backwards I decided to make s search forward and S repeat the forward search. So it's still (by far) not perfect but it somehow works for me. If you come across a better solution I'm all ears 😉

svanharmelen avatar Jan 09 '25 08:01 svanharmelen