Skip to content

Conversation

@BlueDrink9
Copy link
Contributor

@BlueDrink9 BlueDrink9 commented May 26, 2025

Generally speaking the refactor allows you to override how edit actions are applied, which I uses to make sure that the modifier/selection applies by creating a vim motion instead of trying to select terminal text. The refactors to the edit commands are fairly minimal, it's just converting the functions into user actions and refactoring out actions to access the internal dictionaries.

In draft mode while I dog food it for a week or so to ensure it is ready, But reviews are welcome anyway

@BlueDrink9
Copy link
Contributor Author

I haven't noticed any issues with this while dogfooding it for the last two weeks, including both inside and outside of terminal, so it looks like I haven't broken the regular commands either.

@BlueDrink9 BlueDrink9 marked this pull request as ready for review June 6, 2025 23:10
Copy link
Collaborator

@nriley nriley left a comment

Choose a reason for hiding this comment

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

From the community backlog session — we are waiting on some testing from vi users, but otherwise things look good except for this apparent bug that seems to have snuck through in the earlier version of this code.

@BlueDrink9
Copy link
Contributor Author

Do we know how many vi testers we will have? If the concern is testing that nothing breaks outside of this mode, could we just have a few community maintainers use or merge this fork for themselves for a few weeks?

That bug was unfortunate, but I caught it fairly soon after the first two weeks --- I just didn't have time to fix it for a while. Otherwise I have been using this code consistently for several months and even outside of terminal, I haven't noticed any further issues. (At one point I thought I had a broken "clear line left" until I discovered that actually that was just not the correct command)

@nriley
Copy link
Collaborator

nriley commented Oct 18, 2025

Do we know how many vi testers we will have? If the concern is testing that nothing breaks outside of this mode, could we just have a few community maintainers use or merge this fork for themselves for a few weeks?

One of the folks on the call did indeed say they'd do this. Hope we may be able to merge as soon as next weekend.

@BlueDrink9 BlueDrink9 force-pushed the readline_vi branch 2 times, most recently from b996718 to 1e00e35 Compare October 18, 2025 23:05
@Arrow2718
Copy link

kitty

user and edit actions added by BlueDrinks PR #1885
Tested on Endeavour OS KDE Plasma

command word method/actions
we delete line edit.delete_line() works
we word left edit.word_left() works
we word right edit.word_right() works
we line end edit.line_end() works
we line start edit.line_start() works
we undo edit.undo() works
we redo edit.redo() triggers reverse-i-search
we extend line end edit.extend_line_end() ???
we extend line start edit.extend_line_start() ???
wee extend word left edit.extend_word_left() ???
we extend word right edit.extend_word_right() ???
we cut line user.cut_line() works
we cut word left user.cut_word_left() doesn't go to clipboard
we copy word left user.copy_word_left() doesn't go to clipboard
we copy word right user.copy_word_right() doesn't go to clipboard

@Arrow2718
Copy link

I'll post these as comments in the code if required.

@BlueDrink9
Copy link
Contributor Author

extend doesn't make sense in a terminal/bash, since there's no no selection. I think redo doesn't have an action mapped by default if ctrl+r goes to rev search… but I'm not sure that's default, have you customised your shell at all?

cut and copy use the vi clipboard rather than system, no way around that. I'm not sure default readline bindings have a way to do it either; And regardless, I think you would prefer to have, cut and copy and paste all operate on the terminal selection rather than read line (i.e so you can copy text out of your terminal to the system clipboard)

@nriley
Copy link
Collaborator

nriley commented Nov 29, 2025

extend doesn't make sense in a terminal/bash, since there's no no selection. I think redo doesn't have an action mapped by default if ctrl+r goes to rev search… but I'm not sure that's default, have you customised your shell at all?

$ bind -m vi-command -P | grep redo
vi-redo can be found on ".".
$ bind -m vi-insert -P | grep redo
vi-redo is not bound to any keys

Looks like it is only bound in command mode in bash by default. Undo is not bound in zsh's insert mode at all.

cut and copy use the vi clipboard rather than system, no way around that. I'm not sure default readline bindings have a way to do it either; And regardless, I think you would prefer to have, cut and copy and paste all operate on the terminal selection rather than read line (i.e so you can copy text out of your terminal to the system clipboard)

Some shells do indeed support a selection, but I agree it makes sense to use the system clipboard.

normal_cmd("ua")

def redo():
actions.key("escape")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it make more sense to use normal_cmd(".i") here? . seems to be bound as redo both in readline/bash and zsh.

Copy link
Contributor Author

@BlueDrink9 BlueDrink9 Nov 29, 2025

Choose a reason for hiding this comment

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

That's not redo in the sense that we mean it, it is repeat. readline doesn't have redo; however I still left this here so that in zsh (or other vi emulation) it does work

@BlueDrink9
Copy link
Contributor Author

Looks like it is only bound in command mode in bash by default. Undo is not bound in zsh's insert mode at all.

vi-redo is not the same as a traditional redo, it's actually a repeat command. So no, there is no way to redo

@BlueDrink9
Copy link
Contributor Author

BlueDrink9 commented Nov 29, 2025

Looks like it is only bound in command mode in bash by default. Undo is not bound in zsh's insert mode at all.

vi-redo is not the same as a traditional redo, it's actually a repeat command. So no, there is no way to redo

It does work as redo in zsh's vi command mode though.

"ctrl-r" does zsh redo, which it is what we have currently. "." does zsh repeat

@nriley
Copy link
Collaborator

nriley commented Nov 29, 2025

Looks like it is only bound in command mode in bash by default. Undo is not bound in zsh's insert mode at all.

vi-redo is not the same as a traditional redo, it's actually a repeat command. So no, there is no way to redo

It does work as redo in zsh's vi command mode though.

"ctrl-r" does zsh redo, which it is what we have currently. "." does zsh repeat

Gotcha. Please add comments on expected behavior at the least since bash defaults to reverse i-search in either vi insert or command mode.

@BlueDrink9
Copy link
Contributor Author

How's the comment I currently have?

@BlueDrink9 BlueDrink9 requested a review from nriley December 8, 2025 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants