How to Code with vim

 

Switch lines

  • Step 1: Position the cursor on the line you want to move.
  • Step 2: Type dd to cut the entire line.
  • Step 3: Move the cursor to the desired position.
  • Step 4: Type p to paste the line below the current line, or type P to paste the line above the current line.

Example:

  • To move line 2 to line 4:
  1. Navigate to line 2.
  2. Type dd (line is cut).
  3. Navigate to line 4.
  4. Type p (line is pasted below line 4).

Save the file

  • Step 1:press "esc"
  • Step 2: Type ":w" ,to write changes.
  • Step 3: Type ":wq", to write and quit.

Undo

  • Step 1:press "esc"
  • Step 2: Type ":u"

Comments

Popular posts from this blog

Install & set up mitmweb or mitmproxy in Linux

Day 30: Sliding Window Maximum: Sliding Window - leetcode - Python3

Day 31: Climbing Stairs : leetcode: python3