# Vim 導覽 **quick guide** > press key `i`. then you can using `arrow key` to move cursor, `backspace` for delete, and `enter` for change line. > when you done, press key `esc` (escape), and type `:w` for file saving > typing `:q` to quit editor, or you can type `:wq` for file saving and quit editor. > `:q!` is stand for force quit. ## mode swtich ```graphviz digraph { node[shape=box] normal->insert normal->visual insert->normal visual->normal } ``` ## When in Normal mode switch to normal mode with **esc** or **ctrl + [** ### cursor moving | key | description | | ------------- | ------------------------------- | | gg | move top | | G (capital g) | move bottom | | | | | ctrl + u | move **u**p 12 line | | ctrl + d | move **d**own 12 line | | | | | h | move right with 1 character | | j | move down 1 line | | k | move up 1 line | | l | move left with 1 character | | | | | w | jump to next **w**ord | | e | jump to the **e**nd of a word | | b | jump to the **b**egin of a word | ### delete > In fact, all delete operation is cutting | key | description | | --------- | ---------------------------- | | x | cutting one character | | dd | cutting one line | | [==n==]dd | cutting ==n== line | | | | | dw | cutting one word | | de | cutting ending of one word | | db | cutting begining of one word | p.s. the range of cutting is base on cursor's position ### undo redo | key | description | | ------------- | ---------------- | | u | **u**ndo | | ctrl + r | **r**edo | | U (capital u) | | | [==n==]u | undo ==n== times | ## switch to Insert mode from normal mode typeing the command below in normal mode to enter to invert mode | key | description | | ------------- | ----------------------------- | | i | **i**nsert before cursor | | I (capital i) | insert to the begin of a line | | | | | a | **a**ppend after cursor | | A (capital a) | append to the end of a line | | | | | o | new line at cursor's down | | O (capital o) | new line at cursor's up | ## switch to visual mode from normal mode there has three sub mode in visual mode, typing there of them in normal mode to enter to vitual mode | key | description | | ------------- | ----------------- | | v | visual mode | | V (capital v) | visual line mode | | ctrl + v | visual block mode | | key | description | | ------------- | ------------------------- | | y | **y**ank (copy) | | p | **p**aste after cursor | | P (captial p) | paste before cursor | | | | | r | **r**eplace one character | ## substitute [Search and replace](https://vim.fandom.com/wiki/Search_and_replace) ## appendix - [VimIntro](https://flotisable.github.io/VimIntro/index.html#SEC_Contents) - [Vim Tips Wiki](https://vim.fandom.com/wiki/Vim_Tips_Wiki) - [vimrc 設定教學](https://wiki.csie.ncku.edu.tw/vim/vimrc) - [Vim 的操作小技巧](https://kaochenlong.com/2011/12/28/vim-tips.html) - [Vim 搭配 xxd 指令作為 16 進位編輯器教學](https://blog.gtwang.org/useful-tools/how-to-use-vim-as-a-hex-editor/)