Reputation: 61
How could I insert double brackets like this around selected text with a keyboard shortcut(ctrl+alt+d for example):
((Selected Text))
I know that, its possible to surround the selection with brackets by selecting a text and pressing ((
.
How could I do it with a keybinding around a single word on the cursor position without selecting the word?
Upvotes: 1
Views: 4148
Reputation: 61
Pressing
ctrl+d
selects the word under cursor, then you could press double brackets "((" to insert brackets around the word
Upvotes: 1
Reputation: 28673
You can use the extension multi-command
Add the following keybindings
{
"key": "ctrl+alt+d",
"when": "editorTextFocus && !editorHasSelection",
"command": "extension.multiCommand.execute",
"args": {
"sequence": [
"editor.action.addSelectionToNextFindMatch",
{ "command": "type", "args": { "text": "((" } }
]
}
},
{
"key": "ctrl+alt+d",
"when": "editorTextFocus && editorHasSelection",
"command": "extension.multiCommand.execute",
"args": {
"sequence": [
{ "command": "type", "args": { "text": "((" } }
]
}
}
It also works with multi cursors.
Edit Marks comment on using "(("
Upvotes: 1