Can I do all of this from within vim?
This way just involves starting with the first file and yanking the lines. Then use ":e" to open the second file and put the lines where you want them. Save that file, then use :e to get back to the original file. No split window business, but you do have to remember and type filenames. Most important, nothing new for me to learn.
See "the fifth way" below for a way to make this nicer.
This way eases you into split windows. Start with this command:
vi -o aaa bbbThis fires up vim with a split window. The file "aaa" is up top and "bbb" is below. By default it starts you out up top in file "aaa", so yank or delete some lines there. Then use Ctrl-W "down" to switch the the lower window. On my machine "down" is the down arrow key on my huge keyboard. To get back to the upper window, I use Ctrl-W "up".
Even easier, type Ctrl-W Ctrl-W (yes, type it twice) and that takes you to the "other" split.
And perhaps easier type Ctrl-W hjkl (selecting hjkl as appropriate to move up/left/...)
Type ":sp file" to bring "file" in in a new split. The new guy will go up top. Then you are all set up to do things as per the "second way" above.
In lieu of using the ":sp" command you can type Ctrl-W s to split the current window. This gives you the current file in both splits. Then use ":e" to pull in the file you want into one of the splits.
To really make this the nicest solution, use "visual mode" and delete the lines from the source file. Use "V" to lauch visual mode, the "j" key (or whatever) to go to the end of the region you want to move.
If you are curious, type :tabnew bbb and you will see vim create tab names at the top of the screen. Moving around is best done by adding some key mappings to your .vimrc and all of that is getting beyond what I intended to deal with in this page, but it is another way to accomplish this.
Tom's vim pages / tom@mmto.org