Skip to content

[vi-mode] corrected normal/default mode pasting#7847

Merged
ridiculousfish merged 1 commit intofish-shell:masterfrom
LPe7:master
Mar 28, 2021
Merged

[vi-mode] corrected normal/default mode pasting#7847
ridiculousfish merged 1 commit intofish-shell:masterfrom
LPe7:master

Conversation

@LPe7
Copy link
Contributor

@LPe7 LPe7 commented Mar 21, 2021

Description

When using vi-mode, in normal/default mode p would put the wanted text just at the position of the cursor and P would paste one character before the curosr. But in vi, vim and other vi-based motions, p puts the text after the next character and P at the current character (or before the cursor).

I just changed

bind -s --preset p yank
bind -s --preset P backward-char yank

to :

bind -s --preset p forward-char yank
bind -s --preset P yank

And did the same modifications for "*p and "*P

Tested, works even if at begining/end of the line with p as well as with P.

In vim p means paste *after* current character, so go forward a char before pasting.
Also in vim, P means paste *at* current position (like at '|' with cursor = line),
so there's no need to go back a char, just paste it without moving.
@ridiculousfish ridiculousfish added this to the fish 3.3.0 milestone Mar 28, 2021
@ridiculousfish ridiculousfish merged commit a68791f into fish-shell:master Mar 28, 2021
@ridiculousfish
Copy link
Member

Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments