diff --git a/extensions/helix/package.json b/extensions/helix/package.json
index 0777b91..09cfcbd 100644
--- a/extensions/helix/package.json
+++ b/extensions/helix/package.json
@@ -1497,12 +1497,6 @@
"title": "Deindent selected lines (including incomplete indent)",
"command": "dance.edit.deindent.withIncomplete"
},
- {
- "key": "Alt+D",
- "when": "editorTextFocus && dance.mode == 'helix/normal'",
- "title": "Delete",
- "command": "dance.edit.delete"
- },
{
"key": "Shift+.",
"when": "editorTextFocus && dance.mode == 'helix/normal'",
@@ -1581,99 +1575,6 @@
"title": "Replace characters",
"command": "dance.edit.replaceCharacters"
},
- {
- "key": "D",
- "when": "editorTextFocus && dance.mode == 'helix/normal'",
- "title": "Copy and delete",
- "command": "dance.edit.yank-delete"
- },
- {
- "key": "C",
- "when": "editorTextFocus && dance.mode == 'helix/normal'",
- "title": "Copy, delete and switch to Insert",
- "command": "dance.edit.yank-delete-insert"
- },
- {
- "key": "C",
- "when": "editorTextFocus && dance.mode == 'helix/select'",
- "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'",
@@ -3220,6 +3121,16 @@
"$exclude": []
}
},
+ {
+ "key": "C",
+ "command": "dance.ignore",
+ "when": "editorTextFocus && dance.mode == 'helix/normal'"
+ },
+ {
+ "key": "D",
+ "command": "dance.ignore",
+ "when": "editorTextFocus && dance.mode == 'helix/normal'"
+ },
{
"key": "Q",
"command": "dance.ignore",
@@ -3340,6 +3251,21 @@
"command": "dance.ignore",
"when": "editorTextFocus && dance.mode == 'helix/normal'"
},
+ {
+ "key": "C",
+ "command": "dance.ignore",
+ "when": "editorTextFocus && dance.mode == 'helix/select'"
+ },
+ {
+ "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 +3301,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..b9c36c7 100644
--- a/package.json
+++ b/package.json
@@ -1015,16 +1015,6 @@
"title": "Deindent selected lines (including incomplete indent)",
"category": "Dance"
},
- {
- "command": "dance.edit.delete",
- "title": "Delete",
- "category": "Dance"
- },
- {
- "command": "dance.edit.delete-insert",
- "title": "Delete and switch to Insert",
- "category": "Dance"
- },
{
"command": "dance.edit.indent",
"title": "Indent selected lines",
@@ -1120,16 +1110,6 @@
"title": "Pick register and replace",
"category": "Dance"
},
- {
- "command": "dance.edit.yank-delete",
- "title": "Copy and delete",
- "category": "Dance"
- },
- {
- "command": "dance.edit.yank-delete-insert",
- "title": "Copy, delete and switch to Insert",
- "category": "Dance"
- },
{
"command": "dance.edit.yank-replace",
"title": "Copy and replace",
@@ -2034,18 +2014,6 @@
"title": "Deindent selected lines (including incomplete indent)",
"command": "dance.edit.deindent.withIncomplete"
},
- {
- "key": "Alt+D",
- "when": "editorTextFocus && dance.mode == 'normal'",
- "title": "Delete",
- "command": "dance.edit.delete"
- },
- {
- "key": "Alt+C",
- "when": "editorTextFocus && dance.mode == 'normal'",
- "title": "Delete and switch to Insert",
- "command": "dance.edit.delete-insert"
- },
{
"key": "Shift+.",
"when": "editorTextFocus && dance.mode == 'normal'",
@@ -2142,18 +2110,6 @@
"title": "Pick register and replace",
"command": "dance.edit.selectRegister-insert"
},
- {
- "key": "D",
- "when": "editorTextFocus && dance.mode == 'normal'",
- "title": "Copy and delete",
- "command": "dance.edit.yank-delete"
- },
- {
- "key": "C",
- "when": "editorTextFocus && dance.mode == 'normal'",
- "title": "Copy, delete and switch to Insert",
- "command": "dance.edit.yank-delete-insert"
- },
{
"key": "Shift+R",
"when": "editorTextFocus && dance.mode == 'normal'",
@@ -3242,6 +3198,16 @@
"$exclude": []
}
},
+ {
+ "key": "C",
+ "command": "dance.ignore",
+ "when": "editorTextFocus && dance.mode == 'normal'"
+ },
+ {
+ "key": "D",
+ "command": "dance.ignore",
+ "when": "editorTextFocus && dance.mode == 'normal'"
+ },
{
"key": "Shift+D",
"command": "dance.ignore",
diff --git a/src/api/data/commands.yaml b/src/api/data/commands.yaml
index 78398f6..519e061 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", { register: "_", $exclude: [] }]
keys:
qwerty: |-
@@ -166,12 +166,47 @@ 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.delete-insert-preserving-lines:
+ title:
+ en: Delete and switch to Insert preserving lines
+
+ commands: |-
+ [".modes.set", { mode: "insert", $include: ["mode"] }], [".edit.deleteSelections", { preserveEntireLines: true, $exclude: ["mode"] }]
+
+ keys:
+ qwerty: |-
+ `a-c` (helix: 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", { register: "_", ... }]` |
+ | Delete and switch to Insert | `delete-insert` | `a-c` (kakoune: normal) | `[".modes.set", { mode: "insert", +mode }], [".edit.deleteSelections"]` |
+ | Delete and switch to Insert preserving lines | `delete-insert-preserving-lines` | `a-c` (helix: normal) | `[".modes.set", { mode: "insert", +mode }], [".edit.deleteSelections", { preserveEntireLines: true, ... }]` |
+ | Copy and delete | `yank-delete` | `d` (core: normal) | `[".selections.saveText", { +register }], [".edit.deleteSelections"]` |
+ | Copy, delete and switch to Insert | `yank-delete-insert` | `c` (kakoune: normal | `[".selections.saveText", { +register }], [".modes.set", { mode: "insert", +mode }], [".edit.deleteSelections"]` |
+ | Copy, delete and switch to Insert preserving lines | `yank-delete-insert-preserving-lines` | `c` (helix: normal; helix: select) | `[".selections.saveText", { +register }], [".modes.set", { mode: "insert", +mode }], [".edit.deleteSelections", { preserveEntireLines: true, ... }]` |
+
edit.indent:
title:
en: Indent selected lines
@@ -226,27 +261,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 +467,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,11 +481,22 @@ 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: |-
+ `c` (kakoune: normal
+
+edit.yank-delete-insert-preserving-lines:
+ title:
+ en: Copy, delete and switch to Insert preserving lines
+
+ commands: |-
+ [".selections.saveText", { $include: ["register"] }], [".modes.set", { mode: "insert", $include: ["mode"] }], [".edit.deleteSelections", { preserveEntireLines: true, $exclude: ["register","mode"] }]
keys:
qwerty: |-
- `c` (core: normal; helix: select)
+ `c` (helix: normal; helix: select)
edit.yank-replace:
title:
@@ -2749,13 +2786,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 +2793,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 +2800,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..0aa35fd 100644
--- a/src/commands/README.md
+++ b/src/commands/README.md
@@ -26,29 +26,25 @@ 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.paste.after | Paste after | |
-edit.paste.after.select | Paste after and select | P (editorTextFocus && dance.mode == 'normal') |
-edit.paste.before | Paste before | |
-edit.paste.before.select | Paste before and select | Shift+P (editorTextFocus && dance.mode == 'normal') |
-edit.pasteAll.after | Paste all after | |
-edit.pasteAll.after.select | Paste all after and select | Alt+P (editorTextFocus && dance.mode == 'normal') |
-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.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 | |
+edit.paste.before.select | Paste before and select | Shift+P (editorTextFocus && dance.mode == 'normal') |
+edit.pasteAll.after | Paste all after | |
+edit.pasteAll.after.select | Paste all after and select | Alt+P (editorTextFocus && dance.mode == 'normal') |
+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-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 +261,7 @@ See https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#changes
-### [`edit.insert`](./edit.ts#L15-L66)
+### [`edit.insert`](./edit.ts#L16-L58)
Insert contents of register.
@@ -282,27 +278,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,7 +298,6 @@ 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)
@@ -319,7 +305,7 @@ Default keybinding: `s-a-r` (kakoune: normal)
-### [`edit.join`](./edit.ts#L138-L143)
+### [`edit.join`](./edit.ts#L180-L185)
Join lines.
@@ -332,7 +318,7 @@ Default keybinding: `a-j` (kakoune: normal)
-### [`edit.join.select`](./edit.ts#L147-L152)
+### [`edit.join.select`](./edit.ts#L189-L194)
Join lines and select inserted separators.
@@ -344,7 +330,7 @@ Default keybinding: `s-a-j` (core: normal; helix: select)
-### [`edit.indent`](./edit.ts#L156-L164)
+### [`edit.indent`](./edit.ts#L198-L206)
Indent selected lines.
@@ -359,7 +345,7 @@ Default keybinding: `>` (core: normal)
-### [`edit.indent.withEmpty`](./edit.ts#L168-L173)
+### [`edit.indent.withEmpty`](./edit.ts#L210-L215)
Indent selected lines (including empty lines).
@@ -371,7 +357,7 @@ Default keybinding: `a->` (kakoune: normal)
-### [`edit.deindent`](./edit.ts#L177-L182)
+### [`edit.deindent`](./edit.ts#L219-L224)
Deindent selected lines.
@@ -383,7 +369,7 @@ Default keybinding: `a-<` (kakoune: normal)
-### [`edit.deindent.withIncomplete`](./edit.ts#L186-L194)
+### [`edit.deindent.withIncomplete`](./edit.ts#L228-L236)
Deindent selected lines (including incomplete indent).
@@ -398,7 +384,7 @@ Default keybinding: `<` (core: normal)
-### [`edit.case.toLower`](./edit.ts#L198-L206)
+### [`edit.case.toLower`](./edit.ts#L240-L248)
Transform to lower case.
@@ -411,7 +397,7 @@ Default keybinding: `` ` `` (core: normal)
-### [`edit.case.toUpper`](./edit.ts#L210-L218)
+### [`edit.case.toUpper`](./edit.ts#L252-L260)
Transform to upper case.
@@ -425,7 +411,7 @@ Default keybinding: `` s-` `` (kakoune: normal)
-### [`edit.case.swap`](./edit.ts#L222-L230)
+### [`edit.case.swap`](./edit.ts#L264-L272)
Swap case.
@@ -439,7 +425,7 @@ Default keybinding: `` a-` `` (kakoune: normal)
-### [`edit.replaceCharacters`](./edit.ts#L245-L257)
+### [`edit.replaceCharacters`](./edit.ts#L287-L299)
Replace characters.
@@ -455,7 +441,7 @@ Default keybinding: `r` (core: normal)
-### [`edit.align`](./edit.ts#L300-L308)
+### [`edit.align`](./edit.ts#L342-L350)
Align selections.
@@ -470,7 +456,7 @@ Default keybinding: `&` (core: normal)
-### [`edit.copyIndentation`](./edit.ts#L358-L371)
+### [`edit.copyIndentation`](./edit.ts#L400-L413)
Copy indentation.
@@ -485,7 +471,7 @@ Default keybinding: `a-&` (kakoune: normal)
-### [`edit.newLine.above`](./edit.ts#L400-L418)
+### [`edit.newLine.above`](./edit.ts#L442-L460)
Insert new line above each selection.
@@ -507,7 +493,7 @@ Default keybinding: `s-a-o` (kakoune: normal)
-### [`edit.newLine.below`](./edit.ts#L438-L456)
+### [`edit.newLine.below`](./edit.ts#L480-L498)
Insert new line below each selection.
diff --git a/src/commands/edit.ts b/src/commands/edit.ts
index 693e78e..902965a 100644
--- a/src/commands/edit.ts
+++ b/src/commands/edit.ts
@@ -4,6 +4,7 @@ import type { Argument, InputOr, RegisterOr } from ".";
import { insert as apiInsert, Context, deindentLines, Direction, edit, indentLines, insertByIndex, insertByIndexWithFullLines, insertFlagsAtEdge, joinLines, keypress, Positions, replace, replaceByIndex, Selections, Shift } from "../api";
import type { Register } from "../state/registers";
import { ArgumentError, LengthMismatchError } from "../utils/errors";
+import { horizontally } from "./select";
/**
* Perform changes on the text content of the document.
@@ -29,27 +30,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 +52,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 +127,40 @@ 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", { register: "_", ... }]` |
+ * | Delete and switch to Insert | `delete-insert` | `a-c` (kakoune: normal) | `[".modes.set", { mode: "insert", +mode }], [".edit.deleteSelections"]` |
+ * | Delete and switch to Insert preserving lines | `delete-insert-preserving-lines` | `a-c` (helix: normal) | `[".modes.set", { mode: "insert", +mode }], [".edit.deleteSelections", { preserveEntireLines: true, ... }]` |
+ * | Copy and delete | `yank-delete` | `d` (core: normal) | `[".selections.saveText", { +register }], [".edit.deleteSelections"]` |
+ * | Copy, delete and switch to Insert | `yank-delete-insert` | `c` (kakoune: normal | `[".selections.saveText", { +register }], [".modes.set", { mode: "insert", +mode }], [".edit.deleteSelections"]` |
+ * | Copy, delete and switch to Insert preserving lines | `yank-delete-insert-preserving-lines` | `c` (helix: normal; helix: select) | `[".selections.saveText", { +register }], [".modes.set", { mode: "insert", +mode }], [".edit.deleteSelections", { preserveEntireLines: true, ... }]` |
+ */
+export async function deleteSelections(
+ _: Context,
+ selections: readonly vscode.Selection[],
+ preserveEntireLines: Argument = false,
+) {
+ Selections.set(await replace((_) => "", selections));
+
+ if (preserveEntireLines) {
+ const onlyEntireLines = selections.every((selection, _i) =>
+ Selections.isEntireLines(selection),
+ );
+ if (onlyEntireLines) {
+ newLine_above(_, 1);
+ horizontally(_, false, 0, Direction.Backward, Shift.Jump);
+ }
+ }
+}
+
/**
* Join lines.
*
diff --git a/src/commands/layouts/azerty.fr.md b/src/commands/layouts/azerty.fr.md
index c9ad209..fa5dfbd 100644
--- a/src/commands/layouts/azerty.fr.md
+++ b/src/commands/layouts/azerty.fr.md
@@ -11,29 +11,25 @@
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.paste.after | Paste after | |
-edit.paste.after.select | Paste after and select | P (editorTextFocus && dance.mode == 'normal') |
-edit.paste.before | Paste before | |
-edit.paste.before.select | Paste before and select | Shift+P (editorTextFocus && dance.mode == 'normal') |
-edit.pasteAll.after | Paste all after | |
-edit.pasteAll.after.select | Paste all after and select | Alt+P (editorTextFocus && dance.mode == 'normal') |
-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.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 | |
+edit.paste.before.select | Paste before and select | Shift+P (editorTextFocus && dance.mode == 'normal') |
+edit.pasteAll.after | Paste all after | |
+edit.pasteAll.after.select | Paste all after and select | Alt+P (editorTextFocus && dance.mode == 'normal') |
+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-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 +246,7 @@ See https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#changes
-### [`edit.insert`](../edit.ts#L15-L66)
+### [`edit.insert`](../edit.ts#L16-L58)
Insert contents of register.
@@ -267,27 +263,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,7 +283,6 @@ 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)
@@ -304,7 +290,7 @@ Default keybinding: `s-a-r` (kakoune: normal)
-### [`edit.join`](../edit.ts#L138-L143)
+### [`edit.join`](../edit.ts#L180-L185)
Join lines.
@@ -317,7 +303,7 @@ Default keybinding: `a-j` (kakoune: normal)
-### [`edit.join.select`](../edit.ts#L147-L152)
+### [`edit.join.select`](../edit.ts#L189-L194)
Join lines and select inserted separators.
@@ -329,7 +315,7 @@ Default keybinding: `s-a-j` (core: normal; helix: select)
-### [`edit.indent`](../edit.ts#L156-L164)
+### [`edit.indent`](../edit.ts#L198-L206)
Indent selected lines.
@@ -344,7 +330,7 @@ Default keybinding: `>` (core: normal)
-### [`edit.indent.withEmpty`](../edit.ts#L168-L173)
+### [`edit.indent.withEmpty`](../edit.ts#L210-L215)
Indent selected lines (including empty lines).
@@ -356,7 +342,7 @@ Default keybinding: `a->` (kakoune: normal)
-### [`edit.deindent`](../edit.ts#L177-L182)
+### [`edit.deindent`](../edit.ts#L219-L224)
Deindent selected lines.
@@ -368,7 +354,7 @@ Default keybinding: `a-<` (kakoune: normal)
-### [`edit.deindent.withIncomplete`](../edit.ts#L186-L194)
+### [`edit.deindent.withIncomplete`](../edit.ts#L228-L236)
Deindent selected lines (including incomplete indent).
@@ -383,7 +369,7 @@ Default keybinding: `<` (core: normal)
-### [`edit.case.toLower`](../edit.ts#L198-L206)
+### [`edit.case.toLower`](../edit.ts#L240-L248)
Transform to lower case.
@@ -396,7 +382,7 @@ Default keybinding: `` ` `` (core: normal)
-### [`edit.case.toUpper`](../edit.ts#L210-L218)
+### [`edit.case.toUpper`](../edit.ts#L252-L260)
Transform to upper case.
@@ -410,7 +396,7 @@ Default keybinding: `` s-` `` (kakoune: normal)
-### [`edit.case.swap`](../edit.ts#L222-L230)
+### [`edit.case.swap`](../edit.ts#L264-L272)
Swap case.
@@ -424,7 +410,7 @@ Default keybinding: `` a-` `` (kakoune: normal)
-### [`edit.replaceCharacters`](../edit.ts#L245-L257)
+### [`edit.replaceCharacters`](../edit.ts#L287-L299)
Replace characters.
@@ -440,7 +426,7 @@ Default keybinding: `r` (core: normal)
-### [`edit.align`](../edit.ts#L300-L308)
+### [`edit.align`](../edit.ts#L342-L350)
Align selections.
@@ -455,7 +441,7 @@ Default keybinding: `&` (core: normal)
-### [`edit.copyIndentation`](../edit.ts#L358-L371)
+### [`edit.copyIndentation`](../edit.ts#L400-L413)
Copy indentation.
@@ -470,7 +456,7 @@ Default keybinding: `a-&` (kakoune: normal)
-### [`edit.newLine.above`](../edit.ts#L400-L418)
+### [`edit.newLine.above`](../edit.ts#L442-L460)
Insert new line above each selection.
@@ -492,7 +478,7 @@ Default keybinding: `s-a-o` (kakoune: normal)
-### [`edit.newLine.below`](../edit.ts#L438-L456)
+### [`edit.newLine.below`](../edit.ts#L480-L498)
Insert new line below each selection.
diff --git a/src/commands/layouts/qwerty.md b/src/commands/layouts/qwerty.md
index f79f574..fca1b30 100644
--- a/src/commands/layouts/qwerty.md
+++ b/src/commands/layouts/qwerty.md
@@ -11,29 +11,25 @@
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.paste.after | Paste after | |
-edit.paste.after.select | Paste after and select | P (editorTextFocus && dance.mode == 'normal') |
-edit.paste.before | Paste before | |
-edit.paste.before.select | Paste before and select | Shift+P (editorTextFocus && dance.mode == 'normal') |
-edit.pasteAll.after | Paste all after | |
-edit.pasteAll.after.select | Paste all after and select | Alt+P (editorTextFocus && dance.mode == 'normal') |
-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.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 | |
+edit.paste.before.select | Paste before and select | Shift+P (editorTextFocus && dance.mode == 'normal') |
+edit.pasteAll.after | Paste all after | |
+edit.pasteAll.after.select | Paste all after and select | Alt+P (editorTextFocus && dance.mode == 'normal') |
+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-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 +246,7 @@ See https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#changes
-### [`edit.insert`](../edit.ts#L15-L66)
+### [`edit.insert`](../edit.ts#L16-L58)
Insert contents of register.
@@ -267,27 +263,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,7 +283,6 @@ 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)
@@ -304,7 +290,7 @@ Default keybinding: `s-a-r` (kakoune: normal)
-### [`edit.join`](../edit.ts#L138-L143)
+### [`edit.join`](../edit.ts#L180-L185)
Join lines.
@@ -317,7 +303,7 @@ Default keybinding: `a-j` (kakoune: normal)
-### [`edit.join.select`](../edit.ts#L147-L152)
+### [`edit.join.select`](../edit.ts#L189-L194)
Join lines and select inserted separators.
@@ -329,7 +315,7 @@ Default keybinding: `s-a-j` (core: normal; helix: select)
-### [`edit.indent`](../edit.ts#L156-L164)
+### [`edit.indent`](../edit.ts#L198-L206)
Indent selected lines.
@@ -344,7 +330,7 @@ Default keybinding: `>` (core: normal)
-### [`edit.indent.withEmpty`](../edit.ts#L168-L173)
+### [`edit.indent.withEmpty`](../edit.ts#L210-L215)
Indent selected lines (including empty lines).
@@ -356,7 +342,7 @@ Default keybinding: `a->` (kakoune: normal)
-### [`edit.deindent`](../edit.ts#L177-L182)
+### [`edit.deindent`](../edit.ts#L219-L224)
Deindent selected lines.
@@ -368,7 +354,7 @@ Default keybinding: `a-<` (kakoune: normal)
-### [`edit.deindent.withIncomplete`](../edit.ts#L186-L194)
+### [`edit.deindent.withIncomplete`](../edit.ts#L228-L236)
Deindent selected lines (including incomplete indent).
@@ -383,7 +369,7 @@ Default keybinding: `<` (core: normal)
-### [`edit.case.toLower`](../edit.ts#L198-L206)
+### [`edit.case.toLower`](../edit.ts#L240-L248)
Transform to lower case.
@@ -396,7 +382,7 @@ Default keybinding: `` ` `` (core: normal)
-### [`edit.case.toUpper`](../edit.ts#L210-L218)
+### [`edit.case.toUpper`](../edit.ts#L252-L260)
Transform to upper case.
@@ -410,7 +396,7 @@ Default keybinding: `` s-` `` (kakoune: normal)
-### [`edit.case.swap`](../edit.ts#L222-L230)
+### [`edit.case.swap`](../edit.ts#L264-L272)
Swap case.
@@ -424,7 +410,7 @@ Default keybinding: `` a-` `` (kakoune: normal)
-### [`edit.replaceCharacters`](../edit.ts#L245-L257)
+### [`edit.replaceCharacters`](../edit.ts#L287-L299)
Replace characters.
@@ -440,7 +426,7 @@ Default keybinding: `r` (core: normal)
-### [`edit.align`](../edit.ts#L300-L308)
+### [`edit.align`](../edit.ts#L342-L350)
Align selections.
@@ -455,7 +441,7 @@ Default keybinding: `&` (core: normal)
-### [`edit.copyIndentation`](../edit.ts#L358-L371)
+### [`edit.copyIndentation`](../edit.ts#L400-L413)
Copy indentation.
@@ -470,7 +456,7 @@ Default keybinding: `a-&` (kakoune: normal)
-### [`edit.newLine.above`](../edit.ts#L400-L418)
+### [`edit.newLine.above`](../edit.ts#L442-L460)
Insert new line above each selection.
@@ -492,7 +478,7 @@ Default keybinding: `s-a-o` (kakoune: normal)
-### [`edit.newLine.below`](../edit.ts#L438-L456)
+### [`edit.newLine.below`](../edit.ts#L480-L498)
Insert new line below each selection.
diff --git a/src/commands/load-all.ts b/src/commands/load-all.ts
index 11eec32..1555b29 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",
+ (_, argument) => _.runAsync(async (_) => await edit_deleteSelections(_, _.selections, argument["preserveEntireLines"])),
+ 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(
@@ -776,35 +782,47 @@ export const commands: Commands = function () {
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
[[".edit.insert", { handleNewLine: true, where: "end" , all: true, shift: "select", $exclude: [] }]],
);
+ describeAdditionalCommand(
+ commands,
+ "dance.edit.yank-replace",
+ CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
+ [[".selections.saveText", { register: "tmp" }], [".edit.insert"], [".updateRegister", { copyFrom: "tmp", $exclude: [] }]],
+ );
describeAdditionalCommand(
commands,
"dance.edit.delete",
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
- [[".edit.insert", { register: "_", $exclude: [] }]],
+ [[".edit.deleteSelections", { register: "_", $exclude: [] }]],
);
describeAdditionalCommand(
commands,
"dance.edit.delete-insert",
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
- [[".modes.set", { mode: "insert", $include: ["mode"] }], [".edit.insert", { register: "_", $exclude: ["mode"] }]],
+ [[".modes.set", { mode: "insert", $include: ["mode"] }], [".edit.deleteSelections"]],
+ );
+ describeAdditionalCommand(
+ commands,
+ "dance.edit.delete-insert-preserving-lines",
+ CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
+ [[".modes.set", { mode: "insert", $include: ["mode"] }], [".edit.deleteSelections", { preserveEntireLines: true, $exclude: ["mode"] }]],
);
describeAdditionalCommand(
commands,
"dance.edit.yank-delete",
CommandDescriptor.Flags.RequiresActiveEditor | CommandDescriptor.Flags.DoNotReplay,
- [[".selections.saveText", { $include: ["register"] }], [".edit.insert", { register: "_", $exclude: ["register"] }]],
+ [[".selections.saveText", { $include: ["register"] }], [".edit.deleteSelections"]],
);
describeAdditionalCommand(
commands,
"dance.edit.yank-delete-insert",
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"] }], [".modes.set", { mode: "insert", $include: ["mode"] }], [".edit.deleteSelections"]],
);
describeAdditionalCommand(
commands,
- "dance.edit.yank-replace",
+ "dance.edit.yank-delete-insert-preserving-lines",
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", { preserveEntireLines: true, $exclude: ["register","mode"] }]],
);
describeAdditionalCommand(
commands,
diff --git a/test/suite/commands/edit-insert.md b/test/suite/commands/edit-insert.md
index 1dcbfe3..943bfd2 100644
--- a/test/suite/commands/edit-insert.md
+++ b/test/suite/commands/edit-insert.md
@@ -36,3 +36,35 @@ fooar
foor
^ 0
```
+
+# 2
+
+```
+foo
+ ^ 0
+bar
+```
+
+## 2 delete-line
+[up](#2)
+
+- .select.line.below.extend
+- .edit.delete
+
+```
+bar
+| 0
+```
+
+## 2 delete-line-preserving-lines
+[up](#2)
+
+- .select.line.below.extend
+- .edit.delete-insert-preserving-lines
+
+```
+
+| 0
+bar
+```
+
diff --git a/test/suite/commands/edit-insert.test.ts b/test/suite/commands/edit-insert.test.ts
index 9e995b7..e760187 100644
--- a/test/suite/commands/edit-insert.test.ts
+++ b/test/suite/commands/edit-insert.test.ts
@@ -75,5 +75,43 @@ suite("./test/suite/commands/edit-insert.md", function () {
`);
});
+ test("2 > delete-line", async function () {
+ // Set-up document to be in expected initial state.
+ await ExpectedDocument.apply(editor, 6, String.raw`
+ foo
+ ^ 0
+ bar
+ `);
+
+ // Perform all operations.
+ await executeCommand("dance.select.line.below.extend");
+ await executeCommand("dance.edit.delete");
+
+ // Ensure document is as expected.
+ ExpectedDocument.assertEquals(editor, "./test/suite/commands/edit-insert.md:48:1", 6, String.raw`
+ bar
+ | 0
+ `);
+ });
+
+ test("2 > delete-line-preserving-lines", async function () {
+ // Set-up document to be in expected initial state.
+ await ExpectedDocument.apply(editor, 6, String.raw`
+ foo
+ ^ 0
+ bar
+ `);
+
+ // Perform all operations.
+ await executeCommand("dance.select.line.below.extend");
+
+ // Ensure document is as expected.
+ ExpectedDocument.assertEquals(editor, "./test/suite/commands/edit-insert.md:59:1", 6, String.raw`
+
+ | 0
+ bar
+ `);
+ });
+
groupTestsByParentName(this);
});