Skip to content

Instantly share code, notes, and snippets.

@soft2help
Last active July 27, 2021 09:36
Show Gist options
  • Select an option

  • Save soft2help/f64bd7ff1078cf29da714eabf00ff756 to your computer and use it in GitHub Desktop.

Select an option

Save soft2help/f64bd7ff1078cf29da714eabf00ff756 to your computer and use it in GitHub Desktop.
Braces (curly braces) in same line in visual code
// in first place you should install domir.regreplace and enable it after in your settings.json inside .vscode folder or in global settings
// Each time that the file is save it will put first brace in same line of declaration
//in here i use it to php file but can be any file that you want. check the extension documentation https://marketplace.visualstudio.com/items?itemName=DomiR.regreplace
{
"regreplace.commands": [
{
"name": "brace on same line",
"match": "\\.php?$",
"regexp": "\\)(\\s*)\\n(\\s*)\\{(\\s*)\\n",
"global": true,
"replace": "){\n"
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment