Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add till/repeat/reverse jump bindings #5140

wants to merge 1 commit into from


Copy link

@cttttt cttttt commented Aug 11, 2018


Gave fish a try and it's amazing, but the vi bindings are only almost perfect.

I'm hardwired to use ; and , to repeat previous jumps in vi and bash's vi-mode, but these seem to be missing in fish. The way T and t bindings are implemented in the fish script, it's kinda difficult to persist enough to cleanly implement repeats/reversals of all varieties of jump, so I moved all jump motions directly into fish.

These changes:

  • Add builtin support for:
    • Jumping to the character before the target
    • Repeating the previous jump (same direction, same 'till-ness).
    • Repeating the previous jump in the reverse direction.
  • Enhance vi bindings with the built in jumps and repeat/reversal jumps.


  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in
  • Lint/format.

src/reader.cpp Outdated
if (precision == jump_precision_t::till) {
tmp_pos -= step;
tmp_pos = std::max(tmp_pos, (size_t)0);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C/C++ rust is showing

Note to self: size_t is unsigned, so this doesn't make sense. I need to rework this loop else it will skip the first position in el. Perhaps the while (tmp_pos--) loop that was there is the cleanest approach for scanning backward.

Copy link

This looks good. I just tried switching to fish but was disappointed by the half-baked vi mode. I'm glad this issue is fixed.

I'm planning to try seperating the action/movement bindings and move the state into the core, so we can do stuff like repeated commands through period (.) as in vim. It would also remove redundancy in having to specify df, dt, dF, dT, dw, etc.

- Add support for:
  - Jumping to the character before a target.
  - Repeating the previous jump (same direction, same precision).
  - Repeating the previous jump in the reverse order.
- Enhance vi bindings.
Copy link

Looks awesome! Merged as 1d68b52. Thanks!!

@ridiculousfish ridiculousfish added this to the fish-3.0 milestone Aug 18, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

Successfully merging this pull request may close these issues.

None yet

4 participants