With my 2000 F250 7.3 diesel, I used to plug it in right when I got up in the morning. By the time I finished breakfast, coffee, reading the internet it was about 2 hours and the truck started up fine. I would plug it in from about mid December to the end of February. It wasn't necessarily needed on warmer days during the winter, but it did make a difference on starting.
I would put a work glove on the shifter when it was plugged in. Another thing to do is drape the extension cord over the driver's side mirror. Whatever is needed to remind you to uplug before driving away!
As I posted earlier, I have heard that the newest diesels don't need to be plugged in nearly as much as the older ones, if at all.
If you are in below 0F temperatures, even regular gas engines are helped by engine heaters!