如何在 vagrant ssh bash 中配置颜色

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20392434/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 08:53:16  来源:igfitidea点击:

how to configure colors in vagrant ssh bash

bashterminalconsolezshvagrant

提问by alexserver

this is the situation: I have a virtual machine with vagrant, it has ubuntu precise32, I have been installed byobu on it, and byobu tunned the promp.

情况是这样的:我有一个带有 vagrant 的虚拟机,它有 ubuntu precision32,我已经在上面安装了 byobu,并且 byobu 调整了提示。

I have in my host machine macosx, the regular macosx terminal emulator, and have been installed oh my zsh, which changed the shell from bash to zsh, and tunned the colors to a very fancy theme.

我在我的主机 macosx 中安装了常规的 macosx 终端模拟器,并且已经安装了 oh my zsh,它将 shell 从 bash 更改为 zsh,并将颜色调整为非常花哨的主题。

well, when i connect to vagrant via ssh, all color configuration disappear, and i suppose it loads the configuration from the ~/.bashrc file in the virtual machine.

好吧,当我通过 ssh 连接到 vagrant 时,所有颜色配置都消失了,我想它会从虚拟机中的 ~/.bashrc 文件加载配置。

how can i change the bright purple colors ? is there any bash theme palette cool to install that you would recommend ?

我怎样才能改变明亮的紫色?是否有任何你会推荐的 bash 主题调色板很酷?

this is the my terminal byobu console on ubuntu precise32 on vagrant image.

这是我的终端 byobu console on ubuntu precise32 on vagrant image.

thanks.

谢谢。

采纳答案by Terry Wang

NOTE: I don't know too much about byobu, but I guess it's similar to tmux.

注意:我对 byobu 不太了解,但我想它类似于 tmux。

The simplest thing to do is to install zshand oh-my-zshwithin the vagrant box (suppose you change the default shell by using chshfrom bashto zsh). Then when you vagrant sshto the VM, you'll be using zshand see all the fancy stuff.

最简单的方法是在 vagrant box 中安装zshoh-my-zsh(假设您使用chshfrom bashto更改默认 shell zsh)。然后,当您vagrant ssh访问 VM 时,您将使用zsh并看到所有花哨的东西。

Not sure how purple is set, whether it is byobu customization or settings in .bashrc.

不知道紫色是怎么设置的,是byobu自定义还是.bashrc.

Anyways, if you want to use bash, enable 256 color terminal by setting TERM=xterm-256color, set the prompt colour as you wish, example Gistif you want to use Bash.

无论如何,如果你想使用bash,通过设置启用256色终端,根据需要设置TERM=xterm-256color提示颜色,如果你想使用Bash ,例如Gist

回答by siliconsenthil

I have managed to get colors and a lot of additional features by installing bash-it.

通过安装bash-it ,我设法获得了颜色和许多附加功能。

It's straightforward to install. The installation takes backup of the current ~.bashrcand you can always switch back without any risk.

安装很简单。安装会备份当前的内容~.bashrc,您可以随时切换回去而没有任何风险。