๐ Vim โ
๋งํฌ โ
Use Cases โ
Changing case โ
~
: case ๋ณ๊ฒฝ ํ ์ค๋ฅธ์ชฝ์ผ๋ก ์ปค์ ์ด๋{Visual}~
: highlighted text case ๋ณ๊ฒฝ{Visual}U
: highlighted text uppercase๋ก ๋ณ๊ฒฝ{Visual}u
: highlighted text lowercase๋ก ๋ณ๊ฒฝ
์ฐธ๊ณ โ
- https://stackoverflow.com/questions/2946051/changing-case-in-vim
- https://vimhelp.org/change.txt.html#~
Indentation โ
{Visual}[count]>
: ํ์ฌ line count ์ ๋งํผ ์ค๋ฅธ์ชฝ์ผ๋ก indent (shiftwidth)>%
: curly-braces block ์ค๋ฅธ์ชฝ์ผ๋ก indent>iB
: block์ ์ค๋ฅธ์ชฝ์ผ๋ก indent
์ฐธ๊ณ โ
- https://stackoverflow.com/questions/235839/indent-multiple-lines-quickly-in-vi/235841#:~:text=Use%20the%20%3E%20command.,inside%20block%20use%20%3E%20i%20B%20.
- https://vimhelp.org/change.txt.html#%3E
Substitution โ
:[range]substitution/from/to/[flags]
:%s/from/to/[flags]
: ์ ์ฒด ํ์ผ์ ํ์ํ๋ฉด์ substitution์ ์ํ. %๋ ์ ์ฒด ๋ฌธ์์ด์ ์๋ฏธ,
s`๋ substitution์ ์๋ฏธ:.s/from/to/[flags]
: ํ์ฌ๋ผ์ธ์์ substitution์ ์ํ:.,$s/from/to/[flags]
: ํ์ฌ๋ผ์ธ๋ถํฐ ํ์ผ์ ๋๊น์ง ํ์ํ๋ฉด์ substitution์ ์ํ
์ฐธ๊ณ โ
Writing and Quiting โ
:x
: Like ":wq", but write only when changes have been made.
ZZ
: Write current file, if modified, and close the current window (same as ":x").
์ฐธ๊ณ โ
simple-change โ
v_g_CTRL-X
({Visual}g CTRL-X) : Subtract [count] from the number or alphabetic character in the highlighted text. If several lines are highlighted, each value will be decremented by an additional [count] (so effectively creating a [count] decrementing sequence).
์ฐธ๊ณ โ
์ํ๋ ์ด๋ก ์ด๋ โ
N|
: N๋ฒ์งธ ์ด๋ก ์ด๋
80A=<ESC>d80|
:=
๋ฅผ 80๋ฒ ๋ฐ๋ณต ์ ๋ ฅํ ํ 80๋ฒ์งธ ์ด๊น์ง ์ญ์
์ฐธ๊ณ โ
Open command in editor in zsh (Ctrl + x + e ๋์ฒด) โ
bash
# .zshrc ๋ง์ง๋ง์ ์ถ๊ฐ
autoload edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line
v
- bash vi mode์์๋
v
๋ฅผ ์ ๋ ฅํ๋ฉด editor์์ command๋ฅผ ์ ๋ ฅํ ์ ์๋๋ก ์ฐฝ์ด ์ด๋ฆฐ๋ค. ๊ฐ์ keybind๋ฅผ ํด์ฃผ๋ ๋ฏ
์ฐธ๊ณ โ
- https://superuser.com/questions/592831/edit-current-command-in-zsh-vi-mode/592857#592857?newreg=ba6c5a36d6b34bbd817d2e124a5f9866
- https://apple.stackexchange.com/questions/347742/what-is-the-ctrlxe-equivalent-for-macoss-terminal