Creating configuration files manually is tedious and like @Berdir mentioned in the comments it is better to export them.
First install your theme, so you can place the blocks for your new theme.
- Create the blocks in the UI.
- Make sure you have installed the module: Configuration Manager (already installed if you use Standard profile)
- Export the configuration using the UI (
/admin/config/development/configuration/full/export) or using Drush:
- Depending on how you exported the configuration:
- If you used UI, you have a .zip that you must extract.
- If you used Drush, the files are exported to
- The blocks file names are
- Copy those block files that you created and put them
config/optional in your theme folder.
- Now open these files and remove the first line, looking something like:
That's it, if you move the theme to a new site and install the theme, the blocks will be installed and placed where you originally put them.