我可以在我的.vimrc中放置一个配置条目,它将与-X运行vim时传递标志相同.
提供一些上下文:我最近发现我在屏幕(tmux)会话中的vim启动时间非常长(~6秒)
使用该vim --startuptime标志,很明显问题是由于与X服务器的连接以便设置X剪贴板.
运行vim -X已经修复了我的慢启动时间.我宁愿修改我的.vimrc,而不是创建一个bash别名来解决这个问题.
您可能需要查看clipboard设置(:help 'clipboard').以下是Gary Johnson(来源)的建议.
您可能希望在.vimrc中设置'clipboard',这样您就不必一直使用-X.在我的情况下,我在我从其他各种机器登录的机器上使用vim,其中一些机器设置了$ DISPLAY,即使它们没有X服务器.这是我在.vimrc中的内容:
" Prevent vim from trying to connect to the X server when connecting
" from home, which causes a startup delay of about 14 seconds. I
" usually connect from home via screen.
"
"set clipboard=autoselect,exclude:cons\\\|linux\\\|screen
"
" Using $DISPLAY instead of 'term' should be more reliable. It avoids
" the problem of starting vim without first starting screen and allows
" screen to be used locally without losing vim's X features.
"
if $DISPLAY =~ '\(\(cos\|scs\)\d\+nai\d\+\)\|\(spkpc\d\+\)\|\(tc-garyjohn\)'
set clipboard=autoselect,exclude:.*
endif
Run Code Online (Sandbox Code Playgroud)
(请注意,您需要调整该if $DISPLAY行以匹配您自己的$DISPLAY变量).
| 归档时间: |
|
| 查看次数: |
2651 次 |
| 最近记录: |