--- title: "Emacs" date: 2023-10-11T14:10:48+07:00 draft: true --- - `C-v` view previous page - `M-v` view next page - `C-l` Clear screen and redisplay all the text - `C-p` Prev line - `C-n` Next line - `C-b` Backward a character - `C-f` Forward a character - `M-b` Backward a word - `M-f` Forward a word - `C-a` Beginning of line - `C-e` End of line - `M-a` Beginning of sentence - `M-e` End of sentence - `M-<` Beginning of the whole text - `M->` End of the whole text - `C-u 8 C-n` Move to next 8th lines > `C-u 8 C-v` Move scrollbar by 8 lines > `C-u 8 *` Input ******** - `C-g` Stop a command / Cancel a numeric argument > `C-u 100 C-g C-f` Move forward only 1 word ## Windows - `C-x 1` One window (kill all other windows) ## Editing - `(backspace)` Delete the character before the cursor - `C-d` Delete the next character after the cursor - `M-` Kill the word immediately before the cursor - `M-d` Kill the next word after the cursor - `C-k` Kill from the cursor position to the end of line - `M-k` Kill to the end of the current sentence - `C-` Mark set - `C-w` Kill text starting from `C-` - `C-y` yank the last killed text back - `M-y` repaces "last killed text" with the previous kill - `C-/` undo > `C-_` the same. > `C-x u` the same ## Files - `C-x C-f` Find a file > Cancel the command with `C-g` - `C-x C-s` Save the file ## Buffers - `C-x C-f` Switch between opened files - `C-x C-b` List buffers - `C-x b` Switch between buffers - `C-x s` Save some buffers ## Extending The Command Set - `C-x` Character eXtend - `M-x` Named command eXtend - `C-x C-c` End the emacs session - `C-z` Suspends emacs > `fg` `%emacs` to resume - `C-x u` undo - `C-x f 20` set margin - `M-x` Execute a command > `M-x replace-string` replace string > `M-x recover-this-file` recover current file > `M-x fundamental-mode` > `M-x text-mode` switch major mode - `M-q` re-fill the paragraph ## Searching - `C-s` forward search - `C-r` reverse search - `C-g` quit searching ## Windows - `C-x 2` split the screen into 2 windows - `C-M-v` scroll the other window - `C-x o` move cursor to the other window ## Frames - `C-x 5 2` New frame - `C-x 5 0` Close frame ## Help - `C-h ?` All help > `F1` or `M-x help` instead - `C-h m` Current major mode document