Skip to content

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

@MithicSpirit

Description

@MithicSpirit

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.

inoremap <expr> <C-B> getline('.')=~'^\s*$'&&col('.')>strlen(getline('.'))?"0\<Lt>C-D>\<Lt>Esc>kJs":"\<Lt>Left>"

As a side note, why is 0<C-d> run? I thought J already removed the indentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions