VIM iTerm SSH: Cant' copy paste - vim

I'm using iTerm2. If I'm using vim on local works fine and I can copy some text from my vim session with mouse.
Now I'm connecting to a debian 7, running vim with the same configuration. I select a text and now I can't copy, with contextual menu (right click) the "Copy" function is disable.
Do you have any solution ?
My .vimrc: https://github.com/arnaudlamy/config/blob/master/.vim/.vimrc

Holding Alt when trying to select text helps.

Related

How to disable wrapping pasted text in search line

I got "additional" functionality either from vim or some plugin. Recently I updated vim to 8.0.216 and updated all my plugins. The "additional" functionality I get is when I search for string in a file with / and paste, for example "term", the resulted pasted text become <PasteStart>term<PasteEnd>.
How can I disable this annoying functionality?
I tried to disable all my plugins and removed .vimrc completely, but the wrapping is still there. Is this something new build to vim?
Edit:
I use iTerm2. Tried in buit-in terminal - its the same.
I saw somewhere this is related with tmux. Removed tmux and loaded fresh console. Same.
I am using oh-my-zsh if this could be related.
Edit2
I use shortcut commands for both copy and paste.
I have found three possible workarounds:
1, Use iTerm's Paste special and uncheck the Bracketed paste mode. Unfortunately, that's 3 extra clicks.
2, Use the Bracketed paste plugin, or add the relevant commands to your .vimrc:
execute "set <f28>=\<Esc>[200~"
execute "set <f29>=\<Esc>[201~"
cmap <f28> <nop>
cmap <f29> <nop
3, Create an alternate shortcut to paste with Bracketed paste mode disable:
Go to prefs>keys
Click the +
Select the keyboard shortcut field and press ⌘⌥v
For Action, select Paste…
Select the desired options. E.g. Disable Bracketed paste mode.
Press ok
Source of alternative shorcut.
NOTE: You could simply re-bind the Command + V.
The answer is: update your Vim.
Apparently it's a bug and updating Vim (to 8.0.0237) has solved it for me.

how to paste to vim when using putty

I am using putty to connect a remote host and editing via vim. I meet a trouble when I try to paste something to vim. That's, I copy something to clipboard in my local host and want to paste it to the vim in the remote host. How to do that?
ps: I am using putty! So, I open a vim window via putty. The very need is that I want to copy something in my local host and paste it to the vim editor opened by putty. That's all. Thanks!
Try with Ctrl + Shift + V or with middle click with a 3 button mouse
EDIT
What about? Shift + Ins
Source : https://superuser.com/questions/180043/paste-the-windows-clipboard-into-my-putty-session-using-only-the-keyboard
You can insert text from your host’s clipboard by pressing the right mouse button (default setting) or by pressing Shift + Ins. Note that this has the same effect as entering every character manually. So if you are using auto indentation in vim, this will very likely screw up your code.
To fix that, you can do the following:
Before pasting into vim, enable paste mode by entering :set paste.
Press i to enter insert mode. The status bar should say -- INSERT (paste) -- now.
Press the right mouse button to paste in your stuff. The auto indentation of vim should not happen.
If this puts you into the -- (insert) VISUAL -- mode, exit out of it using Esc (putting you into the paste insert mode again), and try pasting it again while holding Shift using your right mouse button.
Press Esc to leave insert mode, and disable paste mode using :set nopaste again.
You can change which mouse button is used to paste in PuTTY in the Window/Selection configuration page.
In Windows Subsystem for Linux it appears that you have to:
i = to enter -- INSERT -- mode
Shift-right-mouse-click = to paste
If you just right-mouse-click (i.e. without shift) then annoyingly all that happens is that the mode changes to -- (insert) VISUAL -- i.e. it doesn't paste anything.
To clarify the other answers, there are a couple ways to do this, depending on if Vim is running with mouse support. Lets assume its via some sort of terminal/Putty:
When not using mouse in remote Vim, right clicking will paste from local clipboard via Putty into remote Vim.
With mouse enabled in remote Vim, Shift + Ins will paste from local clipboard via putty into remote vim.
Ctrl + Shift + v will paste from local clipboard via native/*nixish/xterm into remote vim.
With mouse enabled in remote Vim, middle clicking will paste from remote clipboard into remote Vim.
Copy&Paste between Windows&PuTTY:
To copy from Windows and paste into PuTTY, highlight the text in Windows, press "Ctrl-C," select the PuTTY window, and press the right mouse button to paste. To copy from PuTTy and paste into Windows, highlight the information in PuTTY and press "Ctrl-V" in the Windows application to paste it.
Copy&Past between two vim in separate PuTTY:
highlight the information in the source PuTTY, and then press the right mouse button in the target PuTTY to paste.

selecting in visual mode to paste outside vim window

I need to paste some selected block in visual mode to outside of vim. Currently I need to select this block manually from mouse to paste outside of vim.
As selecting texts in visual mode is easier ,it would be efficient to select some text for pasting outside of vim.
You could yank the text into the + (plus) register, that is mapped to the system clipboard. Just select the text in the mode you like and then type "+y.
Disclaimer: Linux
So what I have noticed is you need clipboard support compiled in to your vim. I ended up compiling my own vim, which had the clipboard support. To check run vim --version and look for a +clipboard or a -clipboard, if it's + then yay you have it, if it's - then you need to compile vim yourself or download a version with clipboard support compiled in. Then the answers people have said seem to work. For me "*y copies into the buffer that is pasted by pressing the middle button, and "+y copies into the buffer which is the normal control + c or on the terminal control + shift + c so what I put into my vimrc was
map <C-c> "+y
that way doing control + c me paste it somewhere else by pressing the exact same command
:wq
If you are using GUI-based gvim, simply yank your text into the "clipboard register" by prefixing your yanking command with "+. That is, when you have finished selecting your text in visual mode, press "+y to yank your text then it will be in your system clipboard.
If you are using text-based vim and your vim has clipboard access to your current system, it's just the same as gvim. If your vim has no clipboard access, try to establish the clipboard connection as described in this page:
http://www.quora.com/How-can-you-copy-all-contents-of-a-text-file-opened-in-vim-through-Putty-on-a-Windows-desktop-to-Windows-clipboard
You can bind contents of the visual selection to system primary buffer (* register in vim, usually referred as «mouse» buffer) by using
set clipboard^=autoselect
You have to identify the register that vim is using to get the outside clipboard.
First copy any text outside vim and then inside vim do the command :registers and look for the text you copied, once you have identified the register simply use it every time you need to copy and paste from the outside:
for example:
Im using gvim in Windows7 and the register used by vim to get the external clipboard is
*"
then in vim select the text and do
*"y to copy (yank) and paste outside as usual
and to paste inside vim from outside do *"p
you can also do a map to the register to easy copy/paste

Copying stuff from vim running in putty

I am running Vim 6.3 through putty and putty connection manager. I have the mouse option set (set mouse = a). I am able to paste things from the (windows) clipboard to vim by but selecting text in vim isn't copying anything to the clipboard. Does anyone know how do I do this?
Note: I can't update Vim to a newer version.
Hold down shift, and then highlight the text you want to copy using the left mouse button. When you release, the highlighted text should be in the Windows clipboard.
You can select some text with the mouse and then type:
"*y to yank the selected text to the clipboard, then you should be able to use the clipboard content in another application.
if "*y is to cumbersome to type, you can put the following in host .vimrc
:noremap y "*y
Ctrl-Insert to copy, Shift-Insert to paste
Do not use mouse=a.
Put the mouse in commandline mode (:set mouse=c).
Then you can just select your text to put it in the system clipboard (as with all other PUTTY/KITTY commands),

vim -- copy to system clipboard in OpenSuSE

I've tried the methods mentioned at Vim: copy selection to OS X clipboard, but neither the * or + register seem to be working for me. I'm on OpenSuSE 11.3, and have vim and vim-data installed (there is no vim-full package as mentioned in the link in SuSE). I've tried with Klipper enabled and disabled. (edit) I've also tried pasting with ctrl+v and middle click.
Thanks in advance.
See if you have something called vimx, an X enabled version of vim. You can alias vim to that, and then use * register.
This is a superuser question.
I presume that you are running VIM in terminal and talk about VIM's visual selection, not selection with the mouse in terminal window.
Since in your case VIM isn't aware of the X, it obviously cannot communicate your selection to the X Window System. If you select something in terminal window with mouse, then you are selecting not in VIM, but in the terminal emulator which is aware of the X and communicates properly the current selection to X's clipboard.
You can try to play around with xsel tool which allows one to access the X clipboard from command line. You would need to override the usual clipboard shortcuts to not only put the content of the visual selection into the usual VIM register(s), but also to pipe it to the xsel so that it becomes the new X selection. (Strangely enough, I do not have the xsel installed on the SLES10 system I have right now at hand.) That obviously would only work if (1) the terminal is running locally or (2) remote server you are connected to allows the X forwarding. If the X forwarding is disabled on the server where you edit the files, then you have no chance to do in VIM: only selecting with mouse in terminal window would work.
Check synchronize contents of the clipboard and the selection in the clipper configuration.
Highlight text with the mouse (will not work with vim key selections).
Your selection is in the clipper.

Resources