## VIM Guide: Copy, Paste, and Find/Replace Operations ### 1. Copy and Paste Lines #### Copy a Single Line 1. In normal mode, move the cursor to the line you want to copy. 2. Press `yy` to yank (copy) the entire line. #### Paste the Copied Line 1. Move the cursor to where you want to paste the copied line. 2. Press `p` to paste after the current line or `P` to paste before the current line. ### 2. Copy and Paste Words #### Copy a Word 1. Move the cursor to the beginning of the word you want to copy. 2. Press `yiw` to yank (copy) the word under the cursor. #### Paste the Copied Word 1. Move the cursor to the desired insertion point. 2. Press `p` to paste after the cursor or `P` to paste before the cursor. ### 3. Copy and Paste Paragraphs #### Copy a Paragraph 1. Move the cursor to any point within the paragraph you wish to copy. 2. Press `yap` to yank (copy) the entire paragraph, including the trailing newline. `ap` stands for "a paragraph". #### Paste the Copied Paragraph 1. Move the cursor to where you want to paste the paragraph. 2. Press `p` to paste after the current position or `P` to paste before. ### 4. Find and Replace #### Find and Replace in the Entire Document 1. Press `Esc` to ensure you are in normal mode. 2. Type `:%s/old/new/g` and press `Enter`. - `:%s` is the substitute command for the entire file. - `old` is the text to find. - `new` is the text to replace it with. - `g` is the global flag, replacing all occurrences in each line. #### Find and Replace in the Current Line 1. With the cursor on the line you want to modify, type `:s/old/new/g` and press `Enter`. #### Find and Replace with Confirmation 1. To replace with confirmation for each occurrence, add `c` at the end: `:%s/old/new/gc`. These commands provide a solid foundation for navigating and editing text within VIM, covering basic copying, pasting, and find/replace operations. Remember to always start in normal mode before executing these commands. With practice, these operations will become second nature, allowing you to efficiently edit and manipulate text in VIM.