in terminal: 1. ctrl + z to stash vim, and type fg to bring it back. 2. ctrl + w to delete a word, ctrl + u to delete a whole line, both work in terminal and vim edit mode. 3. ctrl + r to find history commands fuzzily.
Modes Switch: 1. in normal mode, i or a or o to enter edit mode(i = insert, a = append, o = newline) 2. in edit mode, ESC or Ctrl+[ to enter normal mode 3. in normal mode, hit v or V to enter visual mode 4. in visual mode, hit ESC or Ctrl+[ to normal mode
✓w or W to move cursor forward by a word, and b or B is backward. ✓0 (number zero) to back to the begin of the line, and $ is jump to the end. ✓fx will stop the cursor at the next "x" character in current line, and F is search backward.
✓vit will visually select content between the tag, while vat will even including the tag. ✓vi" will visually select content between current double quotes. ✓viw will select the current word. ✓ctrl+v to enter block selection mode.
✓:w write to file. ✓:q exit Vim. ✓:tabe create a new tab. ✓gt to switch to next tab, gT to previous tab. (I map gt and gT to F7 and F8 in my vimrc) ✓:new to create a horizontal split window, :vnew or :vs to create a vertical split window.
✓vi -o a.rb b.rb to open those two files at the same time with horizontal split window. ✓vi -O a.rb b.rb same as above, but in vertical split window. ✓vi -p a.rb b.rb to open files with tabs. ✓vi http://www.eddie.com.tw will read the source content into vim directly.
Practice: 1. select a sentence, deselect, and select another sentence, and deselect.. x N ! 2. select a sentence, delete it, select another sentence, and delete.. X N
Practice: 1. select a paragraph, deselect, and select another paragraph, and deselect.. x N ! 2. select a paragraph, delete it, select another paragraph, and delete.. X N
✓D to clear all content of current line after the cursor. ✓C like D, but enter insert mode. dG will clear all content after the cursor, dgg will clear all content before the cursor. ✓x remove a character. ✓. to repeat last action. ✓dd to delete whole line, 3dd to delete 3 lines. ✓u to undo, ctrl+r to redo.
✓~ to toggle upper case and lower case. ✓:m+ to move current line to next line. ✓:m-2 to move current line to previous line. ✓>> to add indentation. ✓<< to reduce indentation. ✓= re-format, gg=G re-format whole file.
✓dw, diw to delete the word in the cursor. ✓cw, ciw same as above, but enter insert mode. ✓r to replace current character. ✓J to concatenate current line with next line, 3J will concatenate next 3 lines. ✓> to add indentation, < to remove indentation.
✓ set history=1000 keep 1000 lines of command line history. ✓ set undolevels=100 ✓ set ruler show the cursor position all the time ✓ set autoread auto read when file is changed from outside ✓ set cursorline ✓ set number ✓ set numberwidth=4
✓ set nobomb no BOM(Byte Order Mark) ✓ set clipboard+=unnamed ✓ set splitright always open vertical split window in the right side. ✓ set splitbelow always open horizontal split window below. ✓ set scrolloff=5 start scrolling when n lines away from margins ✓ set showtabline=2 always show tab
✓ set synmaxcol=128 ✓ set viminfo= disable .viminfo file ✓ filetype on enable filetype detection ✓ filetype indent on enable filetype-specific indenting ✓ filetype plugin on enable filetype-specific plugins ✓ syntax on syntax highlight ✓ set hlsearch search highlighting ✓ set incsearch incremental search ✓ set ignorecase ignore case when searching
✓ set nobackup no *~ backup files ✓ set noswapfile ✓ set nowritebackup ✓ set expandtab replace with spaces ✓ set softtabstop=2 ✓ set shiftwidth=2 ✓ set tabstop=2
or if you trust me… 1. via curl: sh <(curl -L https://github.com/kaochenlong/eddie-vim/raw/master/utils/install.sh) ! 2. via wget: sh <(wget --no-check-certificate https://github.com/kaochenlong/eddie-vim/raw/master/utils/install.sh -O -)