When I am inserting a big block of code or text, often I will want to copy and paste text from elsewhere into that block.
Is the only way to do this to leave insert mode, go get the text and paste, then go back to insert mode?
You don't have to leave insert mode if you don't want to. While in insert mode, paste text from a register by pressing
<C-r>+ to paste from system clipboard or
<C-r>" to paste lines yanked inside vim (from the unnamed register).
After the clarification in your comment, I would recommend that you adapt a different workflow in vim:
While being in insert mode, just type the beginning of your long constant or variable name, e.g. the first 3 characters followed by
<C-p>. Vim will use its built-in autocompletion to complete the word. If more than one word starts with the same sequence, press
<C-p> repeatedly (or use
<C-n> to select previous item).
I'm not exactly sure what you want to do here, but I think you're looking for
If you're in insert mode, and need to copy text from a webbrowser or other application (or window). Do the copy, return to vim, and type
If you need to insert something yanked earlier in vim while staying in insert mode, you might be looking for
If you want to use vim like a traditional, notepad-like editor, you can use select mode. This is like visual mode, but with your mouse, and it behaves more like a traditional editor does. Add these to your
set selectmode+=mouse snoremap <C-v> "+y snoremap <C-x> "+d
Then for paste, do this:
inoreamp <C-v> <C-o>"*p
Personally, I recommend against mapping to
<C-v> since this is really useful in insert mode. I would map it to
<M-v> (alt+v) but it's up to you.