9. Cut, Copy & Paste
With this type of vi editor commands we can cut/copy or Paste the contents of the file.
- x ===> cut the character
- @x ===> cut @ characters ( @ = number of characters )
- yw ===> copy the word
- @yw ===> copy @ words ( @ = number of words )
- cw ===> cut the word
- @cw ===> cut @ words ( @ = number of words )
- dw ===> delete the word
- @dw ===> delete @ words ( @ = number of words )
- yy ===> copy the line
- @yy ===> copy @ lines ( @ = number of lines )
- cc ===> cut the line
- @cc ===> cut @ lines ( @ = number of lines )
- dd ===> delete the line
- @dd ===> delete @ lines ( @ – number of lines )
- y$ ===> copy words from the cursor up to the end of the line
- c$ ===> cut words from the cursor up to the end of the line
- C ===> …and change to insert mode
- d$ ===> delete words from the cursor up to the end of the line
- D ===> Same as above
- p ===> paste the cut/copied/deleted line/s, word/s or character/s
Leave a Reply