split one line into multiple lines by custom separator (default: ',')
warning:
this extension will append '\n'
to separator in the outermost layer,
for example: [1,], [2,], [3,]
will split into [1,],\n [2,],\n [3,]
,
but [[1,], [2,], [3,]]
won't split.
so don't select the outermost brackets
- open command pallette, input
split line
- hot key:
ctrl + cmd + s
in mac orctrl + alt + s
in win, (use default separator, ',') - hot key:
ctrl + cmd + x
in mac orctrl + alt + x
in win, (use default separator, ',' , break line in start and end of selected string (breakStartEnd: true
)) - you could configure keybindings
"extension.splitLine"
to change default separator inargs
- args has follow options:
separator: string
,breakStartEnd: boolean
,breakBeforeSeparator: boolean
example: you can set hotkey in vscode keybindings.json
like this:
{
"key": "ctrl+cmd+x",
"command": "extension.splitLine",
"when": "editorTextFocus && !editorReadonly",
"args": {
"separator": " ",
"breakStartEnd": true,
"breakBeforeSeparator": false
}
}