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

Should Vi mode really use its own internal clipboard? #319

Closed
jazzdelightsme opened this issue Dec 15, 2015 · 8 comments
Closed

Should Vi mode really use its own internal clipboard? #319

jazzdelightsme opened this issue Dec 15, 2015 · 8 comments
Labels
Issue-Enhancement It's a feature request.

Comments

@jazzdelightsme
Copy link
Contributor

@srdubya : Thank you for implementing Vi mode!

I got tripped up trying to use "p" to paste some text from the system clipboard. I took a look at the code, and saw that Vi mode uses its own internal clipboard (just a string member called _clipboard).

I don't anticipate ever getting register support in PSReadLine (I don't think we want an entire vi implementation inside PSReadLine), so I think it would make sense to make the system clipboard the backing store for Vi mode's yank/put operations.

What do you all think?

@srdubya
Copy link
Contributor

srdubya commented Dec 15, 2015

Hi Dan,

I thought about implementing it that way but decided against it because:

  1. Git Shell does not do this, at least on my system.
  2. Lots of vi-mode commands put text into _clipboard. I figured overwriting the system clipboard while editing a command would be viewed as an undesirable side effect most of the time.

I like it the way it is, but I'd support putting your idea behind a setting.

@gwojan
Copy link

gwojan commented Dec 15, 2015

@jazzdelightsme, @srdubya Interesting! I was just going to request that this be configurable. 😄 I too would like access to the system clipboard because I'm constantly doing the copy/paste thing from other sources into the PowerShell prompt. I always use the unnamed register in gVim/VsVim.

With that said, I really like the the existing visual copy capability from @lzybkr. That's why I originally asked that v be changed to allow visual selection and V actually launch $env:VISUAL.

@lzybkr
Copy link
Member

lzybkr commented Dec 15, 2015

Agreed, a configuration option is a good idea. I use that setting in Vim and find it extremely useful, but it's not for everybody.

As for registers - I could see adding them. Emacs mode has the kill ring which is similar to having multiple registers.

@lzybkr lzybkr added the Issue-Enhancement It's a feature request. label Dec 15, 2015
@jazzdelightsme
Copy link
Contributor Author

Thank you everyone for the discussion!

@srdubya : I personally don't care much what git bash does :), but item 2 alone is a good enough reason on its own to tread carefully, like putting it behind an option. When I get a chance I'll think about how registers might be implemented, unless somebody beats me to it.

@springcomp
Copy link
Contributor

My work on #333 currently awaiting review as PR #811 lead me to implement the internal clipboard as a register. It could then be extended for named registers fairly easily.

@Wongboo
Copy link

Wongboo commented Feb 1, 2021

So if I want to vi mode use system clipboard instead of its own, what should I do for it?

@springcomp
Copy link
Contributor

@Wongboo Make vi-mode use the system clipboard is not currently supported, unfortunately.

Not sure this would be worth it to be honest.

One way would be to have an option, which would replace the internal clipboard and use the system clipboard.

A better way would be to support the + register which is the standard way in vim to use the system clipboard. Thus, the user would have to type sequences like: "+yy or "+p for instance.

Again, I’m not really sure there is a use case for it, though 🤔.

@daxian-dbw
Copy link
Member

A better way would be to support the + register which is the standard way in vim to use the system clipboard. Thus, the user would have to type sequences like: "+yy or "+p for instance.

I agree that would be the better way to go, if we really decide to support it.
Given that there is no plan to support the system clipboard as a configuration and that the discussion has made it clear that using an internal clipboard is the desired design, I will close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement It's a feature request.
Projects
None yet
Development

No branches or pull requests

7 participants