Please don't beat yourself up because it takes time to stop a habit. You may have fallen into this pattern since a young age and it may seem like part of your personality. It isn't, it is something you've adapted.
Taoism and Buddhism speak about attachment and that we aren't who we think we are. Don't say things like I am fat or I am someone who has to smoke. We take on a persona but this isn't who we truly are. We fall into comfortable behaviors that reduce stress we think but it only causes more.
Try to reflect upon what you really get from the habit and if it really is fulfilling. Is it just a distraction or a way to hide pain? While you are engaged in the habit try to look at it. This is hard to do and takes a lot of concentration but is very worthwhile.
Sometimes we stop one thing but replace it with another. For instance people comment that they may quit smoking but then fall into an overeating addiction. This is really not getting at the root of the problem. Use visualization to help yourself see that you aren't depriving yourself but instead you are losing yourself into an unconscious pattern.
By having a positive visualization instead of dwelling on what you are giving up you'll feel much better. Think about your increased self-esteem by stopping smoking. How proud will you be if you have lovely nails rather than nails you have to hide?
By thinking about how you'll look in six months and putting a picture on your wall of the new you on your wall or refrigerator you'll be attracting this healthier you. Use good habits to substitute for bad ones. This will make you proud of yourself and each day deepen your courage and confidence.
Remember that habits weren't formed overnight and they take time to change, but you can do this and your life will be fuller for doing so.