配置隐藏终端计算机用户名
看起来你用的是 item2 + oh-my-zsh
组合,假如你用的主题是 agnoster
,修改方法是进入 oh-my-zsh/themes/
然后 vi agnoster.zsh-theme
,编辑主题配置文件,找到如下代码:
# Context: user@hostname (who am I and where am I)
prompt_context() {
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
# 修改如下代码,@Mac可以你自己定义
# prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m"
prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@Mac"
//直接注释了 什么都不写这里,就是没有用户名
fi
}
- [ 评论 · 4](javascript:void(0);)
- [赞赏](javascript:;)
- [编辑](javascript:;)
山顶的男人 [图片上传失败...(image-30701e-1557822852455)]
353
如何进入oh-my-zsh/themes/呢
— max210 · 2017年10月13日
多谢 问题解决了
— max210 · 2017年10月13日
确实,比较喜欢在 prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m
前面加个 #
。更简洁
— Yori · 2018年05月21日
回复 max210:
cd .oh-my-zsh/themes/
参考:
https://segmentfault.com/q/1010000011533134
配置参考:
https://www.cnblogs.com/diyxiaoshitou/p/9017413.html
如果用这个iterm2配置后提示npm 和 node命令不存在
需要在vim ~/.zshrc 配置下面代码
参考网址:https://segmentfault.com/q/1010000015698087
export PATH=$HOME/bin:/usr/local/bin:$PATH:/usr/local/bin