简体   繁体   English

从Mac SSH到Ubuntu服务器时,Vim Solarized颜色错误

[英]Vim Solarized colors wrong when SSH'ing from Mac to Ubuntu server

When using SSH from my Mac to an Ubuntu 16.04 server, the colors in Vim when trying to use the Solarized theme are incorrect. 当从Mac到Ubuntu 16.04服务器使用SSH时,Vim中尝试使用Solarized主题时的颜色不正确。 A few details about my setup: 有关我的设置的一些详细信息:

Mac Terminal.app using xterm-256color along with the Solarized Dark profile. Mac Terminal.app使用xterm-256color以及Solarized Dark配置文件。

Ubuntu 16.04 also using xterm-256color and ZSH (Zprezto) as my shell of choice. Ubuntu 16.04还使用xterm-256color和ZSH(Zprezto)作为我的选择。

Here are two screenshots of my .vimrc, the first details how it looks without the solarized colorscheme enabled and the second with solarized and its recommended settings enabled. 这是我的.vimrc的两个屏幕截图,第一个详细介绍了未启用solarized色彩方案时的外观,第二个详细说明了启用solarized及其推荐设置的情况。 I've tried both set t_Co=16 and let g:solarized_termcolors=16 (which is commented out in both screenshots) but it didn't help. 我已经尝试过set t_Co=16let g:solarized_termcolors=16 (在两个屏幕截图中都注释掉了),但这没有帮助。

Solarized Disabled: 太阳能残障人士: 没有启用太阳能

Solarized Enabled: 启用太阳能: 启用太阳能 ] ]

Did you read the suggestions from the author? 您阅读了作者的建议吗? It is suggested that you set your terminal's color palette to a custom profile provided by the author. 建议您将终端的调色板设置为作者提供的自定义配置文件。 From the Vim page on his site : 他网站上Vim页面

IMPORTANT NOTE FOR TERMINAL USERS: 终端用户的重要注意事项:

If you are going to use Solarized in Terminal mode (ie not in a GUI version like gvim or macvim), please please please consider setting your terminal emulator's colorscheme to used the Solarized palette. 如果要在终端模式下使用Solarized(即不在诸如gvim或macvim的GUI版本中)使用, 考虑将终端仿真器的配色方案设置为使用Solarized调色板。 I've included palettes for some popular terminal emulator as well as Xdefaults in the official Solarized download available from Solarized homepage . 我在Solarized 主页的官方Solarized下载中包含了一些流行的终端模拟器的调色板以及Xdefaults。 If you use Solarized without these colors, Solarized will need to be told to degrade its colorscheme to a set compatible with the limited 256 terminal palette (whereas by using the terminal's 16 ansi color values, you can set the correct, specific values for the Solarized palette). 如果您使用不带这些颜色的Solarized,则需要告知Solarized将其颜色方案降级为与有限的256终端调色板兼容的设置(而通过使用终端的16 ansi颜色值,您可以为Solarized设置正确的特定值调色板)。

If you do use the custom terminal colors, solarized.vim should work out of the box for you. 如果您确实使用了自定义的终端颜色,则solarized.vim应该为您开箱即用。 If you are using a terminal emulator that supports 256 colors and don't want to use the custom Solarized terminal colors, you will need to use the degraded 256 colorscheme. 如果使用支持256色的终端仿真器,并且不想使用自定义的Solarized终端色,则需要使用降级的256色方案。 To do so, simply add the following line before the colorschem solarized line: 为此,只需在colorschem日光浴的行之前添加以下行:

 let g:solarized_termcolors=256 

Again, I recommend just changing your terminal colors to Solarized values either manually or via one of the many terminal schemes available for import. 再次,我建议您只是手动地或通过许多可用于导入的终端方案中的一种将终端颜色更改为“日晒”值。

So following his advice, you should import the custom color palette to your terminal application. 因此,按照他的建议,您应该将自定义调色板导入到终端应用程序中。

Based on your screenshots, I believe you are using Apple's Terminal app. 根据您的屏幕截图,我相信您正在使用Apple的终端应用程序。 You can download Solarized from the homepage , and once unzipped you should find color files for Terminal in the osx-terminal.app-colors-solarized folder. 您可以从主页下载Solarized,解压缩后,您应该在osx-terminal.app-colors-solarized文件夹中找到Terminal osx-terminal.app-colors-solarized文件。 There are four versions as of this writing: 截至撰写本文时,有四个版本:

  • Light
  • Dark
  • Light (xterm256-color) 浅色(xterm256色)
  • Dark (xterm256-color) 深色(xterm256色)

After a lot of back and forth, using solarized-osx-terminal-colors which is updated for more recent versions of the Mac Terminal.app solved the problem. 经过反复的反复,使用针对 Mac Terminal.app的最新版本更新的solarized-osx-terminal-colors解决了该问题。 My .vimrc just contains 我的.vimrc仅包含

syntax enable
set background=dark
colorscheme solarized

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM