I can use 'yy' and 'p' to copy and paste in my Vim file, but when i copy some Python code from outside and try to do a 'p' in my Vim file it just pastes the last copied thing inside my Vim.
Is there anyway i can sync my vim and system clipboards ??
You can use the command below:
"+gP
Add this to ~/.vimrc
(create it if it doesn't exist):
set clipboard=unnamed
See if your Vim is built with clipboard support with this command, it should echo 1
:
:echo has("clipboard")
If you get a 1
, use "+p
.
If you get a 0
, install a Vim built with clipboard support. MacVim is the most obvious choice.
From change.txt:
Selection and drop registers "*, "+ and "~
Use these registers for storing and retrieving the selected text for the GUI.
When the clipboard is not available or not working, the unnamed register ("") is used instead.
" map to paste from clipboard with Ctrl-Alt-p
" put this mapping in your ~/.vimrc file
nmap <C-M-P> "+p
imap <C-M-P> <esc>"+pA
With this maps I have an easy way to past from outside.