Why would you want to use Vim?
How to use Vim?
To open a file:
- In the terminal, type in: vi /tmp/1.txt
- Your cursor keys just work
- Press 'control' + 'D' for pageDown
- Press 'control' + 'U' for pageUp
- Press 'shift' + 'G'
- Type in ':0' then 'enter'
- Press 'shift' + '^'
- Press 'shift' + '$'
- Type in ':50' then 'enter'
- Type in 'dd'
- Type in '20dd'
- Type in '100000dd'
- Repeat until there's no line left
- Type in ':wq!' then 'enter'
- Type in ':q!' then 'enter'
- Press the 'i' key to enter editing mode
- Your 'delete' key and 'backspace' key just work
- Press the 'esc' key
- Press the 'esc' key to exit the edit mode
- Press the 'u' key to undo
- Press the '/' key to search forward
- Example: '/hello' will search forward the next hello that appears in the text
- Press the 'n' key to get to the next 'hello'
- Press 'shift' + 'G' to get to the bottom
- Press 'shift' + '?' key to search backward
- Example: '?hello' will search last hello that appears in the text
- Press the 'n' key to get to the next 'hello'
- Use the above method to get to the word
- Press 'dw' to delete the word
- Use the above method to get to the word
- Press 'x' to delete a character
To copy text:
- Your cursor just works in selecting text
- Your Windows command just works: 'ctrl' + 'c'
- 'cmd' + 'c' for OSX
To paste text:
- Press the 'i' key to enter editing mode
- Your Windows command just works: 'ctrl' + 'v'
- 'cmd' + 'v' for OSX
If your terminal does not support text selection with copy & paste, try:
To copy 1 line:
- Press 'yy' to copy the current line
To paste 1 line:
- Press 'p' to paste a copied a line
Great. You know how to use vim.
No comments:
Post a Comment