We have our habits because they have a benefit for us. We don't have to think about them or make decisions. You don't want to go through a complicated routine to tie your shoelaces or to drive your car. Some of our habits are easy to change. If we are forced by road construction to find an alternative and we like it, we may never go back to our old route. Some of our habits are hard to change, like how we respond to criticism or how we treat money because we have had them a long time and are old friends.
So how do you change those long term habits?
If you have tried and tried to make a change and gotten nowhere; (smoking, weight, money...), it is likely that you took an all or nothing approach. With gritted teeth and armed with your willpower you decided it was going to change right now and got nowhere at all. The secret is that you don't try to replace your habit all at once. Remember your habits are there because they benefit you in some way so you need to change them in small doable steps.
For example I lost 118 lbs from a weight of 298 to my current weight of 170 by making a small simple change in my eating pattern. I started eating 5 meals a day instead of big meals twice a day. I still ate what ever I wanted but I found that I started to eat smaller meals because my next one was only a few hours away. Over time as I lost weight slowly I changed what I was eating and so on until 14 months later I reached the weight that was comfortable for me. It was relatively painless and intially I would fall off the wagon but I just continued back on my routine. It got easier the longer I did the routine. I eased into the change rather than fighting it.
If you have a long term habit you want to change then try being nice to yourself instead of fighting yourself.