turn off/on clipboard before/after global command?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

turn off/on clipboard before/after global command?

Daniel Drucker
I am finding that despite the patch committed in 7.4.396 (see thread https://groups.google.com/forum/#!topic/vim_dev/PzKxIYNtgTo ), if clipboard=unnamed, global commands such as g/foo/d are extremely slow (100x slowdown).

I am seeing this behavior in 7.4.396 as well as the latest 8.0 patch.

I see this behavior only when running vim on Linux but using a Windows desktop, but I have tried multiple X servers (Cygwin/X, Xming, MobaXTerm) and multiple terminal emulators (Putty, MobaXTerm, a Cygwin terminal) and see the same result in all of them. When I ssh to the same Linux machine from a MacOS machine, I don't see the problem.

As I've been unable to solve this, I'm looking for a workaround. Is it possible to do a remap such that

:g/foo/d

becomes

:set clipboard=exclude:.*
:g/foo/d
:set clipboard=unnamed


so as to disable using the system clipboard for the duration of the global command?

Thanks,

Daniel

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: turn off/on clipboard before/after global command?

Michael Henry-5
On 05/09/2017 11:01 AM, Daniel Drucker wrote:

> As I've been unable to solve this, I'm looking for a
> workaround. Is it possible to do a remap such that
>
> :g/foo/d
>
> becomes
>
> :set clipboard=exclude:.*
> :g/foo/d
> :set clipboard=unnamed
>
>
> so as to disable using the system clipboard for the duration
> of the global command?

You could add "_" to the command to delete into the black hole
register::

  :g/foo/d _

I'm not sure how well this would work for you, but you might
also define a new command that implies the underscore::

  :command -nargs=* G g<args> _

But it might be better to disable/enable the clipboard in the
command body instead::

  :command -nargs=* G set clipboard=exclude:.* | g<args> | set
clipboard=unnamed

But in my very limited testing, I didn't get a speedup with this
second option.  Deleting to the black hole register was much
faster for me.

Also, the above commands aren't full-featured yet; for example,
they don't account for using ``:g`` with a range.

Michael Henry

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: turn off/on clipboard before/after global command?

Daniel Drucker
> You could add "_" to the command to delete into the black hole
> register::
>
>   :g/foo/d _


Thanks. That'll help - I forgot I could do that. I do this rarely enough that I can just remember to do that, I think, rather than make a new command.

I wish I knew what was causing this issue, though...

Daniel

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: turn off/on clipboard before/after global command?

Christian Brabandt

On Mi, 10 Mai 2017, Daniel Drucker wrote:

> Thanks. That'll help - I forgot I could do that. I do this rarely
> enough that I can just remember to do that, I think, rather than make
> a new command.
>
> I wish I knew what was causing this issue, though...

Well, we would need someone who can analyze the issue. The original
report was about accessing the Clipboard on Windows would be slow, when
it is obvious that copying the data into the clipboard would be
overwritten with the next operation during the :g command.

So basically that has been implemented and that has worked on Windows
without problems. When I created that patch, I could verify that using
:g/./d on a buffer containing thousands of lines it would slow down Vim
considerably.

However you case seems to be special. Perhaps its the network traffic
that causes your issue when trying to access the clipboard or the
clipboard connection between the X-server and your Windows machine is
generally slow. It is hard to say from the outside.

However, have you tried to use Cygwin Vim and do your work from the
Cygwin terminal? I believe the Cygwin Vim can access the Windows
clipboard nowadays just fine, so perhaps getting your x-server out of
the equation is giving some hints.

Mit freundlichen Grüßen
Christian
--
Warum steht ein Pils im Wald?
Weil die Tannen zapfen.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...