-
Notifications
You must be signed in to change notification settings - Fork 60
Block mode like caret mode
losnappas edited this page Oct 14, 2021
·
1 revision
The block mode is nice, but one might argue that the caret mode is better/less buggy for vscode.
To keep yourself in the caret mode, while retaining features like d
to delete the next character, try these keybindings.
What they do is select single char if no selection, then execute
.
{
"key": "`",
"command": "dance.run",
"when": "editorTextFocus && dance.mode == 'normal'",
"args": {
"input": [
"const editor = vscode.window.activeTextEditor;",
"if (editor === undefined) return;",
"const selection = editor.selection",
"const nothingSelected = selection.start.line === selection.end.line && selection.start.character === selection.end.character;",
"if (nothingSelected)",
"return vscode.commands.executeCommand('dance.select.right.extend').then(() => vscode.commands.executeCommand('dance.edit.case.toLower'))",
"else",
"return vscode.commands.executeCommand('dance.edit.case.toLower')"
]
}
},
{
"key": "c",
"command": "dance.run",
"when": "editorTextFocus && dance.mode == 'normal'",
"args": {
"input": [
"const editor = vscode.window.activeTextEditor;",
"if (editor === undefined) return;",
"const selection = editor.selection",
"const nothingSelected = selection.start.line === selection.end.line && selection.start.character === selection.end.character;",
"if (nothingSelected)",
"return vscode.commands.executeCommand('dance.select.right.extend').then(() => vscode.commands.executeCommand('dance.edit.yank-delete-insert'))",
"else",
"return vscode.commands.executeCommand('dance.edit.yank-delete-insert')"
]
}
},
{
"key": "shift+k",
"command": "dance.run",
"when": "editorTextFocus && dance.mode == 'normal'",
"args": {
"input": [
"const editor = vscode.window.activeTextEditor;",
"if (editor === undefined) return;",
"const selection = editor.selection",
"const nothingSelected = selection.start.line === selection.end.line && selection.start.character === selection.end.character;",
"if (nothingSelected)",
"return vscode.commands.executeCommand('dance.select.right.extend').then(() => vscode.commands.executeCommand('dance.selections.changeDirection')).then(() => vscode.commands.executeCommand('dance.select.up.extend'))",
"else",
"return vscode.commands.executeCommand('dance.select.up.extend')"
]
}
},
{
"key": "p",
"command": "dance.run",
"when": "editorTextFocus && dance.mode == 'normal'",
"args": {
"input": [
"const editor = vscode.window.activeTextEditor;",
"if (editor === undefined) return;",
"const selection = editor.selection",
"const nothingSelected = selection.start.line === selection.end.line && selection.start.character === selection.end.character;",
"if (nothingSelected)",
"return vscode.commands.executeCommand('dance.select.right.extend').then(() => vscode.commands.executeCommand('dance.edit.paste.after'))",
"else",
"return vscode.commands.executeCommand('dance.edit.paste.after')"
]
}
},
{
"key": "y",
"command": "dance.run",
"when": "editorTextFocus && dance.mode == 'normal'",
"args": {
"input": [
"const editor = vscode.window.activeTextEditor;",
"if (editor === undefined) return;",
"const selection = editor.selection",
"const nothingSelected = selection.start.line === selection.end.line && selection.start.character === selection.end.character;",
"if (nothingSelected)",
"return vscode.commands.executeCommand('dance.select.right.extend').then(() => vscode.commands.executeCommand('dance.selections.saveText'))",
"else",
"return vscode.commands.executeCommand('dance.selections.saveText')"
]
}
},
{
"key": "d",
"command": "dance.run",
"when": "editorTextFocus && dance.mode == 'normal'",
"args": {
"input": [
"const editor = vscode.window.activeTextEditor;",
"if (editor === undefined) return;",
"const selection = editor.selection",
"const nothingSelected = selection.start.line === selection.end.line && selection.start.character === selection.end.character;",
"if (nothingSelected)",
"return vscode.commands.executeCommand('dance.select.right.extend').then(() => vscode.commands.executeCommand('dance.edit.yank-delete'))",
"else",
"return vscode.commands.executeCommand('dance.edit.yank-delete')"
]
}
},
{
"key": "shift+`",
"command": "dance.run",
"when": "editorTextFocus && dance.mode == 'normal'",
"args": {
"input": [
"const editor = vscode.window.activeTextEditor;",
"if (editor === undefined) return;",
"const selection = editor.selection",
"const nothingSelected = selection.start.line === selection.end.line && selection.start.character === selection.end.character;",
"if (nothingSelected)",
"return vscode.commands.executeCommand('dance.select.right.extend').then(() => vscode.commands.executeCommand('dance.edit.case.toUpper'))",
"else",
"return vscode.commands.executeCommand('dance.edit.case.toUpper')"
]
}
},