vim -X 标志为 .vimrc 条目

标签 vim xserver tmux

是否有一个配置条目可以放置在我的 .vimrc 中,它与传递 -X 的效果相同运行 vim 时标记。

提供一些上下文:
我最近发现我在屏幕 (tmux) session 中的 vim 启动时间非常长(约 6 秒)

使用 vim --startuptime标志,很明显问题是由于连接到 X 服务器以设置 X 剪贴板。

运行 vim -X修复了我缓慢的启动时间。我更愿意修改我的 .vimrc,而不是创建一个 bash 别名来解决这个问题。

最佳答案

您可能需要查看 clipboard 设置 ( :help 'clipboard' )。以下是 Gary Johnson ( source , via web.archive.org ) 的建议。

你可能想在你的 .vimrc 中设置“剪贴板”,这样你就不会
必须一直使用 -X。在我的情况下,我在一个
我从其他各种机器登录的机器,其中一些
即使他们没有 X 服务器,也设置了 $DISPLAY。这是
我的 .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 

(请注意,您需要调整 if $DISPLAY 行以匹配您自己的 $DISPLAY 变量)。

关于vim -X 标志为 .vimrc 条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10718573/

相关文章:

Vim:不区分大小写的 ex 命令完成

regex - Vim 捕获组有不需要的空格

process - 在没有 X 服务器的情况下运行 inkscape

tmux复制模式: how to create your own command?

linux - Elementary OS (linux) 上的 Vim 中的 CTRL-V 映射为粘贴而不是阻止视觉模式

vim - 是否有一个 vim 命令可以通过一个运算符交换两个单词?

linux - wkhtmltopdf --use-xserver 选项

linux - Ubuntu 16.04 lightdm 段错误

linux - 如何从终端中的类似文件中选择一个文件(通过 tmux)

shell - Tmux 将窗口重命名为当前目录