Is there a config entry I can place in my .vimrc which will achieve the same as passing the -X flag when running vim.
To provide some context:
I recently found that my vim startup time in a screen (tmux) session was extremely long (~6 seconds)
Using the vim --startuptime flag, it is clear that the issue is due to the connection to the X server in order to setup the X clipboard.
Running vim -X has fixed my slow startup time. I would prefer to modify my .vimrc, rather than creating a bash alias to solve this.
You may want to take a look at the
clipboardsetting (:help 'clipboard'). What follows is a recommendation from Gary Johnson (source, via web.archive.org).You may want to set ‘clipboard’ in your .vimrc so that you don’t
have to use -X all the time. In my situation, I use vim on a
machine that I log in to from various other machines, some of which
have $DISPLAY set even though they don’t have an X server. Here is
what I have in my .vimrc:
(Do notice that you’ll need to tweak the
if $DISPLAYline to match your own$DISPLAYvariable).