One giant automations file is hard to scroll. Home Assistant can read a whole folder of smaller files and merge them into the list it expects.
The docs give this line for it:
automation: !include_dir_merge_list automation/
Every file in that folder holds a list, with each item starting with a hyphen. A file can have one entry or several, so you can group by room or by purpose:
# automation/hallway.yaml
- alias: Hallway light on
# trigger and action go here, as in any automation
- alias: Hallway light off
# same again
If each file holds exactly one entry, !include_dir_list does the job too, and it orders the files alphanumerically by name. The docs say each file must contain only one entry in that case.
Caveats from the docs: the directory options only read files with the .yaml extension, so a file ending in .yml is ignored without a word. They also work recursively, so subfolders are included. Do not repeat the parent key inside the files. The file starts with the list itself.
Check the configuration after adding files, because a missing hyphen is the usual mistake.
Further reading: Splitting up the configuration (Home Assistant documentation)
Going deeper: Guide: advanced tmux, a config that grows with you, formats, layouts and more