

Ctl-h is a command within emacs that opens the help menu where you can search for help for different commands.Eager to take advantage of more advanced Emacs features? Check out some additional tips from CS107 TA Ricardo Iglesias: click here.
Emacs save and quit how to#
If you are looking for more references for how to use emacs, check out the following additional resources: The best way to get familiar with emacs is to just start using it to edit files - type something, anything! Over time, you'll become more comfortable with the standard commands, and pick up more advanced ones. Undo/RedoĬtl-g cancel (if you're stuck in a command or prompt, pressing this, sometimes several times, should get you out) More Resources While text is highlighted, press the TAB key to auto-indent it. If you hit Ctl-k multiple times in a row (with no other commands between), all the lines will be passed when you hit Ctl-y.Ĭtl-d to delete the character under the cursor.īackspace to delete the character before the cursor. To select all text, press Ctl-x h.Ĭtl-SPACE to put a marker down, and move the cursor to select textĬtl-w to cut ("kill") the current selectionĬtl-y to paste ("yank") whatever is in the copy-paste bufferĬtl-k cut ("kill") the text on the current line to the right of the cursor (Note: the highlighting text feature will not highlight the text you have chosen until after you have released the mouse). There are also additional shortcuts below for cut/copy/paste and selecting/deleting text:Ĭlick and drag with the mouse to highlight text. You can type as normal to insert or delete text wherever the cursor is in the document. Meta-% find and replace text ahead of the current cursor position Editing Text Search is another great way to move your cursor.Ĭtl-s searches the file, and prompts you to enter text to search for.Ĭtl-s move the cursor to the next search matchĬtl-r move the cursor to the previous search match Meta- (greater-than sign) jump to the end of the file Searching For example, typing Meta-g g 123 would jump to line 123. Meta-a and Meta-e to move back or forward a sentence, respectively Meta-b or Meta-back arrow move to the previous wordĬtl-a and Ctl-e to move to the line beginning or end, respectively Meta-f or Meta-right arrow move to the next word There are also several additional keyboard shortcuts to navigate within a file: You can also use the arrow keys to navigate the file if you would prefer. Specifically, you can click to position the cursor, and use the mouse to scroll through the file. You can use the mouse to navigate a file as you might expect in other graphical text editors.

If you have unsaved changes, you will be asked whether or not you'd like to save your changes before quitting. Ctl-x Ctl-w lets you save the file under a different name (like "Save As" in graphical editors).Ĭtl-x Ctl-c quits Emacs. to copy-paste between them) by specifying multiple filenames when you open emacs: emacs file1.c file2.cĬtl-x Ctl-s save the current changes to a file. You can open multiple files in emacs side-by-side (e.g. Again, if this file exists in your current directory it will open it, or it will create it if it does not already exist in your current directory. If emacs is already open and you would like to edit a different file, use the Ctl-x Ctl-f command. To open a file in emacs (or create a new one if a file with this name does not exist): emacs filename Otherwise, some of the keyboard shortcuts below will not work! Opening emacs This will ensure that your Meta key is properly set to be Option (Mac) or Alt (Windows).
Emacs save and quit windows#
The two keys it uses for these shortcuts are Control and Meta (which is Alt, or Option on a Mac).īefore continuing: if you're using a Mac, or a Windows computer with SecureCRT, make sure you have followed the instructions to configure your Meta key, as described in the installation guide. OverviewĮmacs works similarly to other editors you might have used it lets you enter and edit text, and has certain keyboard shortcuts to perform common commands. Open a new file in emacs to see what the theme looks like. Finally, move your cursor to Save Theme Settings and hit ENTER to save. Once there, pick a theme by moving your cursor onto a theme and hitting ENTER. This will take you to a page where you can choose your own theme.

If you don't like the theme chosen in our configuration, open any file in emacs, and then type M-x customize-themes ( M means the "Meta" key, which is discussed later on). If you're interested, you can further customize the default color theme.

This guide can get you up and running with emacs! Bonus: Custom Themes Written by Michael Chang, Chris Gregg and Julie Zelenski, with modifications by Wesley Rodriguez and Nick TroccoliĮmacs is a family of text editors, including GNU Emacs, which is the most popular version, and the one on the myth machines.
