I find myself refactoring code fairly frequently and my screen space is at a premium. I'd like to be able to move to a particular scope (class, function, or even if-statement/for-loop blocks) and either cut the code and append it to another file or copy the code and append it to another file. Ideally, I'd like to do this in Fortran, C and C++.
I know I can open multiple windows and stack them and use the usual kill on lines or marked regions then change to the other window and yank the lines or regions into that buffer. But I don't want to have multiple windows open, it makes it harder to see where I am in the file from which I'm moving code. Plus, code from one file may be going to multiple places. So I'd like to just dump it at the end of a a different file and then move it around in that file later.
How can I move/copy the code within the scope of the cursor to the end of another file for those languages? If there isn't a method that would work in each language, is there a way to do it on marked regions of code and single lines?