Use scroll margins to give context to your cursor

I add the following line to my emacs config file so the when I move the cursor near to the top or bottom of the window, the window will scroll when I am 3 lines away from edge. The effect is that (however it is moved) the cursor is always given 3 lines of context before the top or bottom of the window, which I find very useful.

(setq scroll-margin 3)