---
title: "#이블: #치트시트"
url: "https://notes.junghanacs.com/notes/20240927T144314"
author: "Junghan Kim"
date: "2024-09-27T14:43:00+09:00"
lastmod: "2024-12-04T11:42:00+09:00"
tags: ["cheatsheet","evil"]
description: "Evil 모드의 기본 이동과 단어 단위 조작을 빠르게 보기 위한 치트시트 노트이다."
---

> [!abstract] 이 노트에 대하여
> 
> Evil 모드에서 자주 쓰는 이동과 단어 단위 편집 키를 빠르게 떠올릴 수 있게 정리한 치트시트다. 설명보다 손가락 감각을 복원하는 데 초점이 맞춰진 노트다.

([“My Evil Cheat Sheet” n.d.](https://notes.junghanacs.com/notes/20240927T144314#citeproc_bib_item_1)) 여기 내용이다.

> Evil-mode is an Emacs layer that allows editing using Vim. Therefore this is a also a cheat sheet for Vim itself.

## Cheat Sheet for Evil mode

### Navigating[[<https://en.dlyang.me/my-evil-cheat-sheet/#navigating>][]]

-   `h`
-   `j`
-   `k`
-   `l`
-   `w`: move forward by one word
-   `b`: move backward by one word, the opposite of `w`.
-   `e`: move forward to the end of a word
-   `gg`
-   `G`
-   `:<NUM>`: Go to line number
-   `0`: = `Home`
-   `$`: = `End`
-   `C-u`: move up half screen
-   `C-d`: move down half screen
-   `C-f`: move down a whole page
-   `C-b`: move up a whole page

### Enter Insert State

-   `i`
-   `a`
-   `I`
-   `A`
-   `$a`
-   `s`: delete a char and insert.
-   `S`: (substitute) delete the whole line and start from the begining, = `0C`.

### Editing

-   `y`: yank/copy
-   `yy`: yank the current line
-   `p`: paste
-   `P`: paste before cursor
-   `d`: delete/cut
-   `D`: delete to the end of the line
-   `dt.`: delete to the period. Similar as `df.`, which will delete `.` as well.
-   `u`: undo
-   `C-R`: redo
-   `x`: delete char at current position.
-   `X`: delete char before current position.

### Replace[[<https://en.dlyang.me/my-evil-cheat-sheet/#replace>][]]

-   `r`
-   `R`
-   `:s/old_word/new_word/gc`: `g` means "global", parameter `c` means "confirmation"
-   `cw`: change word

### Search[[<https://en.dlyang.me/my-evil-cheat-sheet/#search>][]]

-   `/`: search forward.
-   `?`: search backward.
-   `*` or `#`: find the previous/next occurance of current word in Evil-mode.
-   `f<char>`: find the next `<char>`. `f3c` can find the 3rd occurence of `c`.
-   `F<char>`: the opposite of the above.
-   `t<`: find forward and land right before the char.

### Miscellaneous Command[[<https://en.dlyang.me/my-evil-cheat-sheet/#miscellaneous-command>][]]

-   `:!<command>`
-   `.`: repeat the previous command. Be careful of what is the "previous command".

### Formatting[[<https://en.dlyang.me/my-evil-cheat-sheet/#formatting>][]]

-   `~`: toggle upper and lower case of the current char.
-   `gq ap`: format the whole paragraph.

### Visual Mode[[<https://en.dlyang.me/my-evil-cheat-sheet/#visual-mode>][]]

-   `v`: select char
-   `V`: select line
-   `C-v`: select paragraph

### Advanced[[<https://en.dlyang.me/my-evil-cheat-sheet/#advanced>][]]

-   `daw`: delete around word.
-   `diw`: delete inside word.
-   `dis`
-   `das`
-   `cis`: delete and insert at current sentence
-   `dip`: paragraph
-   `dap`
-   `di'` / `da'`: single quote
-   `di"` / `da"`: double quote
-   ``[ai]["`([{"]``: all kinds of scope
-   `dit` / `dat`: inside / around tag
-   replace `d` above by `v`: visualize the designated scope.
-   `vipyjjp`: copy this paragraph and paste it below. (just some combination)
-   `qa`, insert a `:` at the beginning of the line, go to next line, `q`: finish recording a macro, next, `100@a`, now, next 100 lines has a `:` in front of them.
-   Some possible macros:
    -   Search within the line for "widget";
    -   Go to the end of line and add a `.`;
    -   Delete any whitespaces at the end of the line.
-   `cs"'`: change the surrounding double quotes to single ones.
-   `cs'<p>`: change single quotes to `<p>`.
-   `ds'`: delete the surrounding single quotes.
-   `ysiw'`: wrap current word with `'`.
-   `:%y+`: copy all, = `Ctrl + A` in casual text editor.
    -   `gg"+yG`: similar function.
    -   `ggvG`: similar function, text not copied. Press `y` to do so.

## 관련메타

-   [#이블](https://notes.junghanacs.com/meta/20240927T143312)

## BIBLIOGRAPHY

- “My Evil Cheat Sheet.” n.d. Accessed September 27, 2024. <https://en.dlyang.me/my-evil-cheat-sheet/>.
