For example, to this day I haven't figured out an easy, built-in way to copy from one vim window to another. I'd love to have some features of other editors have but the key bindings always hold me back.
For example, to this day I haven't figured out an easy, built-in way to copy from one vim window to another. I'd love to have some features of other editors have but the key bindings always hold me back.
Normally y is used to yank. However, you can prefix it with "x to yank in to register x. Then you can "xp to paste from register x. You have registers 0-9 and a-z for regular use. They work within a single window.
If you use register *, the register corresponds to your OS clipboard.
Read :help registers to learn more.
For editing multiple docs with vim, I find it's easier to use multiple buffers in the same window. Use :b <start of file name> to jump back and forth.
" Use ctrl + movement keys to move around windows
map <C-H> <C-W>h<C-W>_
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_
map <C-L> <C-W>l<C-W>_2 ctrl-^ go to buffer 2
3 ctrl-^ go to buffer 3
ctrl-^ toggle this buffer with the last one, quickly switching back and forth.
[Of course, ctrl-^ is actually just ctrl-6, you don't need to use the shift key.]
If you have used a tiling window manager before, this is very natural.
I actually use tabs for multiple files and these keybindings for navigation:
nmap T :tabedit nmap H :tabprevious<CR> nmap L :tabnext<CR>
So I can go into a project dir and do vim -p .c* which opens the file in tabs and just navigate with Shift-H and Shift-L
nmap T :tabedit
nmap H :tabprevious<CR>
nmap L :tabnext<CR>huh? I run in 3+ windows (terminal shells) all the time and have done so for 5+ years. To cut and paste between windows I use filesystems copy and paste (select and middle click in X)
Vim is flexible and you are suppose to run it however works for you.
Also, the + register has similar intended uses.
com -range YY :<line1>,<line2>w! ~/tmp/cnp.txt
com PP :r ~/tmp/cnp.txt
Then :YY, :PP as appropriateGetting to the point, it is easy to copy and paste between windows using the system buffer. Just map copy and paste to something easy and familiar, say Ctrl-C/V/X, and go on with your life. I'm sure there is a "correct" way to accomplish what you are asking using registers, but quite frankly I don't know it and have never felt the need to learn.
(I know this assumes you are using a graphical Vim.)