Make the habit the harder option and the better choice the easy one, then decide ahead of time what you'll do when the urge comes.
The Environment Designer is per habit. Add a habit first.
How this works
Changing the situation is easier than resisting in it: a cue you never see can't set off the urge, and a few seconds of friction is often enough to let it pass.
Plans in "if-then" form help too. Studies of these implementation intentions found people followed through noticeably more often when they decided in advance exactly what they would do and when.