(“My Evil Cheat Sheet | Lanternd’s Castle” n.d.) 여기 내용이다.
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][]]
hjklw: move forward by one wordb: move backward by one word, the opposite ofw.e: move forward to the end of a wordggG:<NUM>: Go to line number0: =Home$: =EndC-u: move up half screenC-d: move down half screenC-f: move down a whole pageC-b: move up a whole page
Enter Insert State
iaIA$as: delete a char and insert.S: (substitute) delete the whole line and start from the begining, =0C.
Editing
y: yank/copyyy: yank the current linep: pasteP: paste before cursord: delete/cutD: delete to the end of the linedt.: delete to the period. Similar asdf., which will delete.as well.u: undoC-R: redox: delete char at current position.X: delete char before current position.
Replace[[https://en.dlyang.me/my-evil-cheat-sheet/#replace][]]
rR:s/old_word/new_word/gc:gmeans “global”, parametercmeans “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>.f3ccan find the 3rd occurence ofc.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 charV: select lineC-v: select paragraph
Advanced[[https://en.dlyang.me/my-evil-cheat-sheet/#advanced][]]
daw: delete around word.diw: delete inside word.disdascis: delete and insert at current sentencedip: paragraphdapdi'/da': single quotedi"/da": double quote[ai]["`([{"]: all kinds of scopedit/dat: inside / around tag- replace
dabove byv: 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 + Ain casual text editor.gg"+yG: similar function.ggvG: similar function, text not copied. Pressyto do so.
Related-Notes
BIBLIOGRAPHY
“My Evil Cheat Sheet | Lanternd’s Castle.” n.d. Accessed September 27, 2024. https://en.dlyang.me/my-evil-cheat-sheet/.
Comments