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

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
4 participants
@cttttt
Copy link
Contributor

cttttt commented Aug 11, 2018

Description

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.

TODOs:

  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.md
  • Lint/format.
if (precision == jump_precision_t::till) {
tmp_pos -= step;
}
tmp_pos = std::max(tmp_pos, (size_t)0);

This comment has been minimized.

@cttttt

cttttt Aug 11, 2018

Contributor

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.

@cttttt cttttt force-pushed the cttttt:add-till-bindings branch from 82d5b56 to 4d6203e Aug 11, 2018

@matthewvilim

This comment has been minimized.

Copy link

matthewvilim commented Aug 12, 2018

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 till/repeat/reverse jump bindings
- 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.

@cttttt cttttt force-pushed the cttttt:add-till-bindings branch from 4d6203e to 05e1366 Aug 12, 2018

@ridiculousfish

This comment has been minimized.

Copy link
Member

ridiculousfish commented Aug 18, 2018

Looks awesome! Merged as 1d68b52. Thanks!!

@ridiculousfish ridiculousfish added this to the fish-3.0 milestone Aug 18, 2018

@faho faho added the enhancement label Oct 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment