Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emacs cheet guide #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion bash.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,3 @@ $ mv app/src/foo{,bar}.c
<p align="right">
<a href="README.md">Home</a>
</p>

96 changes: 96 additions & 0 deletions emacs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Emacs

GNU Emacs is an extensible, customizable text editor—and more.

Open from Application menu as all the other programs or from the teminal.

In terminal
```bash
$ emacs
```

will open a new window

```bash
$ emacs -nw
```
will open emacs on the terminal

Emacs contains a menu bar, the frame (the editor), a status bar and a command prompt at the bottom.

You run a command using a combination of modifiers and keystrokes.
for example Ctrl+x Ctrl+f will ask you to type a filename. Usage of TAB
is available when you start type a command or navigate throughout the directories
and files.

## Terminology

* Buffer -
Emacs reads the file into a buffer in memory. While you're editing the buffer and working with the data nothing is changed on disk
* Windows -
A window in Emacs is an area of the screen in which a buffer is displayed
* Frame -
a frame is a separate X window in which an Emacs buffer is displayed

## Commands Modifiers

* ```Ctrl as C```

This usually is the abbreviation of a function
ex. C-x C-s

* ```Alt/Esc as M```

This calls the function
ex. M-x save-buffer

# Files

* ```C-x C-f``` Open a file or create a new one if not exist.
You can tab to display the directory 's contexts
* ```C-x C-s``` Save file
* ```C-x C-w``` Save as
* ```C-x b``` Iterate through buffers(open files)
* ```C-x C-b``` List all open buffers
* ```C-x k``` Kill the current buffer
* ```M->``` Move cursor to the end of buffer(file)

Usage: Alt + Shift + ">"
* ```M-<``` Move cursor at the beginning of buffer(file)

Usage: Alt + Shift + "<"

if you want to select the whole text in the file:
```
$ M-< #to go at the beginning
$ C-space
$ M-> #to go at the end
```
to cancel an action
```
esc esc esc
```

# windows

* ```C-x 1``` One window. if you have open more this return into a single one
* ```C-x 2``` Split window which the cursor is on vertically with the same buffer
* ```C-x 3``` Split window which the cursor is on horizontally with the same buffer

Each window is splitting each time as many times as you want. To bring it back in a single
window run C-x 1.

# Edit

* ```M-w``` copy
* ```C-w``` cut
* ```C-y``` paste
* ```C-s``` search
* ```C-d``` delete(forward)
* ```DEL``` delete(backward)
* ```C-/``` undo

# Miscellaneous

* ```C-g``` Cancel command. Similar if you type ESC button three times.
* ```C-h k``` Documentation. There are many help file actually. This is a general one.