Even though you might think that you'll never have a reason to use anything other than a GUI text editor such as Alpha or BBEdit, there are a few arguments to be made for text-only mode editing in a terminal. Among them are that the text-only editors can be used even when the system can't display a GUI interface, and that an editor in a terminal can start much faster than most GUI editors. There's also the advantage that if you have occasion to work on Unix machines other than Mac OS X boxes, the command-line editors are what you will have available.
Finally, at this point, the GUI clients available currently seem to have a bit of a problem figuring out whether they should convert a file that they load into Mac-style text (for newlines) or Unix-style text. The Unix command-line editors are a bit more predictable in preferring Unix-format text. Because of this, if you're working with files in the traditional-Unix side of the system, you're probably safer sticking to the command-line editors.
When it comes to editing text on the Unix side, you'll find that many Unix programs use text files as input, create text files as output, or are configured using commands and variables set up in text files. To change the contents of these files, you'll need to use a text editor.
As a matter of fact, most Unix software doesn't know the difference between a text file and any other file. Unlike in Mac OS, from the point of view of Mac OS X's underlying Unix system, files are files are files. If the user chooses to view some of them as containing text and some as containing programs, that's the user's business. An interesting consequence of this lack of concern about a file's contents is that the operating system is just as happy to allow you to use a text editor to edit the contents of your spreadsheet program itself as it is to enable you to attempt to run your email mailbox. Of course, if you actually have execute permission turned on for your email and try to run it, it's almost certainly going to result in nothing more interesting than a bus error and an immediate exit of the command but the operating system will try to do as you command.
If you spend much time discussing Unix editors with longtime Unix users, you'll find that there is a disagreement of warlike proportions between the users of the two most common editors: vi and emacs. Although these editors are actually rather complementary in their functions and are both useful tools to have in your toolbox, chances are that you will run into many users who insist that one or the other editor is completely useless. If you listen to them, instead of keeping both tools handy, you'll be depriving yourself of the better solution to at least some tasks.
Many Unix editors have immense power. emacs, for example, not only contains its own built-in programming language but can also function as a complete windowing system, a compiler/debugger interface, a news reader, and many other things. Even with a book of this size, however, there isn't space to do more than address the basics of using these editors. After you've mastered the basics, if you're interested in learning more, we encourage you to stop by your local bookstore or library and choose from among the several books available on each of the major Unix editors.
Table 13.10 shows some of the most used keys and tasks. If you're just coming to vi for the first time, don't look too long at this table yet; it will just look confusing! Flip past it to the short example of how to use vi and then turn back here and see whether, following the table, you understand what each key press did and why.
Try typing the following exactly as it appears here, and observe what happens. Where a new line appears in the text, press Return. Remember that <esc> is the Escape key.
brezup:ray testing $ vi mynewfile iThis is my new file This is line one of my new file This is a test This is line four of my new file<esc>kddkA This is line three of my new file<esc>khhhhhhhhhhhhhhhhhxxxitwo<esc>:wq!
although you might not be able to see that because the line flashes off the screen pretty quickly. Now look at what you have:
% cat mynewfile This is my new file This is line two of my new file This is line three of my new file This is line four of my new file
With today's fast machines and nearly unlimited memory, the major complaints against emacs (it's a gargantuan application with a legendary hunger for computer resources hey it's not all bad people write haiku about it too!) aren't a significant impediment to its use.
Table 13.12. The Syntax and Some Useful Options for emacs
emacs | Editor |
emacs [<command-line switches>] [<file1> <file2>...] |
emacs is a powerful editor that can actually do more than edit files. It has an extensive information system, which can be accessed in emacs with the key sequence <Ctrl+h i> (holding down the Control key and h and then i). The information system can be navigated using the arrow keys to move around and pressing the Return key to make a selection. |
emacs has an interactive help facility, <Ctrl+h>. The interactive Info information facility, which is a hierarchically organized, (usually) searchable collection of informative topic-related documents, is one type of help available. A help tutorial is available with <Ctrl+h t>. Help Apropos <Ctrl+h a> helps the user find a command given its functionality. Help Character <Ctrl+h c> describes a given character's effect. |
The following are emacs options of general interest: |
<file> | Edits the specified <file>. |
+<number> | Moves the cursor to the line number specified by <number>. (Do not include a space between + and <number>.) |
-q | Does not load an init file. |
-u <user> | Loads the init file of the specified <user>. |
-t <file> | Uses the specified <file> as the terminal instead of using stdin/stdout. This must be the first argument specified in the command line. |
-nw | Tells emacs not to use its special X interface. When running under X11, some versions of emacs default to building an interface with a menu, which interacts (some say poorly) with the X11 cursor, allowing it to act a bit more like the traditional point-and-click editors with which you're familiar. This is sometimes convenient, but also can be incredibly annoying at times. If the -nw option is given when invoking emacs in an xterm(1) window, the emacs display is done in that window and emacs won't build its special interface. This must be the first option specified in the command line. This is useful if you're running an X server but want emacs to display in a terminal rather than the X Windows xterm or just plain don't want the special X11 interface. |
The following are basic emacs key sequences. Remember that two keys pressed simultaneously have a plus sign between them, and a space indicates pressing them sequentially. Most Unix documentation, including the online man pages and info pages, will document Esc-x as M-x for the Meta key: |
Up Arrow | Move cursor up one line. |
Left Arrow | Move cursor to the left one character; to end of previous line if at left side of current line. |
Right Arrow | Move cursor to the right one character; move to the beginning of the next line if at the right side of the current line. |
Down Arrow | Move cursor down one line. Adds a new line to the file if currently on the last line of the file. |
Ctrl+p | Move cursor up one line. |
Ctrl+b | Move cursor to the left one character; to end of previous line if at left side of current line. |
Ctrl+f | Move cursor to the right one character, move to the beginning of the next line if at the right side of the current line. |
Ctrl+n | Move cursor down one line. Adds a new line to the file if currently on the last line of the file. |
Ctrl+v | Move down one page in file. |
Esc-v | Move up one page in file. |
Ctrl+l | Move current line to the center of the page. |
Ctrl+a | Move cursor to the beginning of the current line. |
Ctrl+e | Move cursor to the end of the current line. |
Esc-a | Move cursor to the beginning of the current sentence. |
Esc-e | Move cursor to the end of the current sentence. |
Ctrl+x Ctrl+h | Bring up list of Ctrl+x prefixed commands. (If you do this, you will see that this table is a very abbreviated list!) |
Ctrl+x Ctrl+s | Save the file. |
Ctrl+x Ctrl+w | Prompt for new name to save file. |
Ctrl+x Ctrl+c | Exit emacs. |
Ctrl+x Ctrl+f | Prompt to open file. |
Ctrl+x Ctrl+b | List current file buffers. |
Ctrl+x b | Prompt to switch to another buffer. |
Esc-x | Prompt to open file in literal find-file-literally mode no Mac/Unix linefeed interpretation and so on. This is an important option for Mac users wanting to use emacs to convert Mac files to the Unix line-ending style. |
Ctrl+x Ctrl+d | List directory in emacs buffer (allows opening files by browsing directory rather than by typing name). |
Ctrl+x Ctrl+o | Delete blank lines in file. |
Ctrl+x Ctrl+t | Transpose lines. |
Ctrl+spacebar | Set mark at the current cursor position. |
Ctrl+x Ctrl+l | Downcase region. The region is the area between the cursor, and where the current mark is set. |
Ctrl+x Ctrl+u | Upcase region. The region is the area between the cursor, and where the current mark is set. |
Ctrl+w | Delete from mark to cursor. Deleted text goes to kill-ring buffer. |
Ctrl+s | Enter incremental search mode. Any characters typed after Ctrl+s are searched for. Pressing Ctrl+s again searches for the next instance of the current search term. Use Ctrl+g, a navigation key such as the forward/backward arrows, or Ctrl+f/Ctrl+b to get out of this mode. |
Ctrl+r | Enter incremental search mode, searching backward in the file. |
Esc-w | Copy from mark to cursor into kill-ring buffer. |
Ctrl+k | Delete from cursor to end of line. Place deleted text in kill-ring buffer. |
Ctrl+y | Yank top data from kill-ring buffer into the text at the current cursor position. |
Ctrl+x 2 | Split current window vertically into two editing windows (two full-width windows, half the previous height). |
Ctrl+x 3 | Split current window horizontally into two editing windows (two full-height windows, half the previous width). |
Ctrl+x o | Switch to next editing window in split-window mode. |
Ctrl+x 1 | Switch to single-window mode, keeping the current window open. |
Ctrl+x 0 | Remove current editing window, keeping others. |
Ctrl+x ( | Start recording keyboard macro. |
Ctrl+x ) | Stop recording keyboard macro. |
Ctrl+x e | Execute recorded keyboard macro. |
Ctrl+u <####> | Create a numeric argument for the next command. |
Ctrl+u <####> <keyseq> | Execute <keyseq> #### times. |
Ctrl+x f | Set fill column for word wrap. Requires a numeric argument set with Ctrl+u <####>. |
Esc-x fill-region | Word wrap region between cursor and mark. |
Ctrl+h Ctrl+h | Bring up menu of help subjects. |
Ctrl+h t | Bring up emacs tutorial. |
Ctrl+h i | Bring up emacs info-mode manual browser. Browsing through the emacs info through this interface is recommended. |
Esc-x info | Bring up emacs info-mode manual browser. |
Esc-x apropos | Prompt for command or key sequence to document. |
Ctrl+h h | Bring up list of ways to say hello in 34 different languages we told you emacs had everything in it! |
The following is a listing of some of the interesting parts of the information system's main menu for emacs. You're supposed to be able to find these and search the subtopics in them by using Esc-x Index-info and entering a search, but there's currently no index distributed for you to search in. Because of this, if you want more information on these topics (there are actually many more than listed here), you'll need to bring up the Info system with Ctrl+h i, navigate (using the down-arrow) to the Emacs section, and then browse the topics included there. We wish we had the space to discuss and document even a fraction of the power that emacs provides, but lacking space, a back-of-the-dustjacket listing of the features we think are most interesting will have to suffice. Think of this listing as a jumping-off place for finding your way to emacs information and a whirlwind tour of some of the options you might never have known were available in a text editor: |
Basic Interest | |
Distrib | How to get the latest emacs distribution. |
Copying | The GNU General Public License gives you permission to redistribute GNU emacs on certain terms; it also explains that there is no warranty. |
Intro | An introduction to emacs concepts. |
Glossary | The glossary. |
Mac OS | Using emacs in the Mac. |
Manifesto | What's GNU? Gnu's Not Unix! |
Indexes (Nodes Containing Large Menus) |
Key Index | An item for each standard emacs key sequence. |
Command Index | An item for each command name. |
Variable Index | An item for each documented variable. |
Concept Index | An item for each concept. |
Option Index | An item for every command-line option. |
Important General Concepts | |
Screen | How to interpret what you see on the screen. |
User Input | Kinds of input events (characters, buttons, function keys). |
Keys | Key sequences: what you type to request one editing action. |
Commands | Named functions run by key sequences to do editing. |
Entering Emacs | Starting emacs from the shell. |
Exiting | Stopping or killing emacs. |
Command Arguments | Hairy startup options. |
Fundamental Editing Commands and Concepts |
Basic | The most basic editing commands. |
Minibuffer | Entering arguments that are prompted for. |
M-x | Invoking commands by their names. |
Help | Commands for asking emacs about its commands. |
Important Text-Changing Commands and Concepts |
Mark | The mark: how to delimit a region of text. |
Killing | Killing text. |
Yanking | Recovering killed text. Moving text. |
Accumulating Text | Other ways of copying text. |
Rectangles | Operating on the text inside a rectangle on the screen. |
Search | Finding or replacing occurrences of a string. |
Fixit | Commands especially useful for fixing typos. |
Major Structures of emacs | |
Files | All about handling files. |
Buffers | Multiple buffers; editing several files at once. |
Windows | Viewing two pieces of text at once. |
Advanced Features | |
Major Modes | Text mode versus Lisp mode versus C mode. |
Indentation | Editing the whitespace at the beginnings of lines. |
Text | Commands and modes for editing English. |
Programs | Commands and modes for editing programs. |
Building | Compiling, running, and debugging programs. |
Maintaining | Features for maintaining large programs. |
Abbrevs | How to define text abbreviations to reduce the number of characters you must type. |
Picture | Editing pictures made up of characters using the quarter-plane screen model. |
Dired | You can "edit" a directory to manage files in it. |
Calendar/Diary | The calendar and diary facilities. |
Shell | Executing shell commands from emacs. |
Hardcopy | Printing buffers or regions. |
PostScript | Printing buffers or regions as PostScript. |
Sorting | Sorting lines, paragraphs, or pages within emacs. |
Two-Column | Splitting apart columns to edit them in side-by-side windows. |
Editing Binary Files | Using Hexl mode to edit binary files. |
Saving Emacs | Saving emacs state from one |
Sessions | session to the next. |
Emulation | Emulating some other editors with emacs. |
Hyperlinking | Following links in buffers. |
Dissociated Press | Dissociating text for fun. |
Amusements | Various games and hacks. |
Customization | Modifying the behavior of emacs. |
The deeper levels of the documentation include topics covering the following (and many more) useful areas: |
The Organization of the Screen | |
Point | The place in the text where editing commands operate. |
Echo Area | Short messages appear at the bottom of the screen. |
Mode Line | Interpreting the mode line. |
Menu Bar | How to use the menu bar. |
Basic Editing Commands | |
Inserting Text | Inserting text by simply typing it. |
Moving Point | How to move the cursor to the place where you want to change something. |
Erasing | Deleting and killing text. |
Undo | Undoing recent changes in the text. |
Files: Basic Files | Visiting, creating, and saving files. |
Continuation Lines | Lines too wide for the screen. |
Position Info | What page, line, row, or column is point on? |
Arguments | Numeric arguments for repeating a command. |
The Minibuffer | |
Minibuffer File | Entering filenames with the minibuffer. |
Minibuffer Edit | How to edit in the minibuffer. |
Completion | An abbreviation facility for minibuffer input. |
Minibuffer History | Reusing recent minibuffer arguments. |
Repetition | Re-executing commands that used the minibuffer. |
Help | |
Help Summary | Brief list of all Help commands. |
Key Help | Asking what a key does in Emacs. |
Name Help | Asking about a command, variable, or function name. |
Apropos | Asking what pertains to a given topic. |
The Mark and the Region | |
Setting Mark | Commands to set the mark. |
Transient Mark | How to make emacs highlight the region when there is one. |
Using Region | Summary of ways to operate on contents of the region. |
Mark Ring | Previous mark positions saved so you can go back there. |
Global Mark Ring | Previous mark positions in various buffers. |
Deletion and Killing | |
Deletion | Commands for deleting small amounts of text and blank areas. |
Killing by Lines | How to kill entire lines of text at one time. |
Other Kill Commands | Commands to kill large regions of text and syntactic units such as words and sentences. |
Yanking (That Is, Pasting, for Mac Folks) |
Kill Ring | Where killed text is stored. Basic yanking. |
Appending Kills | Several kills in a row all yanked together. |
Earlier Kills | Yanking something killed some time ago. |
Controlling the Display | |
Scrolling | Moving text up and down in a window. |
Horizontal Scrolling | Moving text left and right in a window. |
Follow Mode | Lets two windows scroll as one. |
Selective Display | Hiding lines with a lot of indentation. |
Searching and Replacement | |
Incremental Search | Search happens as you type the string. |
Nonincremental Search | Specify entire string and then search. |
Word Search | Search for sequence of words. |
Regexp Search | Search for match for a regular expression. |
Regexps | Syntax of regular expressions. |
Replace | Search and replace some or all matches. |
Replacement Commands | |
Unconditional Replace | Replacing all matches for a string. |
Regexp Replace | Replacing all matches for a regular expression. |
Replacement and Case | How replacements preserve case of letters. |
Query Replace | How to use querying. |
Commands for Fixing Typos | |
Kill Errors | Commands to kill a batch of recently entered text. |
Transpose | Exchanging two characters, words, lines, lists. |
Fixing Case | Correcting case of last word entered. |
Spelling | Apply spelling checker to a word or a whole buffer. |
Using Multiple Buffers | |
Select Buffer | Creating a new buffer or reselecting an old one. |
List Buffers | Getting a list of buffers that exist. |
Kill Buffer | Killing buffers you no longer need. |
Several Buffers | How to go through the list of all buffers and operate variously on several of them. |
Multiple Windows | |
Basic Window | Introduction to emacs windows. |
Split Window | New windows are made by splitting existing windows. |
Other Window | Moving to another window or doing something to it. |
Pop Up Window | Finding a file or buffer in another window. |
Force Same Window | Forcing certain buffers to appear in the selected window rather than in another window. |
Change Window | Deleting windows and changing their sizes. |
Major Modes | |
Choosing Modes | How major modes are specified or chosen. |
Commands for Human Languages |
Words | Moving over and killing words. |
Sentences | Moving over and killing sentences. |
Paragraphs | Moving over paragraphs. |
Pages | Moving over pages. |
Filling | Filling or justifying text. |
Case | Changing the case of text. |
Text Mode | The major modes for editing text files. |
Outline Mode | Editing outlines. |
TeX Mode | Editing input to the formatter TeX. |
Nroff Mode | Editing input to the formatter nroff. |
Formatted Text | Editing formatted text directly in WYSIWYG fashion. |
Filling (That Is, Automatically Rewrapping) Text |
Auto Fill | Auto Fill mode breaks long lines automatically. |
Fill Commands | Commands to refill paragraphs and center lines. |
Editing Programs | |
Program Modes | Major modes for editing programs. |
Defuns | Commands to operate on major top-level parts of a program. |
Program Indent | Adjusting indentation to show the nesting. |
Comments | Inserting, killing, and aligning comments. |
Parentheses | Commands that operate on parentheses. |
Documentation | Getting documentation of functions you plan to call. |
Hideshow | Displaying blocks selectively. |
Symbol Completion | Completion on symbol names of your program or language. |
Misc for Programs | Other emacs features useful for editing programs. |
C Modes | Special commands of C, C++, Objective-C, Java, and Pike modes. |
Fortran | Fortran mode and its special features. |
Indentation for Programs | |
Basic Indent | Indenting a single line. |
Multi-line Indent | Commands to reindent many lines at once. |
Lisp Indent | Specifying how each Lisp function should be indented. |
C Indent | Extra features for indenting C and related modes. |
Custom C Indent | Controlling indentation style for C and related modes. |
Documentation Lookup | |
Info Lookup | Looking up library functions and commands in Info files. |
Man Page | Looking up man pages of library functions and commands. |
Lisp Doc | Looking up emacs Lisp functions, and so on. |
C and Related Modes | |
Motion in C | Commands to move by C statements, and so on. |
Electric C | Colon and other chars can automatically reindent. |
Hungry Delete | A more powerful DEL command. |
Other C Commands | Filling comments, viewing expansion of macros, and other neat features. |
Comments in C | Options for customizing comment style. |
Fortran Mode | |
Motion: Fortran | Moving point by statements or |
Motion. | subprograms. |
Indent: Fortran | Indentation commands for Fortran. |
Indent. | |
Comments: Fortran | Inserting and aligning comments. |
Comments. | |
Autofill: Fortran Autofill | Auto fill minor mode for Fortran. |
Columns: Fortran Columns. | Measuring columns for valid Fortran. |
Abbrev: Fortran Abbrev. | Built-in abbreviations for Fortran keywords. |
Compiling and Testing Programs | |
Compilation | Compiling programs in languages other than Lisp (C, Pascal, and so on). |
Compilation Mode | The mode for visiting compiler errors. |
Compilation Shell | Customizing your shell properly for use in the compilation buffer. |
Debuggers | Running symbolic debuggers for non-Lisp programs. |
Executing Lisp | Various modes for editing Lisp programs, with different facilities for running |
Lisp Eval | Executing a single Lisp expression in emacs. |
Running Debuggers Under emacs | |
Starting GUD | How to start a debugger subprocess. |
Debugger Operation | Connection between the debugger and source buffers. |
Commands of GUD | Key bindings for common commands. |
GUD Customization | Defining your own commands for GUD. |
Dired, the Directory Editor | |
Dired Enter | How to invoke Dired. |
Dired Navigation | How to move in the Dired buffer. |
Dired Deletion | Deleting files with Dired. |
Flagging Many Files | Flagging files based on their names. |
Marks vs Flags | Flagging for deletion versus marking. |
Operating on Files | How to copy, rename, print, compress, and so on. either one file or several files. |
Shell Commands in Dired | Running a shell command on the marked files. |
Transforming File Names | Using patterns to rename multiple files. |
Comparison in Dired | Running diff by way of Dired. |
Subdirectories in Dired | Adding subdirectories to the Dired buffer. |
Subdirectory Motion | Moving across subdirectories, and up and down. |
Dired and Find | Using find to choose the files for Dired. |
Customization | |
Minor Modes | Each minor mode is one feature you can turn on independently of any others. |
Variables | Many emacs commands examine emacs variables to decide what to do; by setting variables, you can control their functioning. |
Keyboard Macros | A keyboard macro records a sequence of keystrokes to be replayed with a single command. |
Key Bindings | The keymaps say what command each key runs. By changing them, you can redefine keys. |
Keyboard Translations | If your keyboard passes an undesired code for a key, you can tell emacs to substitute another code. |
Syntax | The syntax table controls how words and expressions are parsed. |
Init File | How to write common customizations in the .emacs file. |
Variables | |
Examining | Examining or setting one variable's value. |
Easy Customization | Convenient and easy customization of variables. |
Hooks | Let you specify programs for parts of emacs to run on particular occasions. |
Locals | Per-buffer values of variables. |
File Variables | How files can specify variable values. |
Keyboard Macros | |
Basic Kbd Macro | Defining and running keyboard macros. |
Save Kbd Macro | Giving keyboard macros names; saving them in files. |
Kbd Macro Query | Making keyboard macros do different things each time. |
Customizing Key Bindings | |
Keymaps | Generalities. The global keymap. |
Prefix Keymaps | Keymaps for prefix keys. |
Local Keymaps | Major and minor modes have their own keymaps. |
Minibuffer Maps | The minibuffer uses its own local keymaps. |
Rebinding | How to redefine one key's meaning conveniently. |
Init Rebinding | Rebinding keys with your init file, .emacs. |
Function Keys | Rebinding terminal function keys. |
Named ASCII Chars | Distinguishing <TAB> from Ctrl+i, and so on. |
Mouse Buttons | Rebinding mouse buttons in emacs. |
Disabling | Disabling a command means confirmation is required before it can be executed. This is done to protect beginners from surprises. |
The Init File, ~/.emacs | |
Init Syntax | Syntax of constants in emacs Lisp. |
Init Examples | How to do some things with an init file. |
Terminal Init | Each terminal type can have an init file. |
Find Init | How emacs finds the init file. |
Dealing with emacs TRouble | |
DEL Does Not Delete | What to do if <DEL> doesn't delete. |
Stuck Recursive | [...] in mode line around the parentheses. |
Screen Garbled | Garbage on the screen. |
Text Garbled | Garbage in the text. |
Unasked-for Search | Spontaneous entry to incremental search. |
Memory Full | How to cope when you run out of memory. |
Emergency Escape | Emergency escape what to do if emacs stops responding. |
Total Frustration | When you are at your wit's end. |
Command-Line Options and Arguments |
Action Arguments | Arguments to visit files, load libraries, and call functions. |
Initial Options | Arguments that take effect while starting emacs. |
Command Example | Examples of using command-line arguments. |
Environment | Environment variables that emacs uses. |
Environment Variables | |
General Variables | Environment variables that all versions of emacs use. |
Misc Variables | Certain system-specific variables. |
GNU nano 1.2.4 New Buffer [ New File ] ^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos ^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Txt ^T To Spell
GNU nano 1.2.4 New Buffer Modified Hi there. This is my nano test file. File Name to Write: nano-test ^G Get Help M-D DOS Format M-A Append M-B Backup File ^T To Files M-O Mac Format M-P Prepend ^C Cancel
GNU nano 1.2.4 New Buffer nano help text The nano editor is designed to emulate the functionality and ease-of-use of the UW Pico text editor. There are four main sections of the editor: The top line shows the program version, the current filename being edited, and whether or not the file has been modified. Next is the main editor window showing the file being edited. The status line is the third line from the bottom and shows important messages. The bottom two lines show the most commonly used shortcuts in the editor. The notation for shortcuts is as follows: Control-key sequences are notated with a caret (^) symbol and are entered with the Control (Ctrl) key. Escape-key sequences are notated with the Meta (M) symbol and can be entered using either the Esc, Alt or Meta key depending on your keyboard setup. The following keystrokes are available in the main editor window. Alternative keys are shown in parentheses: ^G (F1) Invoke the help menu ^X (F2) Close currently loaded file/Exit from nano ^Y Prev Page ^X Exit ^V Next Page