Skip to content
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

Implement <Del> as vim insert command ( like <c-h> ) #4219

Closed
sql-koala opened this issue Oct 26, 2019 · 0 comments · Fixed by #4492
Closed

Implement <Del> as vim insert command ( like <c-h> ) #4219

sql-koala opened this issue Oct 26, 2019 · 0 comments · Fixed by #4492

Comments

@sql-koala
Copy link
Contributor

sql-koala commented Oct 26, 2019

Hi VScodeVim Team,
let me start with: Thank you for this extension. I just installed it together with vscode and it feels comfortable (to an experienced vim user).
However, I found one missing feature that seems worth implementing: del> as vim insert command ( in a way that is repeatable and a single undo ).

Is your feature request related to a problem? Please describe.
I think <del> is not implemented in insert mode. I noticed this because I like to map <c-l>to <del>.
When pressing Del key, the vscode command "deleteRight" is probably executed. This does delete the char to the right, but it messes up vim's undo and repeat. Like so: undo does not undo the del, it undoes the last vim command.
This extension provides a command: extension.vim_delete but this is not for insert mode, as it appears.

Describe the solution you'd like
I would suggest to implement this analog to c-h. This is from source insert.js. I think a simple copy + paste and changing position to position + 1 char to the right would to it.

let CommandCtrlHInInsertMode = class CommandCtrlHInInsertMode extends actions_1.BaseCommand {
    constructor() {
        super(...arguments);
        this.modes = [mode_1.ModeName.Insert];
        this.keys = ['<C-h>'];
    }
    exec(position, vimState) {
        return __awaiter(this, void 0, void 0, function* () {
            vimState.recordedState.transformations.push({
                type: 'deleteText',
                position: position,
            });
            return vimState;
        });
    }
};

Describe alternatives you've considered
I mapped <c-l> to <c-o>x and this does the job, but it also "destroys" undo/repeat.

Relates to:
#4082

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

Successfully merging a pull request may close this issue.

2 participants