thanks for all these info! I am able to do this with experience enhancement for braces
$script:braces = ('"', '"'), ("'", "'"), ('(', ')'), ('[', ']'), ('{', '}'), ('<', '>')
Set-PSReadLineKeyHandler -Chord Enter -ScriptBlock {
$line = $pos = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$pos)
$inMiddleOfBraces = foreach ($pair in $script:braces) {
if ($pair[0] -eq $line[$pos - 1] -and $pair[1] -eq $line[$pos]) {
$true
break
}
}
if ($line.Contains([System.Environment]::NewLine) -or $inMiddleOfBraces) {
[Microsoft.PowerShell.PSConsoleReadLine]::AddLine()
if ($inMiddleOfBraces) {
[Microsoft.PowerShell.PSConsoleReadLine]::InsertLineAbove()
}
} else {
[Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine()
}
}
Set-PSReadLineKeyHandler -Chord 'Ctrl+Enter' -Function AcceptLine