How to copy and paste in Vim's terminal mode?
Copy
To copy from a terminal window press CTRL-W N (This is a capital N)1 or CTRL-\ CTRL-N (this is not a capital N) to get into normal mode. From there you can use all usual vim commands to copy and paste stuff.
Entering insert mode will drop you back to your shell.
Paste
To paste from a register into the terminal window you have to be in Terminal-Job ("insert") mode.
Press CTRL-W " followed by the register.
:help Terminal-mode
tells us:
When the job is running the contents of the terminal is under control of the job. That includes the cursor position. Typed keys are sent to the job. The terminal contents can change at any time. This is called Terminal-Job mode.
Use CTRL-W N (or 'termkey' N) to switch to Terminal-Normal mode. Now the contents of the terminal window is under control of Vim, the job output is suspended. CTRL-\ CTRL-N does the same.
[...]
In Terminal-Normal mode you can move the cursor around with the usual Vim commands, Visually mark text, yank text, etc. But you cannot change the contents of the buffer. The commands that would start insert mode, such as 'i' and 'a', return to Terminal-Job mode.
See :h terminal-typing
for more useful commands in terminal windows.
1Unfortunately the vim help doesn't tell you that it is a capital N, I kept the original notation
Can use Shift+Insert as a shortcut to paste from the clipboard into a running terminal session. Setup the mapping like
:tmap <S-Insert> <C-W>"+
The will result in pasting from the +
register. Alternatively use the *
register which sometimes works better in MS Windows.