It took me a while to figure out why I would occasionally not be able to undo a recent change using ctrl + z. I have realized that every time I save a file using Ctrl + S (which I often do without thinking) the Undo buffer is eliminated.