Vim 내용 정리
Vim 내용 정리 (for mac)
ctrl
:control^
입력모드
i
: abcd 에서 c 에 커서가 있다면 abicda
: abcd 에서 c 에 커서가 있다면 abcidI
: abcd 에서 c 에 커서가 있어도 iabcdA
: abcd 에서 c 에 커서가 있어도 abcdi- IntelliJ (IdeaVim)
- VScode (Vim)
navigation
h, j, k, l
: 이동 커서0
: 문장 앞으로$
: 문장 맨뒤로w
: 단어 단위로 앞으로 이동b
: 단어 단위로 백으로 이동3w
: 3단어씩 이동H
: 화면 위M
: 화면 중간L
: 화면 끝gg
: 파일 앞G
: 파일 끝20G
: 20번째 줄로 이동ctrl + u
: 위로 스크롤ctrl + d
: 아래로 스크롤{
: 문단 시작}
: 문단 끝- IntelliJ (IdeaVim)
- VScode (Vim)
명령모드
x
: 커서 아래 글자 삭제dd
: 문장 삭제yy
: 문장 복사p
: 붙여넣기- IntelliJ (IdeaVim)
-
VScode (Vim)
*p
: 클립보드 붙여넣기 (VScode (Vim))
command + object
d
delete(cut),y
yank(copy),c
changed3w
: delete three wordsdit
: delete inner tags (works for html: <p>vim is screen based </P>)dat
: delete at a tagdap
: delete a paragraphdas
: delete a sentence.
: 반복u
: undo 되감기ctrl + R
: 앞감기d2j
: delete two rows belowd3k
: delete three rows abovedi{
: delete inside {} (ie. {hey hey hey hey asdfjasf})di(
: delete inside () (ie. {hey hey hey hey asdfjasf})da(
: delete all () (ie. {hey hey hey hey asdfjasf})ci[
: change inside []; this puts you into insert mode (ie. [yoon, jung, rho])- IntelliJ (IdeaVim)
- VScode (Vim)
smarter
df(
: delete full “(“ (ie. this is testing from [show , hello] (another parenthesis))dt(
: delete til “(“ (ie. this is testing from [show , hello] (another parenthesis)d/[input keyword]
: delete search (ie. pressd/
and if you type [delete] it will delete everything that’s infront of delete)/
: search ->n
next word?
: search ->n
search backwardsv
: select modevaw
: select a wordctrl + v
: block select- IntelliJ (IdeaVim)
- VScode (Vim)
frequently used
shift + *
: find occurrence:%s/old/new/g
: to change every occurrence in the whole file.:%s/old/new/gc
: to change every occurrence in the whole file with prompt.shift + >/<
: indent
change VScode keybinding.json
setting similar to IntelliJ
-
my
keybinding.json
file// Place your key bindings in this file to override the defaults [ { "key": "ctrl+g", "command": "extension.vim_cmd+d", "when": "editorTextFocus && vim.active && vim.use<D-d> && !inDebugRepl" }, { "key": "cmd+d", "command": "editor.action.copyLinesDownAction", "when": "editorTextFocus && !editorReadonly" }, { "key": "shift+alt+down", "command": "editor.action.moveLinesDownAction", "when": "editorTextFocus && !editorReadonly" }, { "key": "shift+alt+up", "command": "editor.action.moveLinesUpAction", "when": "editorTextFocus && !editorReadonly" }, { "key": "ctrl+cmd+g", // 하.. 왜 IntelliJ 에서 처럼 똑같이 구동을 안하는걸까.. (@Intellij: "ctrl+cmd+g" -> Highlight mode -> esc -> Selection Mode -> i -> insert Mode) "command": "editor.action.selectHighlights" } ]
if you want to know more
- type
vimtutor
댓글남기기