If your gear cables and brake hoses are entangling one another, rattling or looking a mess, the first thing to do is to work out the ideal cable routing for your bicycle. Make sure the cables/hoses take the most sensible route to the handlebar and don’t cross over one another. Try not to unnecessarily cross over cables it adds to the mess and confusion.
Make sure to trim any unnecessarily long cables/hoses down to size. If you choose to do this, check if it is still long enough to allow your bar to turn through 180 degrees without it pulling taut. You’ll need to re-bleed your brake or retune your gears afterwards. Be careful not to cut them too short.