tpope / vim-rsi

rsi.vim: Readline style insertion
http://www.vim.org/scripts/script.php?script_id=4359
583 stars 35 forks source link

`<C-b>` on blank line also deletes last character of previous line #60

Open MithicSpirit opened 4 months ago

MithicSpirit commented 4 months ago

Doing <C-b> on a blank line (either empty or at the end of one with only whitespace) causes the line to be deleted (expected) and the last character of the previous line to be deleted as well (unexpected). For example, in the following code, pressing <C-b> results in just ba| (the | represents the cursor, rather than any character).

bar
|

Looking at the code, I believe that the culprit is the s at the end, and I think that replacing it with an a will fix the issue. https://github.com/tpope/vim-rsi/blob/45540637ead22f011e8215f1c90142e49d946a54/plugin/rsi.vim#L21 As a side note, why is 0<C-d> run? I thought J already removed the indentation.