본문 바로가기
my_lesson/_Vi

Vim - Cheat Sheet

by boolean 2017. 11. 11.
728x90

Vim - Cheat Sheet    By Vimgolf


Error : Simple, Practical, and Common
*temp var1 0
*temp var2 "hi"
*temp var3 -1
*temp var4 42
*temp var5 "asdf"
*temp var6 0

Simple things we do all the time should be able to be done with very few keystrokes, but sometimes I find something I need to do makes me go, "There MUST be a better way."

This challenge is just a simple movement and entering text at a certain place.

How edit to do as follows ?
*temp var1 0
*temp var2 "hi"
*temp var3 -1
*temp var4 42
*temp var5 "asdf"
*temp var6 0
*temp var7 11

Simple things we do all the time should be able to be done with very few keystrokes, but sometimes I find something I need to do makes me go, "There MUST be a better way."

New text.

This challenge is just a simple movement and entering text at a certain place.

Solution(drag)  : #Yp<C-A>l11.GONew te<C-N>.<CR><Esc>ZZZ

Error : I forgot quotes
foo = a
        ab
        abc
How edit to do as follows ?
foo = "a"
        "ab"
        "abc"
Solution(drag)  : <C-V>GhA"<Esc>$.ZZ


Error : One number per line
- One number per line -
-----------------------
2,3,5,7,
11,13,17,
19,23,29,
How edit to do as follows ?
2
3
5
7
11
13
17
19
23
29
Solution(drag)  : 5gJV"=[<C-R><C-A>]<CR>pZZ    



Error : Just the middle
Leave only the
numbered lines.
LINE 1
LINE 2
LINE 3
That's all.
Thank you
very much.
How edit to do as follows ?
LINE 1
LINE 2
LINE 3
Solution(drag)  :    )3:wq!<CR>  


댓글