문제

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 ??

도움이 되었습니까?

해결책 2

Add this to ~/.vimrc (create it if it doesn't exist):

set clipboard=unnamed

다른 팁

You can use the command below:

"+gP
  1. See if your Vim is built with clipboard support with this command, it should echo 1:

    :echo has("clipboard")
    
  2. If you get a 1, use "+p.

  3. 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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top