Skip to content

Commit

Permalink
implemented replace
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonwilliams committed Jan 4, 2024
1 parent a2302ca commit 563e2bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
10 changes: 0 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,6 @@
"command": "-workbench.action.files.newUntitledFile",
"when": "true"
},
{
"key": "down",
"command": "-selectNextCodeAction",
"when": "codeActionMenuVisible"
},
{
"key": "up",
"command": "-selectPrevCodeAction",
"when": "codeActionMenuVisible"
},
{
"key": "ctrl+n",
"command": "selectNextCodeAction",
Expand Down
8 changes: 8 additions & 0 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ export const actions: Action[] = [
vscode.commands.executeCommand('deleteRight');
}),

// replace
parseKeysRegex(/^r(.)/, /^r/, [Mode.Normal], (helixState, editor, match) => {
const position = editor.selection.active;
editor.edit((builder) => {
builder.replace(new vscode.Range(position, position.with({ character: position.character + 1 })), match[1]);
});
}),

// existing
parseKeysExact(
[KeyMap.Actions.InsertMode],
Expand Down

0 comments on commit 563e2bb

Please sign in to comment.