EMACS Command Tutorials for Beginners

Basic EMACS Command | EMACS Tutorials for Beginners (Latest Updates)

This video is all about the Basic EMACS Command | EMACS Tutorials for Beginners (Latest Updates).

Basic EMACS Commands

Emacs, a powerful and versatile text editor, has been a favorite among programmers, writers, and enthusiasts for its extensive features and customizability. While Emacs offers a wide range of capabilities, its command-driven interface may seem intimidating to newcomers. Fear not! In this article, we will provide you with essential command tutorials to help you navigate and harness the power of Emacs like a pro. Whether you're a beginner or looking to enhance your Emacs skills, this guide will set you on the path to mastering this exceptional editor.

  1. Basic Navigation Commands:

Getting comfortable with Emacs requires familiarity with basic navigation commands. Here are some essential commands to help you get started:

  • Moving the Cursor:

    • Use the arrow keys to move the cursor up, down, left, or right.
    • Press Ctrl+F to move forward one character.
    • Press Ctrl+B to move backward one character.
    • Press Ctrl+N to move to the next line.
    • Press Ctrl+P to move to the previous line.
  • Scrolling:

    • Use Ctrl+V to scroll forward by one screen.
    • Use Alt+V to scroll backward by one screen.
  1. File Operations:

Working with files is a fundamental part of any text editor. Emacs offers various commands to open, save, and close files:

  • Opening a File:

    • Press Ctrl+X, Ctrl+F to open a file. Emacs will prompt you to enter the file path.
  • Saving a File:

    • Press Ctrl+X, Ctrl+S to save the current file.
    • Press Ctrl+X, Ctrl+W to save the file with a different name.
  • Closing a File:

    • Press Ctrl+X, Ctrl+C to close the current file and exit Emacs.
  1. Basic Editing Commands:

Emacs provides a comprehensive set of editing commands to manipulate text efficiently:

  • Inserting and Deleting Text:

    • Press Ctrl+D to delete the character under the cursor.
    • Press Ctrl+K to delete from the cursor position to the end of the line.
    • Press Ctrl+Y to yank (paste) the most recently deleted text.
    • Press Ctrl+Space to set a mark and move the cursor to make a selection. Use Ctrl+W to cut the selected text and Ctrl+Y to yank it back.
  • Undo and Redo:

    • Press Ctrl+/ or Ctrl+_ to undo the last action.
    • Press Alt+/ or Alt+_ to redo the previously undone action.
  1. Search and Replace:

Emacs offers powerful search and replace commands to quickly find and modify text:

  • Searching:

    • Press Ctrl+S to search forward for a specific phrase. Press Ctrl+S again to move to the next occurrence.
    • Press Ctrl+R to search backward. Press Ctrl+R again to move to the previous occurrence.
  • Replacing:

    • Press Alt+% to initiate a query-replace. Emacs will prompt you to enter the text to replace and its replacement. Press “y” to replace the current occurrence, “n” to skip, or “!” to replace all occurrences.
  1. Help and Documentation:

Emacs provides extensive documentation to help you explore its features:

  • Accessing the Help System:

    • Press Ctrl+H followed by a specific key to access various help options:
      • Press Ctrl+H, Ctrl+T for a tutorial.
      • Press Ctrl+H, Ctrl+I for an info manual.
      • Press Ctrl+H, Ctrl+V for the Emacs version information.

EMACS Commands Quick Access

Opening and Closing

Open / Create file : C-x C-f
Save active file : C-x C-s
Save all : C-x s
Save as : C-x C-w
Exit/quit : C-x C-c
Lost? : C-g

Editing
Delete : Backspace, delete, C-d
Undo : C-x u
Mark Region : C-SPACE
Cut : C-w
Paste : C-y
Cut next word : M-d, ESC d
Cut previous word : M-backspace
Cut this line : C-k
Forward search : C-s
Backward search : C-r

Moving About
Up,down,left,right : use the arrow keys
Beginning-of-line : C-a, HOME
End-of-line : C-e, END
Forward one char : C-f
Back one character : C-b
Next line : C-n
Previous line : C-p
Forward by screen : C-v
Backward by screen : ESC v
Forward one word : ESC f
Backward one word : ESC b

Display / Window
Split screen horizontal: C-x 2
Split screen vertical : C-x 3
Close this window : C-x 0
Return to screen : C-x 1
Command prompt : M-x shell

Help
View the tutorial : C-h t
Information : C-h i
List of commands : C-h b
What mode am I in : C-h m
HELP : C-h C-h

EMACS Legend

Key:
C- : hold control down for the next keystroke

M- : hold alt down for the next keystroke OR
strike escape once then the key

When you are executing a command, watch the bottom of your emacs window.
That last line of text below the highlighted-line is very informative.
It's called the ‘minibuffer', so keep that in mind.

#emacs #emacscommand #emacstutorials

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button