Vim Noob Note

For myself, all commands(and more) used in Atom are wrote down.
Created at 2017-12-12 22:05:51. Maybe I can do better afterwards.

  • Switch to Insert Mode: i, insert before the current char
  • Append(Switch to Insert Mode): a, insert after the current char
  • Switch to Normal Mode: <Esc>
  • Delete current char: x
  • Delete former char: X
  • Delete a line: dd
  • Delete line break(current and later lines): J
  • Undo: u
  • Redo: <CTRL-R>
  • Undo all changes on the last line edited: U
  • Insert new line after current line: o
  • Insert new line before current line: O
  • Count: 9k, move down after 9 lines; 3x, delete 3 chars
  • Save and Exit: ZZ
  • Discarding Changes: :q!
  • Reload Origin Version of File: :e!
  • Move Cursor to Word Behind(first char): w
  • Move Cursor to Word Before(first char): b
  • Move Cursor to Word Behind(last char): e
  • Move Cursor to Word Before(last char): ge
  • Move to end of line: $, <End>
  • Move to first non-blank char of the line: ^
  • Move the begin of line: O, <Home>
  • Move to the matching parenthesis: %
  • Move to specific line: Line Number + G
  • Scroll half screen down: <CTRL-D>
  • Scroll half screen up: <CTRL-U>
  • Scroll whole screen down: <CTRL-F>
  • Scroll whole screen up: <CTRL-B>
  • Middle the cursor: zz
  • Search: / downwards; ? upwards
  • Skip next search result: n downwards; N upwards
  • Open file: :e + path
  • Create file: :new + name
  • Select text block: v
  • Exit visual mode: <CTRL-C>
  • Delete(cut) text: d
  • Copy: y
  • Copy current line: yy
  • Paste: p
  • Commnet multiple lines: <CTRL-V> -> I -> comment char
  • Copy to system clipboard: “+y
  • Paste from system clipboard: “+p
  • Move to the top: gg
  • Move to the last line: G
  • Select all text: ggvG + <End>
  • Autocomplete: <C-n> or <C-p>
  • Move lines up or down(using the following settings): <CTRL-Up> and <CTRL-Down>

  • Interact with system clipboard: http://vim.wikia.com/wiki/Accessing_the_system_clipboard
    • For me(after install vim-gnome and set clipboard=unnamedplus): "+y and "+p
  • Fold codes(intent method): :set foldmethod=indent
  • Unfold: zr or zR to unfold all levels folds
  • Fold: zm
  • Split window: sp or vsp
  • Swap in windows: <CTRL-W> + directions
  • Create file in new tab: :tabnew
  • Edit file in new tab: :tabe
  • Swap to latter tab: gt
  • Swap to former tab: gT
  • List all tabs: :tabs
  • Swap to specific tab: number of tab + gt
  • Close tab: :tabc
  • Customized command(in .vimrc, mush starts from capitalization): command Mycommand + origin command
  • For fzf and fzf.vim(…complex for me): https://github.com/junegunn/fzf/blob/master/README-VIM.md
    • <Enter>, open selected files in current window
    • <CTRL-T> open selected files in new tab
    • <CTRL-X> open selected files in horizontal splits
    • <CTRL-V> open selected files in in vertical splits
    • Search codes in all files: :Ag
    • Search files: :Files
  • Increase indent(Normal): >>
  • Reduce indent(Normal): <<
  • Increase indent(Insert): <CTRL-T>
  • Reduce indent(Insert): <CTRL-D>

.vimrc backup

 

 

Leave a Reply

Your email address will not be published.