Domanda

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

È stato utile?

Soluzione 2

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

set clipboard=unnamed

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top