Wednesday, May 10, 2017

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

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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment