Question

I'm trying to use vim on a remote Ubuntu server and I'm noticing that the start up for vim is too slow unless I use the -X flag or have set clipboard=exclude:.* in my .vimrc.

When I use either options, vim starts up fast but the problem is I can't copy from vim to the system clipboard. I've tried numerous times to do :set clipboard=unnamed and the like from the console but it won't register anything because it seems to only connect to the x server if that line is in .vimrc.

How can I start vim with the -X option but start the x server afterwards (only if I need to copy stuff)? Or how can I change clipboard settings from within the console?

Was it helpful?

Solution

If you have to start Vim with -X, I don't think there's a way to later enable clipboard support. You either have to find and fix the root cause for the slowness of connecting to X, or work around this with external tools, e.g.

:3,5w !xsel --clipboard

or

:3,5w !xclip -in -selection clipboard
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top