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

add configuration to yank with dd #17

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
"type": "string",
"default": "#F8F3AB",
"description": "Background color that flashes to show the range when yanking."
},
"simpleVim.deleteYanks": {
"type": "boolean",
"default": false,
"description": "When true, d, dd, and D yank before deleting."
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,16 @@ export const actions: Action[] = [
}),

parseKeysExact(['d', 'd'], [Mode.Normal], (vimState, editor) => {
if (vscode.workspace.getConfiguration('simpleVim').get('deleteYanks')) {
yankLine(vimState, editor);
}
deleteLine(vimState, editor);
}),

parseKeysExact(['D'], [Mode.Normal], (vimState, editor) => {
if (vscode.workspace.getConfiguration('simpleVim').get('deleteYanks')) {
yankToEndOfLine(vimState, editor);
}
vscode.commands.executeCommand('deleteAllRight');
}),

Expand Down
3 changes: 3 additions & 0 deletions src/actions/operators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export const operators: Action[] = [

cursorsToRangesStart(editor, ranges);

if (vscode.workspace.getConfiguration('simpleVim').get('deleteYanks')) {
yank(vimState, editor, ranges, linewise);
}
delete_(editor, ranges, linewise);

if (vimState.mode === Mode.Visual || vimState.mode === Mode.VisualLine) {
Expand Down