paste from win 10 clipboard into Vim

Hi everyone,
I am trying to paste from my windows 10 clipboard into my Manjaro Xfce RPI4 with no success and need some help.

I've been googling and reading and learned that I needed to replace Manjaro's standard vim with gvim and have done so. I've also found settings for .vimrc and have chosen a set I found in my googling for my use of vim. I'll copy and paste a set of the settings I'm using here. I suspect I'm missing something and am hopeful someone can suggest a change. (I'm also open to criticisms and suggestions for changes to these settings.)

Here are my current settings from .vimrc. I have a copy of my .vimrc in my a windows directory so I'm using windows to do the copy/paste. I'll need a way of copying from vim to the clipboard too... :slight_smile:

.vimrc
syntax enable
colors pablo
set hlsearch

set tabstop=4

filetype indent plugin on
set wildmenu
set number
set mouse=a
set nocompatible
set backspace=indent,eol,start
set history=1000
set showcmd
set showmode
set autoread
set hidden

set nowb

set scrolloff=8
set sidescrolloff=15
set sidescroll=1

set nowrap
set linebreak
set foldmethod=indent
set foldnestmax=3
set nofoldenable

How is your Pi connected to your Windows 10 System? Which software do you use to share the clipboard?

I have 2 Pi4's in my home. One is operating as a server and the other as a client. My Win10 laptop is also a client on my local network. The network is wifi and the server is connected to the router using ethernet and has a hard disk attached that it makes available though a Samba share to both my Pi4 Client and my Win 10 client.

I typically access both Pi4's from my Win 10 laptop using ssh through a command prompt. I have several scenarios for copying from win10 clipboard to Vim. The most common is to find something on the web on Win10 (chrome) and mark it, ctl-c it and then want to paste it into vim.

Another, perhaps more bizarre, is that I am in Win10/command prompt/ssh to server pi.... I can then use the command prompt to capture a copy of something that I have cat'd... and then I want to paste it into vim.

So there you go, two scenarios... Is that what you were asking about?

We get there. So wich software do you use as your terminal emulator on Windows 10. Because it depends only on the terminal on your Windows System if you use ssh. Which makes it basically a Windows problem and need to configured on your Windows System.

Do you use also software like screen or tmux?


Just to state the obvious, you need to be in the insert mode in vi to past something in.

I'm unaware of a way to share the clipboard from one machine to the other through nfs or samba shares. I would like to know if there's a way though, one that doesn't require a specific extra piece of software.

I found a couple shared clipboard apps out there, this looked the most promising to me:

I don't use any software per se on my Win 10 client. I use Windows command line directly and run ssh from there. My windows installation is Win 10 Pro, if that makes a difference.

I do have windows subsystem for linux and installed debian there. After an assortment of apt-gets I am able to use ssh from there to access my server too. I don't think it makes a difference though. If I mark something on the screen with my mouse I then use 'enter' to copy it into the clipboard just as I do with the command line of Win 10.

To answer your question directly, no I don't use screen or tmux. I had to lookup both on google. From your questions, I suspect I may be on the wrong path. I did stumble across this link as I was searching for screen which might be a solution, though certainly different from my expectations.

I'm a bit embarrassed to respond to your last 'obvious'.

I have been trying various forms of +p or *p which I believe require that I am not in insert mode. Neither work, but that's been my direction. I've assumed that there is some setting in my .vimrc that I have overlooked that would provide the function i am missing.

For example, if I open vim and type 'asdfasdfasdfasdf' on line one of a test file in insert mode. Then use escape to go to command mode and type 'dd' -- I delete the line and put it into one of vim's buffers. Then if I say 5p I get five lines of 'asdfasdfasdfasdf'. I was guessing that there is some other symbol that I could put in front of paste (p) to get it to fetch from the clipboard.

I know absolutely nothing about windows but see what nano editor does for you after ssh to the pi4. It is a whole lot less confusing.

I read from time to time that a lot of people use PuTTY on windows to interface with linux.

PuTTY

You need at least a ssh client which runs in a terminal emulator. It doesn't work without.

If your terminal emulator has by default a blue background and you use OpenSSH_for_Windows, than you use the powershell in its own emulator.

Simply connect to your PI, open a text file in vi, go to a different window copy some text (It doesn't matter if you use ctrl+c or right click, copy), go back to the powershell window and do a right click. The Text will show up in your terminal. Nothing more is required to copy text form your Windows system to your Terminal.

If you want to copy something from the terminal, simply use your mouse an mark some text and hint enter. It will be in the windows clipboard.

You can also do a right click on the title bar of your powershell window, and use the edit menu point. It might be not labeled as edit, since I have only access to a German Windows. It is there called "Bearbeiten".

This all has nothing to do with your PI. These are functions of the terminal emulator. In your case probably the windows powershell as a emulator (Not powershell as in the script language).

This topic was automatically closed after 90 days. New replies are no longer allowed.

Forum kindly sponsored by