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

feature: there's no easy way to jump to the last character of the line?

Open name-snrl opened this issue 11 months ago • 6 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 can't jump to the last character of the line. May I missed something in doc, but I read it twice.

Describe the solution you'd like

I used leap.nvim and just type <Space> at EOL.

Describe alternatives you've considered

To go back to leap.nvim, idk. :D But flash is awesome!

Additional context

{
    'folke/flash.nvim',
    ---@type Flash.Config
    opts = {
      label = { uppercase = false },
      prompt = { enabled = false },
      modes = {
        search = { enabled = false },
        treesitter = { label = { rainbow = { enabled = true, shade = 2 } } },
        treesitter_search = { label = { rainbow = { enabled = true, shade = 2 } } },
      },
    },
    -- stylua: ignore
    keys = {
      'f', 'F', 't', 'T',
      { 'gs', function() require('flash').jump() end, mode = { 'n', 'x', 'o' } },
      { 'gz', function() require('flash').treesitter() end, mode = { 'n', 'x', 'o' } },
      { 'gZ', function() require('flash').treesitter_search() end, mode = { 'o', 'x' } },
      { 'r', function() require('flash').remote() end, mode = 'o' },
      {
        'ygw',
        function()
          require('flash').jump {
            action = function(match, state)
              vim.api.nvim_set_current_win(match.win)
              vim.api.nvim_win_set_cursor(match.win, match.pos)
              vim.cmd.norm { args = { 'yiw' }, bang = true }
              state:restore()
            end,
          }
        end,
      },
    },
  }

name-snrl avatar Mar 11 '24 21:03 name-snrl

Is this different than the general vim motion g_?

gennaro-tedesco avatar Mar 17 '24 06:03 gennaro-tedesco

Is this different than the general vim motion g_?

Of course, because the jump works across all windows and rows

name-snrl avatar Mar 17 '24 07:03 name-snrl

I can't jump to the last character of the line.

but then you do not want to jump to the last character of the line, you want to mark/jump the last character-s of each line, is it correct?

gennaro-tedesco avatar Mar 17 '24 09:03 gennaro-tedesco

but then you do not want to jump to the last character of the line, you want to mark/jump the last character-s of each line, is it correct?

What? I just want to jump to any character on the screen, including the last characters of the lines.

name-snrl avatar Mar 17 '24 12:03 name-snrl

BTW, for the moment I found a workaround - use search mode. But there seems to be a bug with backslashes. You just can't use backslashes in search mode unless there is no backslash on the screen, in which case the search will instantly abort.

p.s. I haven't looked for issues that describe that, perhaps it already exists

name-snrl avatar Mar 17 '24 12:03 name-snrl

Additionally, it would be nice if we could also jump to blank lines.

With leap, you can just do this by pressing s<space><space> (assuming your "leap bind" is s). Then it would show labels for every blank line (even if it doesn't actually have two spaces) and you can jump directly to them

with flash this is not currently possible, I believe

brunobmello25 avatar Apr 04 '24 20:04 brunobmello25

@name-snrl

function()
    require("flash").jump({
	search = { mode = "search", max_length = 0 },
	label = { after = { 0, 0 } },
	pattern = "^", -- replace with $ for end of line
    })
end

This function is provided in the "Examples" section which can be used to go to the beginning of a line, but not at the end.

I think we should find a regex to put in the pattern section which matches ^ AND $ that is, the beginning AND end of line.

iamhrigved avatar Jun 04 '24 14:06 iamhrigved

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 issue was closed because it has been stalled for 7 days with no activity.

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