School of Physics, Mathematics, and Computing 
Not logged in (login)
help4407

This forum is provided to promote discussion amongst students enrolled in CITS4407 Open Source Tools and Scripting.

Before posting a question here, you might want to search the forum for previous posts asking the same question.
And please keep the discussion civil (as required by UWA's Computer Use Policy, #9).
 

Options:
RSS cloud
Jump to:

Pasting from windows clipboard into Vim

6 of 108 articles shown, currently no other people reading this forum.
photo
From: Tze K.
Date: Mon 22nd Mar 2021, 4:19pm
Actions: 
Login-to-reply

Hello,

Is there an option to allow vim to paste text from an external clipboard from 
Windows?  

I've tried, in both insert and command mode, using the middle mouse button (which 
inserts "d", which I assume is my internal clipboard since p does the same thing), 
shift+middle mouse button (does nothing),ctrl+shift+v (inserts either ^ or V).

I've tried editing a .vimrc file to include set mouse=ar and the above still 
doesn't work.

Thanks.

Pasting from windows clipboard into Vim

photo
From: Ramen C.
Date: Mon 22nd Mar 2021, 7:31pm
Actions: 
Login-to-reply

Try right-clicking while vim is in insert mode. 
Tested on the ubuntu sub-system.

Pasting from windows clipboard into Vim

photo
From: Patrick SL.
Date: Mon 22nd Mar 2021, 8:30pm
Actions: 
Login-to-reply

I just tried it
1. set paste mode by doing a ":set paste"
2. change to insert mode
3. right or middle click with the mouse

it should show
-- INSERT (paste) --
at the bottom of the window.

you can ignore step 1 if you don't need to worry about the formatting - it just helps with tab's etc.


If your in linux i.e. putty and your trying to copy and paste inside a file in vim i just do 'dd' (deletes the line into the buffer) and 'p' to paste the line. (Both in command mode rather than insert mode).
There are no doubt better ways to do it but this is the way I have always done it.

Pasting from windows clipboard into Vim

photo
From: Tze K.  O.P.
Date: Mon 22nd Mar 2021, 8:51pm
Actions: 
Login-to-reply

I deleted set mouse=ar and right click works now which is odd because it definitely wasn't working before.  Works even from command mode (otherwise I wouldn't have used it in the first place)

but it works now.

Thanks all.

Pasting from windows clipboard into Vim

photo
From: Arran S.
Date: Fri 26th Mar 2021, 2:13pm
Actions: 
Login-to-reply

Hi Tze,

Unfortunately terminals in Windows don't behave exactly the way they do in Linux.

Two more things you might want to try:

1. You could try copying and pasting with keystrokes instead of the mouse. You have to 
specify that you want to allow copy and paste into Ubuntu terminals use ctrl-shift-c (and 
-v) -- these are the standard copy and paste keys used on Ubuntu. (NOT ctrl-c, which 
kills processes.)

Right-click on the Ubuntu icon and go to Properties, and check "Use Ctrl+Shift+C/V as 
Copy/Paste".

2. You could try using different terminal software - there's a much better terminal than 
the default one; the improved one is called (confusingly) Windows Terminal. See here: 
https://www.microsoft.com/en-au/p/windows-terminal/9n0dx20hk701?
activetab=pivot:overviewtab

See if either of those two helps.

cheers

Arran


"Tze Kwok" <23*6*8*[email protected]*u*e*t*u*a*e*u*a*> wrote:

> Hello,
> 
> Is there an option to allow vim to paste text from an external clipboard from 
> Windows?  
> 
> I've tried, in both insert and command mode, using the middle mouse button (which 
> inserts "d", which I assume is my internal clipboard since p does the same thing), 
> shift+middle mouse button (does nothing),ctrl+shift+v (inserts either ^ or V).
> 
> I've tried editing a .vimrc file to include set mouse=ar and the above still 
> doesn't work.
> 
> Thanks.

Pasting from windows clipboard into Vim

photo
From: Tze K.  O.P.
Date: Fri 26th Mar 2021, 8:19pm
Actions: 
Login-to-reply

Thanks, I was actually asking about pasting from the windows clipboard into ubuntu's vim 
(ie. copying the Shotts codes into vim instead of typing everything).  

Wasn't working before but started working again for some reason.
This Page


Program written by: [email protected]
Feedback welcome
Last modified:  6:26am Aug 12 2021