I used this technique recently to form a new habit of meditation. This is the process I followed:
1 ) Determine the existing long term activity (activity that I have been doing daily for months/years) that either fullfills my curiosity or makes me happy/relaxed. E.g. Checking messages right after waking up, Eating food, Watching movie/tv show, talking to friends etc.
2 ) For 21 days, do the activity related to new habit before an activity from step 1. E.g. In my case, I started doing meditation before eating breakfast. This needs to be done in 5 sets, so that is 21 x 5 = 100. Remember, we are not doing it for 100 days continously. After every 21 days we can take a break for a day or two.
3 ) Tell yourself everyday that you are actually enjoying and liking this new habit because <OUTCOME_YOU_ARE_EXPECTING_FROM_IT> and you are going to do it before moving to step 1 activity. E.g. I tell myself “Meditation is fantastic because it is helping me remain calm. Therefore I am going to do it today before having breakfast. My 🍲️ breakfast is awaiting ❤️ “