diff --git a/extensions/helix/package.json b/extensions/helix/package.json
index 0777b91..fa59972 100644
--- a/extensions/helix/package.json
+++ b/extensions/helix/package.json
@@ -1503,6 +1503,12 @@
"title": "Delete",
"command": "dance.edit.delete"
},
+ {
+ "key": "D",
+ "when": "editorTextFocus && dance.mode == 'helix/normal'",
+ "title": "Delete contents of selection",
+ "command": "dance.edit.deleteSelections"
+ },
{
"key": "Shift+.",
"when": "editorTextFocus && dance.mode == 'helix/normal'",
@@ -1599,81 +1605,6 @@
"title": "Copy, delete and switch to Insert",
"command": "dance.edit.yank-delete-insert"
},
- {
- "key": "Shift+R",
- "when": "editorTextFocus && dance.mode == 'helix/select'",
- "command": "dance.run",
- "args": {
- "commands": [
- [
- ".edit.insert"
- ],
- [
- ".modes.set.normal"
- ]
- ]
- }
- },
- {
- "key": "Alt+D",
- "when": "editorTextFocus && dance.mode == 'helix/select'",
- "command": "dance.run",
- "args": {
- "commands": [
- [
- ".edit.delete"
- ],
- [
- ".modes.set.normal"
- ]
- ]
- }
- },
- {
- "key": "D",
- "when": "editorTextFocus && dance.mode == 'helix/select'",
- "command": "dance.run",
- "args": {
- "commands": [
- [
- ".edit.yank-delete"
- ],
- [
- ".modes.set.normal"
- ]
- ]
- }
- },
- {
- "key": "Shift+P",
- "when": "editorTextFocus && dance.mode == 'helix/select'",
- "command": "dance.run",
- "args": {
- "commands": [
- [
- ".edit.paste.before"
- ],
- [
- ".modes.set.normal"
- ]
- ]
- }
- },
- {
- "key": "P",
- "when": "editorTextFocus && dance.mode == 'helix/select'",
- "command": "dance.run",
- "args": {
- "commands": [
- [
- ".edit.paste.after"
- ],
- [
- ".modes.set.normal"
- ]
- ]
- }
- },
{
"key": "Shift+.",
"when": "editorTextFocus && dance.mode == 'helix/select'",
@@ -3340,6 +3271,16 @@
"command": "dance.ignore",
"when": "editorTextFocus && dance.mode == 'helix/normal'"
},
+ {
+ "key": "D",
+ "command": "dance.ignore",
+ "when": "editorTextFocus && dance.mode == 'helix/select'"
+ },
+ {
+ "key": "P",
+ "command": "dance.ignore",
+ "when": "editorTextFocus && dance.mode == 'helix/select'"
+ },
{
"key": "Q",
"command": "dance.ignore",
@@ -3375,11 +3316,21 @@
"command": "dance.ignore",
"when": "editorTextFocus && dance.mode == 'helix/select'"
},
+ {
+ "key": "Shift+P",
+ "command": "dance.ignore",
+ "when": "editorTextFocus && dance.mode == 'helix/select'"
+ },
{
"key": "Shift+Q",
"command": "dance.ignore",
"when": "editorTextFocus && dance.mode == 'helix/select'"
},
+ {
+ "key": "Shift+R",
+ "command": "dance.ignore",
+ "when": "editorTextFocus && dance.mode == 'helix/select'"
+ },
{
"key": "Shift+V",
"command": "dance.ignore",
diff --git a/package.json b/package.json
index 42a7732..8f76e28 100644
--- a/package.json
+++ b/package.json
@@ -1025,6 +1025,11 @@
"title": "Delete and switch to Insert",
"category": "Dance"
},
+ {
+ "command": "dance.edit.deleteSelections",
+ "title": "Delete contents of selection",
+ "category": "Dance"
+ },
{
"command": "dance.edit.indent",
"title": "Indent selected lines",
@@ -2046,6 +2051,12 @@
"title": "Delete and switch to Insert",
"command": "dance.edit.delete-insert"
},
+ {
+ "key": "D",
+ "when": "editorTextFocus && dance.mode == 'normal'",
+ "title": "Delete contents of selection",
+ "command": "dance.edit.deleteSelections"
+ },
{
"key": "Shift+.",
"when": "editorTextFocus && dance.mode == 'normal'",
diff --git a/src/api/data/commands.yaml b/src/api/data/commands.yaml
index 78398f6..47666fd 100644
--- a/src/api/data/commands.yaml
+++ b/src/api/data/commands.yaml
@@ -155,7 +155,7 @@ edit.delete:
en: Delete
commands: |-
- [".edit.insert", { register: "_", $exclude: [] }]
+ [".edit.deleteSelections"]
keys:
qwerty: |-
@@ -166,12 +166,34 @@ edit.delete-insert:
en: Delete and switch to Insert
commands: |-
- [".modes.set", { mode: "insert", $include: ["mode"] }], [".edit.insert", { register: "_", $exclude: ["mode"] }]
+ [".modes.set", { mode: "insert", $include: ["mode"] }], [".edit.deleteSelections"]
keys:
qwerty: |-
`a-c` (kakoune: normal)
+edit.deleteSelections:
+ title:
+ en: Delete contents of selection
+
+ keys:
+ qwerty: |-
+ `d` (core: normal)
+
+ doc:
+ en: |
+ Delete contents of selection.
+
+
+ #### Additional commands
+
+ | Title | Identifier | Keybinding | Commands |
+ | --------------------------------- | -------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
+ | Delete | `delete` | `a-d` (core: normal) | `[".edit.deleteSelections"]` |
+ | Delete and switch to Insert | `delete-insert` | `a-c` (kakoune: normal) | `[".modes.set", { mode: "insert", +mode }], [".edit.deleteSelections"]` |
+ | Copy and delete | `yank-delete` | `d` (core: normal) | `[".selections.saveText", { +register }], [".edit.deleteSelections"]` |
+ | Copy, delete and switch to Insert | `yank-delete-insert` | `c` (core: normal; helix: select) | `[".selections.saveText", { +register }], [".modes.set", { mode: "insert", +mode }], [".edit.deleteSelections"]` |
+
edit.indent:
title:
en: Indent selected lines
@@ -226,27 +248,18 @@ edit.insert:
#### Additional commands
- | Title | Identifier | Keybinding | Commands |
- | ---------------------------------- | ------------------------ | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
- | Pick register and replace | `selectRegister-insert` | `c-r` (kakoune: normal), `c-r` (kakoune: insert) | `[".selectRegister", { +register }], [".edit.insert", { ... }]` |
- | Paste before | `paste.before` | | `[".edit.insert", { handleNewLine: true, where: "start", ... }]` |
- | Paste after | `paste.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , ... }]` |
- | Paste before and select | `paste.before.select` | `s-p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "start", shift: "select", ... }]` |
- | Paste after and select | `paste.after.select` | `p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , shift: "select", ... }]` |
- | Paste all before | `pasteAll.before` | | `[".edit.insert", { handleNewLine: true, where: "start", all: true, ... }]` |
- | Paste all after | `pasteAll.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, ... }]` |
- | Paste all before and select | `pasteAll.before.select` | `s-a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "start", all: true, shift: "select", ... }]` |
- | Paste all after and select | `pasteAll.after.select` | `a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, shift: "select", ... }]` |
- | Delete | `delete` | `a-d` (core: normal) | `[".edit.insert", { register: "_", ... }]` |
- | Delete and switch to Insert | `delete-insert` | `a-c` (kakoune: normal) | `[".modes.set", { mode: "insert", +mode }], [".edit.insert", { register: "_", ... }]` |
- | Copy and delete | `yank-delete` | `d` (core: normal) | `[".selections.saveText", { +register }], [".edit.insert", { register: "_", ... }]` |
- | Copy, delete and switch to Insert | `yank-delete-insert` | `c` (core: normal; helix: select) | `[".selections.saveText", { +register }], [".modes.set", { mode: "insert", +mode }], [".edit.insert", { register: "_", ... }]` |
- | Copy and replace | `yank-replace` | `s-r` (kakoune: normal) | `[".selections.saveText", { register: "tmp" }], [".edit.insert"], [".updateRegister", { copyFrom: "tmp", ... }]` |
- | | | `s-r` (helix: select) | `[".edit.insert"], [".modes.set.normal"]` |
- | | | `a-d` (helix: select) | `[".edit.delete"], [".modes.set.normal"]` |
- | | | `d` (helix: select) | `[".edit.yank-delete"], [".modes.set.normal"]` |
- | | | `s-p` (helix: select) | `[".edit.paste.before"], [".modes.set.normal"]` |
- | | | `p` (helix: select) | `[".edit.paste.after"], [".modes.set.normal"]` |
+ | Title | Identifier | Keybinding | Commands |
+ | --------------------------- | ------------------------ | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
+ | Pick register and replace | `selectRegister-insert` | `c-r` (kakoune: normal), `c-r` (kakoune: insert) | `[".selectRegister", { +register }], [".edit.insert", { ... }]` |
+ | Paste before | `paste.before` | | `[".edit.insert", { handleNewLine: true, where: "start", ... }]` |
+ | Paste after | `paste.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , ... }]` |
+ | Paste before and select | `paste.before.select` | `s-p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "start", shift: "select", ... }]` |
+ | Paste after and select | `paste.after.select` | `p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , shift: "select", ... }]` |
+ | Paste all before | `pasteAll.before` | | `[".edit.insert", { handleNewLine: true, where: "start", all: true, ... }]` |
+ | Paste all after | `pasteAll.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, ... }]` |
+ | Paste all before and select | `pasteAll.before.select` | `s-a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "start", all: true, shift: "select", ... }]` |
+ | Paste all after and select | `pasteAll.after.select` | `a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, shift: "select", ... }]` |
+ | Copy and replace | `yank-replace` | `s-r` (kakoune: normal) | `[".selections.saveText", { register: "tmp" }], [".edit.insert"], [".updateRegister", { copyFrom: "tmp", ... }]` |
edit.join:
title:
@@ -441,10 +454,10 @@ edit.selectRegister-insert:
edit.yank-delete:
title:
- en: "Copy and delete"
+ en: Copy and delete
commands: |-
- [".selections.saveText", { $include: ["register"] }], [".edit.insert", { register: "_", $exclude: ["register"] }]
+ [".selections.saveText", { $include: ["register"] }], [".edit.deleteSelections"]
keys:
qwerty: |-
@@ -455,7 +468,7 @@ edit.yank-delete-insert:
en: Copy, delete and switch to Insert
commands: |-
- [".selections.saveText", { $include: ["register"] }], [".modes.set", { mode: "insert", $include: ["mode"] }], [".edit.insert", { register: "_", $exclude: ["register","mode"] }]
+ [".selections.saveText", { $include: ["register"] }], [".modes.set", { mode: "insert", $include: ["mode"] }], [".edit.deleteSelections"]
keys:
qwerty: |-
@@ -2749,13 +2762,6 @@ anonymous:
qwerty: |-
`<` (helix: select)
- - commands: |-
- [".edit.delete"], [".modes.set.normal"]
-
- keys:
- qwerty: |-
- `a-d` (helix: select)
-
- commands: |-
[".edit.indent"], [".modes.set.normal"]
@@ -2763,27 +2769,6 @@ anonymous:
qwerty: |-
`>` (helix: select)
- - commands: |-
- [".edit.insert"], [".modes.set.normal"]
-
- keys:
- qwerty: |-
- `s-r` (helix: select)
-
- - commands: |-
- [".edit.paste.after"], [".modes.set.normal"]
-
- keys:
- qwerty: |-
- `p` (helix: select)
-
- - commands: |-
- [".edit.paste.before"], [".modes.set.normal"]
-
- keys:
- qwerty: |-
- `s-p` (helix: select)
-
- commands: |-
[".edit.replaceCharacters"], [".modes.set.normal"]
@@ -2791,13 +2776,6 @@ anonymous:
qwerty: |-
`r` (helix: select)
- - commands: |-
- [".edit.yank-delete"], [".modes.set.normal"]
-
- keys:
- qwerty: |-
- `d` (helix: select)
-
- title:
en: Left bracket
diff --git a/src/commands/README.md b/src/commands/README.md
index 05e38c4..f3f2bfc 100644
--- a/src/commands/README.md
+++ b/src/commands/README.md
@@ -26,17 +26,18 @@ depending on the keyboard layout. The following layouts _will be_\* supported:
dev | dev.copyLastErrorMessage | Copies the last encountered error message | |
dev.setSelectionBehavior | Set the selection behavior of the specified mode | |
-edit | edit.align | Align selections | Shift+7 (editorTextFocus && dance.mode == 'normal') |
+edit | edit.align | Align selections | Shift+7 (editorTextFocus && dance.mode == 'normal') |
edit.case.swap | Swap case | Alt+` (editorTextFocus && dance.mode == 'normal')Shift+` (editorTextFocus && dance.mode == 'normal') |
edit.case.toLower | Transform to lower case | ` (editorTextFocus && dance.mode == 'normal') |
edit.case.toUpper | Transform to upper case | Shift+` (editorTextFocus && dance.mode == 'normal')Alt+` (editorTextFocus && dance.mode == 'normal') |
edit.copyIndentation | Copy indentation | Shift+Alt+7 (editorTextFocus && dance.mode == 'normal') |
edit.deindent | Deindent selected lines | Shift+Alt+, (editorTextFocus && dance.mode == 'normal') |
edit.deindent.withIncomplete | Deindent selected lines (including incomplete indent) | Shift+, (editorTextFocus && dance.mode == 'normal') |
-edit.delete | Delete | Alt+D (editorTextFocus && dance.mode == 'normal') |
-edit.delete-insert | Delete and switch to Insert | Alt+C (editorTextFocus && dance.mode == 'normal') |
-edit.newLine.above.insert | Insert new line above and switch to insert | Shift+O (editorTextFocus && dance.mode == 'normal')Shift+O (editorTextFocus && dance.mode == 'select') |
-edit.newLine.below.insert | Insert new line below and switch to insert | O (editorTextFocus && dance.mode == 'normal')O (editorTextFocus && dance.mode == 'select') |
+edit.deleteSelections | Delete contents of selection | D (editorTextFocus && dance.mode == 'normal') |
+edit.delete | Delete | Alt+D (editorTextFocus && dance.mode == 'normal') |
+edit.delete-insert | Delete and switch to Insert | Alt+C (editorTextFocus && dance.mode == 'normal') |
+edit.newLine.above.insert | Insert new line above and switch to insert | Shift+O (editorTextFocus && dance.mode == 'normal')Shift+O (editorTextFocus && dance.mode == 'select') |
+edit.newLine.below.insert | Insert new line below and switch to insert | O (editorTextFocus && dance.mode == 'normal')O (editorTextFocus && dance.mode == 'select') |
edit.paste.after | Paste after | |
edit.paste.after.select | Paste after and select | P (editorTextFocus && dance.mode == 'normal') |
edit.paste.before | Paste before | |
@@ -46,9 +47,9 @@ depending on the keyboard layout. The following layouts _will be_\* supported:
edit.pasteAll.before | Paste all before | |
edit.pasteAll.before.select | Paste all before and select | Shift+Alt+P (editorTextFocus && dance.mode == 'normal') |
edit.selectRegister-insert | Pick register and replace | Ctrl+R (editorTextFocus && dance.mode == 'normal')Ctrl+R (editorTextFocus && dance.mode == 'insert') |
-edit.yank-delete | Copy and delete | D (editorTextFocus && dance.mode == 'normal') |
-edit.yank-delete-insert | Copy, delete and switch to Insert | C (editorTextFocus && dance.mode == 'normal')C (editorTextFocus && dance.mode == 'select') |
-edit.yank-replace | Copy and replace | Shift+R (editorTextFocus && dance.mode == 'normal') |
+edit.yank-delete | Copy and delete | D (editorTextFocus && dance.mode == 'normal') |
+edit.yank-delete-insert | Copy, delete and switch to Insert | C (editorTextFocus && dance.mode == 'normal')C (editorTextFocus && dance.mode == 'select') |
+edit.yank-replace | Copy and replace | Shift+R (editorTextFocus && dance.mode == 'normal') |
edit.indent | Indent selected lines | Shift+. (editorTextFocus && dance.mode == 'normal') |
edit.indent.withEmpty | Indent selected lines (including empty lines) | Shift+Alt+. (editorTextFocus && dance.mode == 'normal') |
edit.insert | Insert contents of register | Shift+Alt+R (editorTextFocus && dance.mode == 'normal')Shift+R (editorTextFocus && dance.mode == 'normal') |
@@ -265,7 +266,7 @@ See https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#changes
-### [`edit.insert`](./edit.ts#L15-L66)
+### [`edit.insert`](./edit.ts#L15-L57)
Insert contents of register.
@@ -282,27 +283,18 @@ Specify `all` to paste all contents next to each selection.
#### Additional commands
-| Title | Identifier | Keybinding | Commands |
-| ---------------------------------- | ------------------------ | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
-| Pick register and replace | `selectRegister-insert` | `c-r` (kakoune: normal), `c-r` (kakoune: insert) | `[".selectRegister", { +register }], [".edit.insert", { ... }]` |
-| Paste before | `paste.before` | | `[".edit.insert", { handleNewLine: true, where: "start", ... }]` |
-| Paste after | `paste.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , ... }]` |
-| Paste before and select | `paste.before.select` | `s-p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "start", shift: "select", ... }]` |
-| Paste after and select | `paste.after.select` | `p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , shift: "select", ... }]` |
-| Paste all before | `pasteAll.before` | | `[".edit.insert", { handleNewLine: true, where: "start", all: true, ... }]` |
-| Paste all after | `pasteAll.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, ... }]` |
-| Paste all before and select | `pasteAll.before.select` | `s-a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "start", all: true, shift: "select", ... }]` |
-| Paste all after and select | `pasteAll.after.select` | `a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, shift: "select", ... }]` |
-| Delete | `delete` | `a-d` (core: normal) | `[".edit.insert", { register: "_", ... }]` |
-| Delete and switch to Insert | `delete-insert` | `a-c` (kakoune: normal) | `[".modes.set", { mode: "insert", +mode }], [".edit.insert", { register: "_", ... }]` |
-| Copy and delete | `yank-delete` | `d` (core: normal) | `[".selections.saveText", { +register }], [".edit.insert", { register: "_", ... }]` |
-| Copy, delete and switch to Insert | `yank-delete-insert` | `c` (core: normal; helix: select) | `[".selections.saveText", { +register }], [".modes.set", { mode: "insert", +mode }], [".edit.insert", { register: "_", ... }]` |
-| Copy and replace | `yank-replace` | `s-r` (kakoune: normal) | `[".selections.saveText", { register: "tmp" }], [".edit.insert"], [".updateRegister", { copyFrom: "tmp", ... }]` |
-| | | `s-r` (helix: select) | `[".edit.insert"], [".modes.set.normal"]` |
-| | | `a-d` (helix: select) | `[".edit.delete"], [".modes.set.normal"]` |
-| | | `d` (helix: select) | `[".edit.yank-delete"], [".modes.set.normal"]` |
-| | | `s-p` (helix: select) | `[".edit.paste.before"], [".modes.set.normal"]` |
-| | | `p` (helix: select) | `[".edit.paste.after"], [".modes.set.normal"]` |
+| Title | Identifier | Keybinding | Commands |
+| --------------------------- | ------------------------ | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
+| Pick register and replace | `selectRegister-insert` | `c-r` (kakoune: normal), `c-r` (kakoune: insert) | `[".selectRegister", { +register }], [".edit.insert", { ... }]` |
+| Paste before | `paste.before` | | `[".edit.insert", { handleNewLine: true, where: "start", ... }]` |
+| Paste after | `paste.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , ... }]` |
+| Paste before and select | `paste.before.select` | `s-p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "start", shift: "select", ... }]` |
+| Paste after and select | `paste.after.select` | `p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , shift: "select", ... }]` |
+| Paste all before | `pasteAll.before` | | `[".edit.insert", { handleNewLine: true, where: "start", all: true, ... }]` |
+| Paste all after | `pasteAll.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, ... }]` |
+| Paste all before and select | `pasteAll.before.select` | `s-a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "start", all: true, shift: "select", ... }]` |
+| Paste all after and select | `pasteAll.after.select` | `a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, shift: "select", ... }]` |
+| Copy and replace | `yank-replace` | `s-r` (kakoune: normal) | `[".selections.saveText", { register: "tmp" }], [".edit.insert"], [".updateRegister", { copyFrom: "tmp", ... }]` |
This command:
- accepts a register (by default, it uses `dquote`).
@@ -311,15 +303,33 @@ This command:
- takes an argument `all` of type `boolean`.
- takes an argument `handleNewLine` of type `boolean`.
- takes an argument `shift` of type `Shift`.
-- takes an argument `text` of type `string`.
- takes an argument `where` of type `"active" | "anchor" | "start" | "end" | undefined`.
Default keybinding: `s-a-r` (kakoune: normal)
`s-r` (helix: normal)
+
+
+### [`edit.deleteSelections`](./edit.ts#L129-L146)
+
+Delete contents of selection.
+
+
+#### Additional commands
+
+| Title | Identifier | Keybinding | Commands |
+| --------------------------------- | -------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
+| Delete | `delete` | `a-d` (core: normal) | `[".edit.deleteSelections"]` |
+| Delete and switch to Insert | `delete-insert` | `a-c` (kakoune: normal) | `[".modes.set", { mode: "insert", +mode }], [".edit.deleteSelections"]` |
+| Copy and delete | `yank-delete` | `d` (core: normal) | `[".selections.saveText", { +register }], [".edit.deleteSelections"]` |
+| Copy, delete and switch to Insert | `yank-delete-insert` | `c` (core: normal; helix: select) | `[".selections.saveText", { +register }], [".modes.set", { mode: "insert", +mode }], [".edit.deleteSelections"]` |
+
+
+Default keybinding: `d` (core: normal)
+
-### [`edit.join`](./edit.ts#L138-L143)
+### [`edit.join`](./edit.ts#L150-L155)
Join lines.
@@ -332,7 +342,7 @@ Default keybinding: `a-j` (kakoune: normal)
-### [`edit.join.select`](./edit.ts#L147-L152)
+### [`edit.join.select`](./edit.ts#L159-L164)
Join lines and select inserted separators.
@@ -344,7 +354,7 @@ Default keybinding: `s-a-j` (core: normal; helix: select)
-### [`edit.indent`](./edit.ts#L156-L164)
+### [`edit.indent`](./edit.ts#L168-L176)
Indent selected lines.
@@ -359,7 +369,7 @@ Default keybinding: `>` (core: normal)
-### [`edit.indent.withEmpty`](./edit.ts#L168-L173)
+### [`edit.indent.withEmpty`](./edit.ts#L180-L185)
Indent selected lines (including empty lines).
@@ -371,7 +381,7 @@ Default keybinding: `a->` (kakoune: normal)
-### [`edit.deindent`](./edit.ts#L177-L182)
+### [`edit.deindent`](./edit.ts#L189-L194)
Deindent selected lines.
@@ -383,7 +393,7 @@ Default keybinding: `a-<` (kakoune: normal)
-### [`edit.deindent.withIncomplete`](./edit.ts#L186-L194)
+### [`edit.deindent.withIncomplete`](./edit.ts#L198-L206)
Deindent selected lines (including incomplete indent).
@@ -398,7 +408,7 @@ Default keybinding: `<` (core: normal)
-### [`edit.case.toLower`](./edit.ts#L198-L206)
+### [`edit.case.toLower`](./edit.ts#L210-L218)
Transform to lower case.
@@ -411,7 +421,7 @@ Default keybinding: `` ` `` (core: normal)
-### [`edit.case.toUpper`](./edit.ts#L210-L218)
+### [`edit.case.toUpper`](./edit.ts#L222-L230)
Transform to upper case.
@@ -425,7 +435,7 @@ Default keybinding: `` s-` `` (kakoune: normal)
-### [`edit.case.swap`](./edit.ts#L222-L230)
+### [`edit.case.swap`](./edit.ts#L234-L242)
Swap case.
@@ -439,7 +449,7 @@ Default keybinding: `` a-` `` (kakoune: normal)
-### [`edit.replaceCharacters`](./edit.ts#L245-L257)
+### [`edit.replaceCharacters`](./edit.ts#L257-L269)
Replace characters.
@@ -455,7 +465,7 @@ Default keybinding: `r` (core: normal)
-### [`edit.align`](./edit.ts#L300-L308)
+### [`edit.align`](./edit.ts#L312-L320)
Align selections.
@@ -470,7 +480,7 @@ Default keybinding: `&` (core: normal)
-### [`edit.copyIndentation`](./edit.ts#L358-L371)
+### [`edit.copyIndentation`](./edit.ts#L370-L383)
Copy indentation.
@@ -485,7 +495,7 @@ Default keybinding: `a-&` (kakoune: normal)
-### [`edit.newLine.above`](./edit.ts#L400-L418)
+### [`edit.newLine.above`](./edit.ts#L412-L430)
Insert new line above each selection.
@@ -507,7 +517,7 @@ Default keybinding: `s-a-o` (kakoune: normal)
-### [`edit.newLine.below`](./edit.ts#L438-L456)
+### [`edit.newLine.below`](./edit.ts#L450-L468)
Insert new line below each selection.
diff --git a/src/commands/edit.ts b/src/commands/edit.ts
index 693e78e..35409fe 100644
--- a/src/commands/edit.ts
+++ b/src/commands/edit.ts
@@ -29,27 +29,18 @@ declare module "./edit";
*
* #### Additional commands
*
- * | Title | Identifier | Keybinding | Commands |
- * | ---------------------------------- | ------------------------ | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
- * | Pick register and replace | `selectRegister-insert` | `c-r` (kakoune: normal), `c-r` (kakoune: insert) | `[".selectRegister", { +register }], [".edit.insert", { ... }]` |
- * | Paste before | `paste.before` | | `[".edit.insert", { handleNewLine: true, where: "start", ... }]` |
- * | Paste after | `paste.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , ... }]` |
- * | Paste before and select | `paste.before.select` | `s-p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "start", shift: "select", ... }]` |
- * | Paste after and select | `paste.after.select` | `p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , shift: "select", ... }]` |
- * | Paste all before | `pasteAll.before` | | `[".edit.insert", { handleNewLine: true, where: "start", all: true, ... }]` |
- * | Paste all after | `pasteAll.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, ... }]` |
- * | Paste all before and select | `pasteAll.before.select` | `s-a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "start", all: true, shift: "select", ... }]` |
- * | Paste all after and select | `pasteAll.after.select` | `a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, shift: "select", ... }]` |
- * | Delete | `delete` | `a-d` (core: normal) | `[".edit.insert", { register: "_", ... }]` |
- * | Delete and switch to Insert | `delete-insert` | `a-c` (kakoune: normal) | `[".modes.set", { mode: "insert", +mode }], [".edit.insert", { register: "_", ... }]` |
- * | Copy and delete | `yank-delete` | `d` (core: normal) | `[".selections.saveText", { +register }], [".edit.insert", { register: "_", ... }]` |
- * | Copy, delete and switch to Insert | `yank-delete-insert` | `c` (core: normal; helix: select) | `[".selections.saveText", { +register }], [".modes.set", { mode: "insert", +mode }], [".edit.insert", { register: "_", ... }]` |
- * | Copy and replace | `yank-replace` | `s-r` (kakoune: normal) | `[".selections.saveText", { register: "tmp" }], [".edit.insert"], [".updateRegister", { copyFrom: "tmp", ... }]` |
- * | | | `s-r` (helix: select) | `[".edit.insert"], [".modes.set.normal"]` |
- * | | | `a-d` (helix: select) | `[".edit.delete"], [".modes.set.normal"]` |
- * | | | `d` (helix: select) | `[".edit.yank-delete"], [".modes.set.normal"]` |
- * | | | `s-p` (helix: select) | `[".edit.paste.before"], [".modes.set.normal"]` |
- * | | | `p` (helix: select) | `[".edit.paste.after"], [".modes.set.normal"]` |
+ * | Title | Identifier | Keybinding | Commands |
+ * | --------------------------- | ------------------------ | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
+ * | Pick register and replace | `selectRegister-insert` | `c-r` (kakoune: normal), `c-r` (kakoune: insert) | `[".selectRegister", { +register }], [".edit.insert", { ... }]` |
+ * | Paste before | `paste.before` | | `[".edit.insert", { handleNewLine: true, where: "start", ... }]` |
+ * | Paste after | `paste.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , ... }]` |
+ * | Paste before and select | `paste.before.select` | `s-p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "start", shift: "select", ... }]` |
+ * | Paste after and select | `paste.after.select` | `p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , shift: "select", ... }]` |
+ * | Paste all before | `pasteAll.before` | | `[".edit.insert", { handleNewLine: true, where: "start", all: true, ... }]` |
+ * | Paste all after | `pasteAll.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, ... }]` |
+ * | Paste all before and select | `pasteAll.before.select` | `s-a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "start", all: true, shift: "select", ... }]` |
+ * | Paste all after and select | `pasteAll.after.select` | `a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, shift: "select", ... }]` |
+ * | Copy and replace | `yank-replace` | `s-r` (kakoune: normal) | `[".selections.saveText", { register: "tmp" }], [".edit.insert"], [".updateRegister", { copyFrom: "tmp", ... }]` |
*/
export async function insert(
_: Context,
@@ -60,9 +51,9 @@ export async function insert(
all: Argument = false,
handleNewLine: Argument = false,
repetitions: number,
- shift?: Argument,
- text?: Argument,
+ text: Argument,
where?: Argument<"active" | "anchor" | "start" | "end" | undefined>,
+ shift?: Argument,
) {
let contents = text?.length
? (shift === Shift.Select ? [text] : selections.map(() => text))
@@ -135,6 +126,27 @@ export async function insert(
);
}
+/**
+ * Delete contents of selection.
+ *
+ * @keys `d` (core: normal)
+ *
+ * #### Additional commands
+ *
+ * | Title | Identifier | Keybinding | Commands |
+ * | --------------------------------- | -------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
+ * | Delete | `delete` | `a-d` (core: normal) | `[".edit.deleteSelections"]` |
+ * | Delete and switch to Insert | `delete-insert` | `a-c` (kakoune: normal) | `[".modes.set", { mode: "insert", +mode }], [".edit.deleteSelections"]` |
+ * | Copy and delete | `yank-delete` | `d` (core: normal) | `[".selections.saveText", { +register }], [".edit.deleteSelections"]` |
+ * | Copy, delete and switch to Insert | `yank-delete-insert` | `c` (core: normal; helix: select) | `[".selections.saveText", { +register }], [".modes.set", { mode: "insert", +mode }], [".edit.deleteSelections"]` |
+ */
+export async function deleteSelections(
+ _: Context,
+ selections: readonly vscode.Selection[],
+) {
+ Selections.set(await replace((_) => "", selections));
+}
+
/**
* Join lines.
*
diff --git a/src/commands/layouts/azerty.fr.md b/src/commands/layouts/azerty.fr.md
index c9ad209..030e6be 100644
--- a/src/commands/layouts/azerty.fr.md
+++ b/src/commands/layouts/azerty.fr.md
@@ -11,17 +11,18 @@
dev | dev.copyLastErrorMessage | Copies the last encountered error message | |
dev.setSelectionBehavior | Set the selection behavior of the specified mode | |
-edit | edit.align | Align selections | Shift+7 (editorTextFocus && dance.mode == 'normal') |
+edit | edit.align | Align selections | Shift+7 (editorTextFocus && dance.mode == 'normal') |
edit.case.swap | Swap case | Alt+` (editorTextFocus && dance.mode == 'normal')Shift+` (editorTextFocus && dance.mode == 'normal') |
edit.case.toLower | Transform to lower case | ` (editorTextFocus && dance.mode == 'normal') |
edit.case.toUpper | Transform to upper case | Shift+` (editorTextFocus && dance.mode == 'normal')Alt+` (editorTextFocus && dance.mode == 'normal') |
edit.copyIndentation | Copy indentation | Shift+Alt+7 (editorTextFocus && dance.mode == 'normal') |
edit.deindent | Deindent selected lines | Shift+Alt+, (editorTextFocus && dance.mode == 'normal') |
edit.deindent.withIncomplete | Deindent selected lines (including incomplete indent) | Shift+, (editorTextFocus && dance.mode == 'normal') |
-edit.delete | Delete | Alt+D (editorTextFocus && dance.mode == 'normal') |
-edit.delete-insert | Delete and switch to Insert | Alt+C (editorTextFocus && dance.mode == 'normal') |
-edit.newLine.above.insert | Insert new line above and switch to insert | Shift+O (editorTextFocus && dance.mode == 'normal')Shift+O (editorTextFocus && dance.mode == 'select') |
-edit.newLine.below.insert | Insert new line below and switch to insert | O (editorTextFocus && dance.mode == 'normal')O (editorTextFocus && dance.mode == 'select') |
+edit.deleteSelections | Delete contents of selection | D (editorTextFocus && dance.mode == 'normal') |
+edit.delete | Delete | Alt+D (editorTextFocus && dance.mode == 'normal') |
+edit.delete-insert | Delete and switch to Insert | Alt+C (editorTextFocus && dance.mode == 'normal') |
+edit.newLine.above.insert | Insert new line above and switch to insert | Shift+O (editorTextFocus && dance.mode == 'normal')Shift+O (editorTextFocus && dance.mode == 'select') |
+edit.newLine.below.insert | Insert new line below and switch to insert | O (editorTextFocus && dance.mode == 'normal')O (editorTextFocus && dance.mode == 'select') |
edit.paste.after | Paste after | |
edit.paste.after.select | Paste after and select | P (editorTextFocus && dance.mode == 'normal') |
edit.paste.before | Paste before | |
@@ -31,9 +32,9 @@
edit.pasteAll.before | Paste all before | |
edit.pasteAll.before.select | Paste all before and select | Shift+Alt+P (editorTextFocus && dance.mode == 'normal') |
edit.selectRegister-insert | Pick register and replace | Ctrl+R (editorTextFocus && dance.mode == 'normal')Ctrl+R (editorTextFocus && dance.mode == 'insert') |
-edit.yank-delete | Copy and delete | D (editorTextFocus && dance.mode == 'normal') |
-edit.yank-delete-insert | Copy, delete and switch to Insert | C (editorTextFocus && dance.mode == 'normal')C (editorTextFocus && dance.mode == 'select') |
-edit.yank-replace | Copy and replace | Shift+R (editorTextFocus && dance.mode == 'normal') |
+edit.yank-delete | Copy and delete | D (editorTextFocus && dance.mode == 'normal') |
+edit.yank-delete-insert | Copy, delete and switch to Insert | C (editorTextFocus && dance.mode == 'normal')C (editorTextFocus && dance.mode == 'select') |
+edit.yank-replace | Copy and replace | Shift+R (editorTextFocus && dance.mode == 'normal') |
edit.indent | Indent selected lines | Shift+. (editorTextFocus && dance.mode == 'normal') |
edit.indent.withEmpty | Indent selected lines (including empty lines) | Shift+Alt+. (editorTextFocus && dance.mode == 'normal') |
edit.insert | Insert contents of register | Shift+Alt+R (editorTextFocus && dance.mode == 'normal')Shift+R (editorTextFocus && dance.mode == 'normal') |
@@ -250,7 +251,7 @@ See https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#changes
-### [`edit.insert`](../edit.ts#L15-L66)
+### [`edit.insert`](../edit.ts#L15-L57)
Insert contents of register.
@@ -267,27 +268,18 @@ Specify `all` to paste all contents next to each selection.
#### Additional commands
-| Title | Identifier | Keybinding | Commands |
-| ---------------------------------- | ------------------------ | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
-| Pick register and replace | `selectRegister-insert` | `c-r` (kakoune: normal), `c-r` (kakoune: insert) | `[".selectRegister", { +register }], [".edit.insert", { ... }]` |
-| Paste before | `paste.before` | | `[".edit.insert", { handleNewLine: true, where: "start", ... }]` |
-| Paste after | `paste.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , ... }]` |
-| Paste before and select | `paste.before.select` | `s-p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "start", shift: "select", ... }]` |
-| Paste after and select | `paste.after.select` | `p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , shift: "select", ... }]` |
-| Paste all before | `pasteAll.before` | | `[".edit.insert", { handleNewLine: true, where: "start", all: true, ... }]` |
-| Paste all after | `pasteAll.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, ... }]` |
-| Paste all before and select | `pasteAll.before.select` | `s-a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "start", all: true, shift: "select", ... }]` |
-| Paste all after and select | `pasteAll.after.select` | `a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, shift: "select", ... }]` |
-| Delete | `delete` | `a-d` (core: normal) | `[".edit.insert", { register: "_", ... }]` |
-| Delete and switch to Insert | `delete-insert` | `a-c` (kakoune: normal) | `[".modes.set", { mode: "insert", +mode }], [".edit.insert", { register: "_", ... }]` |
-| Copy and delete | `yank-delete` | `d` (core: normal) | `[".selections.saveText", { +register }], [".edit.insert", { register: "_", ... }]` |
-| Copy, delete and switch to Insert | `yank-delete-insert` | `c` (core: normal; helix: select) | `[".selections.saveText", { +register }], [".modes.set", { mode: "insert", +mode }], [".edit.insert", { register: "_", ... }]` |
-| Copy and replace | `yank-replace` | `s-r` (kakoune: normal) | `[".selections.saveText", { register: "tmp" }], [".edit.insert"], [".updateRegister", { copyFrom: "tmp", ... }]` |
-| | | `s-r` (helix: select) | `[".edit.insert"], [".modes.set.normal"]` |
-| | | `a-d` (helix: select) | `[".edit.delete"], [".modes.set.normal"]` |
-| | | `d` (helix: select) | `[".edit.yank-delete"], [".modes.set.normal"]` |
-| | | `s-p` (helix: select) | `[".edit.paste.before"], [".modes.set.normal"]` |
-| | | `p` (helix: select) | `[".edit.paste.after"], [".modes.set.normal"]` |
+| Title | Identifier | Keybinding | Commands |
+| --------------------------- | ------------------------ | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
+| Pick register and replace | `selectRegister-insert` | `c-r` (kakoune: normal), `c-r` (kakoune: insert) | `[".selectRegister", { +register }], [".edit.insert", { ... }]` |
+| Paste before | `paste.before` | | `[".edit.insert", { handleNewLine: true, where: "start", ... }]` |
+| Paste after | `paste.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , ... }]` |
+| Paste before and select | `paste.before.select` | `s-p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "start", shift: "select", ... }]` |
+| Paste after and select | `paste.after.select` | `p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , shift: "select", ... }]` |
+| Paste all before | `pasteAll.before` | | `[".edit.insert", { handleNewLine: true, where: "start", all: true, ... }]` |
+| Paste all after | `pasteAll.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, ... }]` |
+| Paste all before and select | `pasteAll.before.select` | `s-a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "start", all: true, shift: "select", ... }]` |
+| Paste all after and select | `pasteAll.after.select` | `a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, shift: "select", ... }]` |
+| Copy and replace | `yank-replace` | `s-r` (kakoune: normal) | `[".selections.saveText", { register: "tmp" }], [".edit.insert"], [".updateRegister", { copyFrom: "tmp", ... }]` |
This command:
- accepts a register (by default, it uses `dquote`).
@@ -296,15 +288,33 @@ This command:
- takes an argument `all` of type `boolean`.
- takes an argument `handleNewLine` of type `boolean`.
- takes an argument `shift` of type `Shift`.
-- takes an argument `text` of type `string`.
- takes an argument `where` of type `"active" | "anchor" | "start" | "end" | undefined`.
Default keybinding: `s-a-r` (kakoune: normal)
`s-r` (helix: normal)
+
+
+### [`edit.deleteSelections`](../edit.ts#L129-L146)
+
+Delete contents of selection.
+
+
+#### Additional commands
+
+| Title | Identifier | Keybinding | Commands |
+| --------------------------------- | -------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
+| Delete | `delete` | `a-d` (core: normal) | `[".edit.deleteSelections"]` |
+| Delete and switch to Insert | `delete-insert` | `a-c` (kakoune: normal) | `[".modes.set", { mode: "insert", +mode }], [".edit.deleteSelections"]` |
+| Copy and delete | `yank-delete` | `d` (core: normal) | `[".selections.saveText", { +register }], [".edit.deleteSelections"]` |
+| Copy, delete and switch to Insert | `yank-delete-insert` | `c` (core: normal; helix: select) | `[".selections.saveText", { +register }], [".modes.set", { mode: "insert", +mode }], [".edit.deleteSelections"]` |
+
+
+Default keybinding: `d` (core: normal)
+
-### [`edit.join`](../edit.ts#L138-L143)
+### [`edit.join`](../edit.ts#L150-L155)
Join lines.
@@ -317,7 +327,7 @@ Default keybinding: `a-j` (kakoune: normal)
-### [`edit.join.select`](../edit.ts#L147-L152)
+### [`edit.join.select`](../edit.ts#L159-L164)
Join lines and select inserted separators.
@@ -329,7 +339,7 @@ Default keybinding: `s-a-j` (core: normal; helix: select)
-### [`edit.indent`](../edit.ts#L156-L164)
+### [`edit.indent`](../edit.ts#L168-L176)
Indent selected lines.
@@ -344,7 +354,7 @@ Default keybinding: `>` (core: normal)
-### [`edit.indent.withEmpty`](../edit.ts#L168-L173)
+### [`edit.indent.withEmpty`](../edit.ts#L180-L185)
Indent selected lines (including empty lines).
@@ -356,7 +366,7 @@ Default keybinding: `a->` (kakoune: normal)
-### [`edit.deindent`](../edit.ts#L177-L182)
+### [`edit.deindent`](../edit.ts#L189-L194)
Deindent selected lines.
@@ -368,7 +378,7 @@ Default keybinding: `a-<` (kakoune: normal)
-### [`edit.deindent.withIncomplete`](../edit.ts#L186-L194)
+### [`edit.deindent.withIncomplete`](../edit.ts#L198-L206)
Deindent selected lines (including incomplete indent).
@@ -383,7 +393,7 @@ Default keybinding: `<` (core: normal)
-### [`edit.case.toLower`](../edit.ts#L198-L206)
+### [`edit.case.toLower`](../edit.ts#L210-L218)
Transform to lower case.
@@ -396,7 +406,7 @@ Default keybinding: `` ` `` (core: normal)
-### [`edit.case.toUpper`](../edit.ts#L210-L218)
+### [`edit.case.toUpper`](../edit.ts#L222-L230)
Transform to upper case.
@@ -410,7 +420,7 @@ Default keybinding: `` s-` `` (kakoune: normal)
-### [`edit.case.swap`](../edit.ts#L222-L230)
+### [`edit.case.swap`](../edit.ts#L234-L242)
Swap case.
@@ -424,7 +434,7 @@ Default keybinding: `` a-` `` (kakoune: normal)
-### [`edit.replaceCharacters`](../edit.ts#L245-L257)
+### [`edit.replaceCharacters`](../edit.ts#L257-L269)
Replace characters.
@@ -440,7 +450,7 @@ Default keybinding: `r` (core: normal)
-### [`edit.align`](../edit.ts#L300-L308)
+### [`edit.align`](../edit.ts#L312-L320)
Align selections.
@@ -455,7 +465,7 @@ Default keybinding: `&` (core: normal)
-### [`edit.copyIndentation`](../edit.ts#L358-L371)
+### [`edit.copyIndentation`](../edit.ts#L370-L383)
Copy indentation.
@@ -470,7 +480,7 @@ Default keybinding: `a-&` (kakoune: normal)
-### [`edit.newLine.above`](../edit.ts#L400-L418)
+### [`edit.newLine.above`](../edit.ts#L412-L430)
Insert new line above each selection.
@@ -492,7 +502,7 @@ Default keybinding: `s-a-o` (kakoune: normal)
-### [`edit.newLine.below`](../edit.ts#L438-L456)
+### [`edit.newLine.below`](../edit.ts#L450-L468)
Insert new line below each selection.
diff --git a/src/commands/layouts/qwerty.md b/src/commands/layouts/qwerty.md
index f79f574..13d931e 100644
--- a/src/commands/layouts/qwerty.md
+++ b/src/commands/layouts/qwerty.md
@@ -11,17 +11,18 @@
dev | dev.copyLastErrorMessage | Copies the last encountered error message | |
dev.setSelectionBehavior | Set the selection behavior of the specified mode | |
-edit | edit.align | Align selections | Shift+7 (editorTextFocus && dance.mode == 'normal') |
+edit | edit.align | Align selections | Shift+7 (editorTextFocus && dance.mode == 'normal') |
edit.case.swap | Swap case | Alt+` (editorTextFocus && dance.mode == 'normal')Shift+` (editorTextFocus && dance.mode == 'normal') |
edit.case.toLower | Transform to lower case | ` (editorTextFocus && dance.mode == 'normal') |
edit.case.toUpper | Transform to upper case | Shift+` (editorTextFocus && dance.mode == 'normal')Alt+` (editorTextFocus && dance.mode == 'normal') |
edit.copyIndentation | Copy indentation | Shift+Alt+7 (editorTextFocus && dance.mode == 'normal') |
edit.deindent | Deindent selected lines | Shift+Alt+, (editorTextFocus && dance.mode == 'normal') |
edit.deindent.withIncomplete | Deindent selected lines (including incomplete indent) | Shift+, (editorTextFocus && dance.mode == 'normal') |
-edit.delete | Delete | Alt+D (editorTextFocus && dance.mode == 'normal') |
-edit.delete-insert | Delete and switch to Insert | Alt+C (editorTextFocus && dance.mode == 'normal') |
-edit.newLine.above.insert | Insert new line above and switch to insert | Shift+O (editorTextFocus && dance.mode == 'normal')Shift+O (editorTextFocus && dance.mode == 'select') |
-edit.newLine.below.insert | Insert new line below and switch to insert | O (editorTextFocus && dance.mode == 'normal')O (editorTextFocus && dance.mode == 'select') |
+edit.deleteSelections | Delete contents of selection | D (editorTextFocus && dance.mode == 'normal') |
+edit.delete | Delete | Alt+D (editorTextFocus && dance.mode == 'normal') |
+edit.delete-insert | Delete and switch to Insert | Alt+C (editorTextFocus && dance.mode == 'normal') |
+edit.newLine.above.insert | Insert new line above and switch to insert | Shift+O (editorTextFocus && dance.mode == 'normal')Shift+O (editorTextFocus && dance.mode == 'select') |
+edit.newLine.below.insert | Insert new line below and switch to insert | O (editorTextFocus && dance.mode == 'normal')O (editorTextFocus && dance.mode == 'select') |
edit.paste.after | Paste after | |
edit.paste.after.select | Paste after and select | P (editorTextFocus && dance.mode == 'normal') |
edit.paste.before | Paste before | |
@@ -31,9 +32,9 @@
edit.pasteAll.before | Paste all before | |
edit.pasteAll.before.select | Paste all before and select | Shift+Alt+P (editorTextFocus && dance.mode == 'normal') |
edit.selectRegister-insert | Pick register and replace | Ctrl+R (editorTextFocus && dance.mode == 'normal')Ctrl+R (editorTextFocus && dance.mode == 'insert') |
-edit.yank-delete | Copy and delete | D (editorTextFocus && dance.mode == 'normal') |
-edit.yank-delete-insert | Copy, delete and switch to Insert | C (editorTextFocus && dance.mode == 'normal')C (editorTextFocus && dance.mode == 'select') |
-edit.yank-replace | Copy and replace | Shift+R (editorTextFocus && dance.mode == 'normal') |
+edit.yank-delete | Copy and delete | D (editorTextFocus && dance.mode == 'normal') |
+edit.yank-delete-insert | Copy, delete and switch to Insert | C (editorTextFocus && dance.mode == 'normal')C (editorTextFocus && dance.mode == 'select') |
+edit.yank-replace | Copy and replace | Shift+R (editorTextFocus && dance.mode == 'normal') |
edit.indent | Indent selected lines | Shift+. (editorTextFocus && dance.mode == 'normal') |
edit.indent.withEmpty | Indent selected lines (including empty lines) | Shift+Alt+. (editorTextFocus && dance.mode == 'normal') |
edit.insert | Insert contents of register | Shift+Alt+R (editorTextFocus && dance.mode == 'normal')Shift+R (editorTextFocus && dance.mode == 'normal') |
@@ -250,7 +251,7 @@ See https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#changes
-### [`edit.insert`](../edit.ts#L15-L66)
+### [`edit.insert`](../edit.ts#L15-L57)
Insert contents of register.
@@ -267,27 +268,18 @@ Specify `all` to paste all contents next to each selection.
#### Additional commands
-| Title | Identifier | Keybinding | Commands |
-| ---------------------------------- | ------------------------ | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
-| Pick register and replace | `selectRegister-insert` | `c-r` (kakoune: normal), `c-r` (kakoune: insert) | `[".selectRegister", { +register }], [".edit.insert", { ... }]` |
-| Paste before | `paste.before` | | `[".edit.insert", { handleNewLine: true, where: "start", ... }]` |
-| Paste after | `paste.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , ... }]` |
-| Paste before and select | `paste.before.select` | `s-p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "start", shift: "select", ... }]` |
-| Paste after and select | `paste.after.select` | `p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , shift: "select", ... }]` |
-| Paste all before | `pasteAll.before` | | `[".edit.insert", { handleNewLine: true, where: "start", all: true, ... }]` |
-| Paste all after | `pasteAll.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, ... }]` |
-| Paste all before and select | `pasteAll.before.select` | `s-a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "start", all: true, shift: "select", ... }]` |
-| Paste all after and select | `pasteAll.after.select` | `a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, shift: "select", ... }]` |
-| Delete | `delete` | `a-d` (core: normal) | `[".edit.insert", { register: "_", ... }]` |
-| Delete and switch to Insert | `delete-insert` | `a-c` (kakoune: normal) | `[".modes.set", { mode: "insert", +mode }], [".edit.insert", { register: "_", ... }]` |
-| Copy and delete | `yank-delete` | `d` (core: normal) | `[".selections.saveText", { +register }], [".edit.insert", { register: "_", ... }]` |
-| Copy, delete and switch to Insert | `yank-delete-insert` | `c` (core: normal; helix: select) | `[".selections.saveText", { +register }], [".modes.set", { mode: "insert", +mode }], [".edit.insert", { register: "_", ... }]` |
-| Copy and replace | `yank-replace` | `s-r` (kakoune: normal) | `[".selections.saveText", { register: "tmp" }], [".edit.insert"], [".updateRegister", { copyFrom: "tmp", ... }]` |
-| | | `s-r` (helix: select) | `[".edit.insert"], [".modes.set.normal"]` |
-| | | `a-d` (helix: select) | `[".edit.delete"], [".modes.set.normal"]` |
-| | | `d` (helix: select) | `[".edit.yank-delete"], [".modes.set.normal"]` |
-| | | `s-p` (helix: select) | `[".edit.paste.before"], [".modes.set.normal"]` |
-| | | `p` (helix: select) | `[".edit.paste.after"], [".modes.set.normal"]` |
+| Title | Identifier | Keybinding | Commands |
+| --------------------------- | ------------------------ | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
+| Pick register and replace | `selectRegister-insert` | `c-r` (kakoune: normal), `c-r` (kakoune: insert) | `[".selectRegister", { +register }], [".edit.insert", { ... }]` |
+| Paste before | `paste.before` | | `[".edit.insert", { handleNewLine: true, where: "start", ... }]` |
+| Paste after | `paste.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , ... }]` |
+| Paste before and select | `paste.before.select` | `s-p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "start", shift: "select", ... }]` |
+| Paste after and select | `paste.after.select` | `p` (core: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , shift: "select", ... }]` |
+| Paste all before | `pasteAll.before` | | `[".edit.insert", { handleNewLine: true, where: "start", all: true, ... }]` |
+| Paste all after | `pasteAll.after` | | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, ... }]` |
+| Paste all before and select | `pasteAll.before.select` | `s-a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "start", all: true, shift: "select", ... }]` |
+| Paste all after and select | `pasteAll.after.select` | `a-p` (kakoune: normal) | `[".edit.insert", { handleNewLine: true, where: "end" , all: true, shift: "select", ... }]` |
+| Copy and replace | `yank-replace` | `s-r` (kakoune: normal) | `[".selections.saveText", { register: "tmp" }], [".edit.insert"], [".updateRegister", { copyFrom: "tmp", ... }]` |
This command:
- accepts a register (by default, it uses `dquote`).
@@ -296,15 +288,33 @@ This command:
- takes an argument `all` of type `boolean`.
- takes an argument `handleNewLine` of type `boolean`.
- takes an argument `shift` of type `Shift`.
-- takes an argument `text` of type `string`.
- takes an argument `where` of type `"active" | "anchor" | "start" | "end" | undefined`.
Default keybinding: `s-a-r` (kakoune: normal)
`s-r` (helix: normal)
+
+
+### [`edit.deleteSelections`](../edit.ts#L129-L146)
+
+Delete contents of selection.
+
+
+#### Additional commands
+
+| Title | Identifier | Keybinding | Commands |
+| --------------------------------- | -------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
+| Delete | `delete` | `a-d` (core: normal) | `[".edit.deleteSelections"]` |
+| Delete and switch to Insert | `delete-insert` | `a-c` (kakoune: normal) | `[".modes.set", { mode: "insert", +mode }], [".edit.deleteSelections"]` |
+| Copy and delete | `yank-delete` | `d` (core: normal) | `[".selections.saveText", { +register }], [".edit.deleteSelections"]` |
+| Copy, delete and switch to Insert | `yank-delete-insert` | `c` (core: normal; helix: select) | `[".selections.saveText", { +register }], [".modes.set", { mode: "insert", +mode }], [".edit.deleteSelections"]` |
+
+
+Default keybinding: `d` (core: normal)
+
-### [`edit.join`](../edit.ts#L138-L143)
+### [`edit.join`](../edit.ts#L150-L155)
Join lines.
@@ -317,7 +327,7 @@ Default keybinding: `a-j` (kakoune: normal)
-### [`edit.join.select`](../edit.ts#L147-L152)
+### [`edit.join.select`](../edit.ts#L159-L164)
Join lines and select inserted separators.
@@ -329,7 +339,7 @@ Default keybinding: `s-a-j` (core: normal; helix: select)
-### [`edit.indent`](../edit.ts#L156-L164)
+### [`edit.indent`](../edit.ts#L168-L176)
Indent selected lines.
@@ -344,7 +354,7 @@ Default keybinding: `>` (core: normal)
-### [`edit.indent.withEmpty`](../edit.ts#L168-L173)
+### [`edit.indent.withEmpty`](../edit.ts#L180-L185)
Indent selected lines (including empty lines).
@@ -356,7 +366,7 @@ Default keybinding: `a->` (kakoune: normal)
-### [`edit.deindent`](../edit.ts#L177-L182)
+### [`edit.deindent`](../edit.ts#L189-L194)
Deindent selected lines.
@@ -368,7 +378,7 @@ Default keybinding: `a-<` (kakoune: normal)
-### [`edit.deindent.withIncomplete`](../edit.ts#L186-L194)
+### [`edit.deindent.withIncomplete`](../edit.ts#L198-L206)
Deindent selected lines (including incomplete indent).
@@ -383,7 +393,7 @@ Default keybinding: `<` (core: normal)
-### [`edit.case.toLower`](../edit.ts#L198-L206)
+### [`edit.case.toLower`](../edit.ts#L210-L218)
Transform to lower case.
@@ -396,7 +406,7 @@ Default keybinding: `` ` `` (core: normal)
-### [`edit.case.toUpper`](../edit.ts#L210-L218)
+### [`edit.case.toUpper`](../edit.ts#L222-L230)
Transform to upper case.
@@ -410,7 +420,7 @@ Default keybinding: `` s-` `` (kakoune: normal)
-### [`edit.case.swap`](../edit.ts#L222-L230)
+### [`edit.case.swap`](../edit.ts#L234-L242)
Swap case.
@@ -424,7 +434,7 @@ Default keybinding: `` a-` `` (kakoune: normal)
-### [`edit.replaceCharacters`](../edit.ts#L245-L257)
+### [`edit.replaceCharacters`](../edit.ts#L257-L269)
Replace characters.
@@ -440,7 +450,7 @@ Default keybinding: `r` (core: normal)
-### [`edit.align`](../edit.ts#L300-L308)
+### [`edit.align`](../edit.ts#L312-L320)
Align selections.
@@ -455,7 +465,7 @@ Default keybinding: `&` (core: normal)
-### [`edit.copyIndentation`](../edit.ts#L358-L371)
+### [`edit.copyIndentation`](../edit.ts#L370-L383)
Copy indentation.
@@ -470,7 +480,7 @@ Default keybinding: `a-&` (kakoune: normal)
-### [`edit.newLine.above`](../edit.ts#L400-L418)
+### [`edit.newLine.above`](../edit.ts#L412-L430)
Insert new line above each selection.
@@ -492,7 +502,7 @@ Default keybinding: `s-a-o` (kakoune: normal)
-### [`edit.newLine.below`](../edit.ts#L438-L456)
+### [`edit.newLine.below`](../edit.ts#L450-L468)
Insert new line below each selection.
diff --git a/src/commands/load-all.ts b/src/commands/load-all.ts
index 11eec32..30c60e1 100644
--- a/src/commands/load-all.ts
+++ b/src/commands/load-all.ts
@@ -162,6 +162,7 @@ import {
copyIndentation as edit_copyIndentation,
deindent as edit_deindent,
deindent_withIncomplete as edit_deindent_withIncomplete,
+ deleteSelections as edit_deleteSelections,
indent as edit_indent,
indent_withEmpty as edit_indent_withEmpty,
insert as edit_insert,
@@ -334,6 +335,11 @@ export const commands: Commands = function () {
(_, argument) => _.runAsync(async (_) => await edit_deindent_withIncomplete(_, getRepetitions(_, argument))),
CommandDescriptor.Flags.RequiresActiveEditor,
),
+ "dance.edit.deleteSelections": new CommandDescriptor(
+ "dance.edit.deleteSelections",
+ (_) => _.runAsync(async (_) => await edit_deleteSelections(_, _.selections)),
+ CommandDescriptor.Flags.RequiresActiveEditor,
+ ),
"dance.edit.indent": new CommandDescriptor(
"dance.edit.indent",
(_, argument) => _.runAsync(async (_) => await edit_indent(_, getRepetitions(_, argument))),
@@ -346,7 +352,7 @@ export const commands: Commands = function () {
),
"dance.edit.insert": new CommandDescriptor(
"dance.edit.insert",
- (_, argument) => _.runAsync(async (_) => await edit_insert(_, _.selections, getRegister(_, argument, "dquote", Register.Flags.CanRead), argument["adjust"], argument["all"], argument["handleNewLine"], getRepetitions(_, argument), getShift(argument), argument["text"], argument["where"])),
+ (_, argument) => _.runAsync(async (_) => await edit_insert(_, _.selections, getRegister(_, argument, "dquote", Register.Flags.CanRead), argument["adjust"], argument["all"], argument["handleNewLine"], getRepetitions(_, argument), argument["text"], argument["where"], getShift(argument))),
CommandDescriptor.Flags.RequiresActiveEditor,
),
"dance.edit.join": new CommandDescriptor(
@@ -778,33 +784,33 @@ export const commands: Commands = function () {
);
describeAdditionalCommand(
commands,
- "dance.edit.delete",
+ "dance.edit.yank-replace",
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
- [[".edit.insert", { register: "_", $exclude: [] }]],
+ [[".selections.saveText", { register: "tmp" }], [".edit.insert"], [".updateRegister", { copyFrom: "tmp", $exclude: [] }]],
);
describeAdditionalCommand(
commands,
- "dance.edit.delete-insert",
+ "dance.edit.delete",
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
- [[".modes.set", { mode: "insert", $include: ["mode"] }], [".edit.insert", { register: "_", $exclude: ["mode"] }]],
+ [[".edit.deleteSelections"]],
);
describeAdditionalCommand(
commands,
- "dance.edit.yank-delete",
+ "dance.edit.delete-insert",
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
- [[".selections.saveText", { $include: ["register"] }], [".edit.insert", { register: "_", $exclude: ["register"] }]],
+ [[".modes.set", { mode: "insert", $include: ["mode"] }], [".edit.deleteSelections"]],
);
describeAdditionalCommand(
commands,
- "dance.edit.yank-delete-insert",
+ "dance.edit.yank-delete",
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
- [[".selections.saveText", { $include: ["register"] }], [".modes.set", { mode: "insert", $include: ["mode"] }], [".edit.insert", { register: "_", $exclude: ["register","mode"] }]],
+ [[".selections.saveText", { $include: ["register"] }], [".edit.deleteSelections"]],
);
describeAdditionalCommand(
commands,
- "dance.edit.yank-replace",
+ "dance.edit.yank-delete-insert",
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
- [[".selections.saveText", { register: "tmp" }], [".edit.insert"], [".updateRegister", { copyFrom: "tmp", $exclude: [] }]],
+ [[".selections.saveText", { $include: ["register"] }], [".modes.set", { mode: "insert", $include: ["mode"] }], [".edit.deleteSelections"]],
);
describeAdditionalCommand(
commands,
diff --git a/test/suite/commands/edit-insert.md b/test/suite/commands/edit-delete.md
similarity index 100%
rename from test/suite/commands/edit-insert.md
rename to test/suite/commands/edit-delete.md
diff --git a/test/suite/commands/edit-delete.test.ts b/test/suite/commands/edit-delete.test.ts
new file mode 100644
index 0000000..261ad04
--- /dev/null
+++ b/test/suite/commands/edit-delete.test.ts
@@ -0,0 +1,79 @@
+import * as vscode from "vscode";
+
+import { executeCommand, ExpectedDocument, groupTestsByParentName } from "../utils";
+
+suite("./test/suite/commands/edit-delete.md", function () {
+ // Set up document.
+ let document: vscode.TextDocument,
+ editor: vscode.TextEditor;
+
+ this.beforeAll(async () => {
+ document = await vscode.workspace.openTextDocument({ language: "plaintext" });
+ editor = await vscode.window.showTextDocument(document);
+ editor.options.insertSpaces = true;
+ editor.options.tabSize = 2;
+
+ await executeCommand("dance.dev.setSelectionBehavior", { mode: "normal", value: "caret" });
+ });
+
+ this.afterAll(async () => {
+ await executeCommand("workbench.action.closeActiveEditor");
+ });
+
+ test("1 > delete", async function () {
+ // Set-up document to be in expected initial state.
+ await ExpectedDocument.apply(editor, 6, String.raw`
+ foo bar
+ ^^ 0
+ `);
+
+ // Perform all operations.
+ await executeCommand("dance.edit.delete");
+
+ // Ensure document is as expected.
+ ExpectedDocument.assertEquals(editor, "./test/suite/commands/edit-delete.md:8:1", 6, String.raw`
+ fooar
+ | 0
+ `);
+ });
+
+ test("1 > delete-character", async function () {
+ // Set-up document to be in expected initial state.
+ await ExpectedDocument.apply(editor, 6, String.raw`
+ foo bar
+ ^^ 0
+ `);
+
+ // Perform all operations.
+ await executeCommand("dance.dev.setSelectionBehavior", { mode: "normal", value: "character" });
+ await executeCommand("dance.edit.delete");
+ await executeCommand("dance.dev.setSelectionBehavior", { mode: "normal", value: "caret" });
+
+ // Ensure document is as expected.
+ ExpectedDocument.assertEquals(editor, "./test/suite/commands/edit-delete.md:18:1", 6, String.raw`
+ fooar
+ ^ 0
+ `);
+ });
+
+ test("1 > delete-character > x", async function () {
+ // Set-up document to be in expected initial state.
+ await ExpectedDocument.apply(editor, 6, String.raw`
+ fooar
+ ^ 0
+ `);
+
+ // Perform all operations.
+ await executeCommand("dance.dev.setSelectionBehavior", { mode: "normal", value: "character" });
+ await executeCommand("dance.edit.delete");
+ await executeCommand("dance.dev.setSelectionBehavior", { mode: "normal", value: "caret" });
+
+ // Ensure document is as expected.
+ ExpectedDocument.assertEquals(editor, "./test/suite/commands/edit-delete.md:30:1", 6, String.raw`
+ foor
+ ^ 0
+ `);
+ });
+
+ groupTestsByParentName(this);
+});
diff --git a/test/suite/commands/edit-insert.test.ts b/test/suite/commands/edit-delete.ts
similarity index 100%
rename from test/suite/commands/edit-insert.test.ts
rename to test/suite/commands/edit-delete.ts