Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy-paste from vim in terminal window #25000

Closed
Lallassu opened this issue Apr 19, 2017 · 7 comments
Closed

Copy-paste from vim in terminal window #25000

Lallassu opened this issue Apr 19, 2017 · 7 comments
Assignees
Labels
info-needed Issue requires more information from poster terminal Integrated terminal issues

Comments

@Lallassu
Copy link

I'm using OSX and if I use a terminal in vscode and then edit a file with vim in this terminal window I cannot copy text from it to an open file in vscode. It's possible to copy directly from the terminal (less/more ) but not from vim.

Might be a OSX/vim issue, but it would be great if this worked.

@mjbvz mjbvz added the terminal Integrated terminal issues label Apr 19, 2017
@Tyriar
Copy link
Member

Tyriar commented Apr 19, 2017

@Lallassu vim noob here, how do you copy text with vim?

@Tyriar Tyriar added the info-needed Issue requires more information from poster label Apr 19, 2017
@Lallassu
Copy link
Author

@Tyriar Well, usually you copy with yanking for example marking a part of the text and press "y" without input mode on. That is something that I guess will not be able to work since it will be yanked into vim's internal buffers. But in my case (which I might have been a bit vague about) I copied using the cursor and marking the text in the vim editor (inside the vscode terminal) and than used cmd-c (osx). It's not a big issues since it works using less/more on the files. But in some cases it would be nice since I use the terminal to open files from other projects than the project currently open in vscode.

I hope this explains the issue a bit clearer.

@Tyriar
Copy link
Member

Tyriar commented Apr 19, 2017

So that works in Terminal.app as well? The reason it doesn't work if because you have 2 selections, the terminal one (mouse selection) and the vim one (managed by the application). cmd+c will copy the mouse selection only.

Related: xtermjs/xterm.js#456

@Lallassu
Copy link
Author

Yes I'm aware of that. But I just realised that the issue is not the copy part. It seems to copy, but it copies from the beginning of the visible buffer, not the marked part. Using vim outside of vscode works fine using mouse marking -> cmd-c.

Marking (with the mouse) a part in the vim buffer that I would like to copy just auto-marks the whole visible window (not beginning of the actual buffer in vim). And then the whole window is being copied.

@agronick
Copy link

I'm having this issue as well.

@agronick
Copy link

I found a solution to this problem. In selection manager, replacing all reads from this._buffer with this._terminal.buffer.lines fixes the issue. Can anyone explain why SelectionManager keeps it's own buffer, and why there would be any reason for it to keep a buffer different from whats being displayed on the screen?

The overall cause is that SelectionManager.setBuffer() is not being called from InputHandler.resetMode() whenever the screen changes. Launching vim or scrolling down in vim does not call the case statement in resetMode() that causes setBuffer() to be called. Causing it to use the old contents of the buffer.

@Tyriar
Copy link
Member

Tyriar commented Dec 22, 2017

I believe this is fixed in the latest version

@Tyriar Tyriar closed this as completed Dec 22, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Feb 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster terminal Integrated terminal issues
Projects
None yet
Development

No branches or pull requests

4 participants