屏幕和屏幕中的 VIM 配色方案油灰?

发布于 2024-08-08 14:34:32 字数 596 浏览 8 评论 0 原文

当使用 PuTTy 作为客户端通过 ssh 使用 VIM 时,我一直试图让颜色方案在 VIM 中正常工作,但不幸的是我没有取得太大成功。即使我在 Putty 中启用了 256 种颜色并在 VIM 中设置 t_Co=256,我也只能使用 PuTTY 获得 8 位颜色。结果却没有达到应有的效果。我一直在尝试复制此设置 http://www.interworksinc.com/blogs/ckaukis/2009/06/03/vim-color-schemes-putty 但正如我所说,到目前为止这是徒劳的。

这里有人在 PuTTy 中使用 VIM 成功实现了配色方案吗?我很感激任何建议

谢谢,

帕特里克

[编辑]原来我已经找到了问题的根源。我在屏幕上使用 vim,它破坏了颜色。我想更新的问题是,是否可以在屏幕会话中使用工作颜色? [/编辑]

I've been trying to get colourschemes to work properly in VIM when using it over ssh with PuTTy as a client but unfortunately I haven't had much success. I can only get 8bit colours working with PuTTY even though I've enabled 256 colors in putty and set t_Co=256 in VIM. They don't turn out as they should. I've been trying to replicate this setup http://www.interworksinc.com/blogs/ckaukis/2009/06/03/vim-color-schemes-putty but as I say it's been in vain so far.

Has anyone here had success with colourschemes working with VIM in PuTTy? I'd appreciate any advice

Thanks,

Patrick

[EDIT] Turns out I've found the source of the problem. I was using vim in a screen which was breaking the colours. Updated question I guess is, is it possible to have working colors in a screen session? [/EDIT]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

柠北森屋 2024-08-15 14:34:33

我在 Putty 中遇到了黑色背景的问题:默认颜色的黑色背景上的蓝色字符很难阅读:

下启用“系统颜色

为了获得更好的对比度,我的解决方案是在“设置/窗口/颜色/使用系统颜色”

” 复选框显示 Putty 屏幕,白底黑字。不时髦但可读:-)

I had trouble with black background in Putty: blue characters on a black background with default colours are hard to read:

My solution for a better contrast was to enable "system colors" checkbox unter

"Settings / Window / Colours / Use system colors"

This displays the Putty screen with black characters on a white background. Not hip but readable :-)

莳間冲淡了誓言ζ 2024-08-15 14:34:32

除了编译支持之外,可能还需要向 screenrc 添加一些配置(我需要)。

http://www.frexx.de/xterm-256-notes/ 有一个很好的指导。要筛选的相关部分:

默认情况下,screen 不知道它正在支持 256 色的 xterm 中运行。要使 screen 中的程序识别此功能,您需要在 ~/.screenrc 中设置三件事:

# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
attrcolor b ".I" 
# tell screen how to set colors. AB = background, AF=foreground 
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' 
# erase background with current bg color 
defbce "on"

As well as compiled support, it may be necessary to add some config to screenrc (I needed to).

http://www.frexx.de/xterm-256-notes/ has a good guide. The relevant part to screen:

By default, screen is not aware that it is running in a 256 color capable xterm. To make programs in screen recognize this feature, you need to set three things in your ~/.screenrc:

# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
attrcolor b ".I" 
# tell screen how to set colors. AB = background, AF=foreground 
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' 
# erase background with current bg color 
defbce "on"
流云如水 2024-08-15 14:34:32

是的,您可以使用屏幕执行 256 色,但是,通常不会编译此选项。只需自行编译屏幕:

--enable-colors256

或者,您可以获得 选项卡式 PuTTy。它的优点是 ctrl-a 可以转到行首,并让您免于许多 termcap 的麻烦。但是,如果您想从多个终端重新连接到 screen 会话,那么确实没有什么比 screen 更好的了。

注意。这个问题可能属于超级用户。

Yes, you can do 256 colours with screen, however, this option usually isn't compiled in. Simply compile screen yourself with:

--enable-colors256

Alternatively, you could get a tabbed PuTTy. It has the advantage of ctrl-a going to the beginning of the line, and saves you from many termcap headaches. However, if you like to reconnect to your screen sessions from multiple terminals, there really isn't anything better than screen for the job.

NB. This question probably belongs on Superuser.

两个我 2024-08-15 14:34:32

我在 Mac OS 上遇到了同样的问题,尝试了一些解决方案,但所有测试都显示 256 色未显示。之后我安装了brew的屏幕,一切都很好。也许是因为 /usr/bin/ 中的 Mac OS 默认屏幕是在没有 --enable-colors256 标志的情况下编译的。

Mac 操作系统解决方案: brew 安装屏幕

I had same problem on Mac Os, tried some solutions but all tests show that 256 colors not displayed. After that I'm installed screen from brew and all works great. Maybe it's because Mac Os default screen from /usr/bin/ compiled without --enable-colors256 flag.

Solution for mac os: brew install screen

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文