Ten Tips to Move Around Your Text Files Using Emacs



Emacs WindowIf you are a newbie to the powerful Emacs editor, it is good to learn how to move around the text. One can always use the mouse and arrow keys to move around the text in Emacs. But, you will pretty soon realize this is annoying and painful. Emacs has a number of cool tricks to take you where you want to go in your text and move around. Here are eight basic tips/commands to move around your text easily in Emacs.

Moving around Emacs One Character at a time in Emacs

  • Ctl-f Move forward a character
  • Ctl-b Move backward a character

Moving Around One Word at a time in Emacs

  • M-f Move forward a word
  • M-b Move backward a word

Moving Around One Line at a time in Emacs

  • Ctl-n Move to next line
  • Ctl-p Move to previous line

Moving Around One Sentence at a time in Emacs

  • M-a Move back to beginning of sentence
  • M-e Move forward to end of sentence

Getting to the Beginning and the End of a Line in Emacs

  • Ctl-a Move to beginning of line
  • Ctl-e Move to end of line

One can also easily remember the meanings of Ctl-p, Ctl-n, Ctl-b, and Ctl-f, by understanding the meanings of command; “p” for previous, “n” for next, “b” for backward and “f” for forward. The following schematic will also help remember what the commands mean.

		    
                      Ctl-p: Previous line
			       |
   Ctl-b: Backward  -- Current position  -- Ctl-f Forward
		               |
     		       Ctl-n Next line