How to Insert VIM Lines From Another File
- 1). Open a terminal or Konsole window.
- 2). Type the command "vim -o file1 file2" to open both files in VIM. Replace "file1" and "file2" with the names of the files that you want to edit. You can list as many files as you want after the "-o" option.
- 3). Press the "Esc" key to enter command mode.
- 4). Type "Ctrl+w" to move to the file that contains the lines you want to copy.
- 5). Press the keyboard arrow keys to navigate to the line that you want to copy.
- 6). Type "yy" to yank (copy) the line.
- 7). Type "Ctrl+w" a second time to move to the file where you want to paste the line.
- 8). Press the keyboard arrow keys to navigate to the location where you want to paste the line.
- 9). Type "p" to paste the line below the cursor. Type "P" to paste the line above the cursor.
- 10
Press ":w" to save the file.
Source...