Skip to content

Add a count argument to seek.seek #305

@haberdashPI

Description

@haberdashPI

I miss vim-sneak. I know that leap is supposed to be an improvement on it, but I personally find it to be worse. I like the minimal number of keys I need to hit (e.g. sab to jump to the first instance of ab), and using ; to advance to the exact pair I want is often faster than reviewing the set of keys I need to hit when using leap.

I think implementing sneak would be pretty easy (much easier than leap): API wise it would involve allowing seek.seek to accept count number of characters (defaulting to 1).

Implementation wise I think it would involve something along the lines of:

export async function seek(
  _: Context,
  inputOr: InputOr<"input", string>,

  repetitions: number,
  direction = Direction.Forward,
  shift = Shift.Select,
  include: Argument<boolean> = false,
  count = 1
) {
  const input = inputOr(() => {
     let keys = ""
     while(count > 0)
        keys += await keypress(_)
        count--
     }
     return result
  })

Happy to take a stab at adding this feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions