DEV Community

Vincent Jang
Vincent Jang

Posted on

3 1

How to appear your custom hostname in iTerm + p10k + oh-my-zsh

Recently, I re-learned about VIM, So I want to customize my terminal.

Actually, I already used a terminal iTerm with Oh-My-Zsh
But when I installed and set powerlevel10k, and something occurred.

Image description

HostName is missing.... :(

So I decided to bring missing hostname again.

Step 1 : Edit ~/.p10k.zsh

I used Vim for edit.
You can easily find POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
Just insert host in POWERLEVEL9K_LEFT_PROMPT_ELEMENTS where you want.

vim ~/.p10k.zsh

# in .p10k.zsh
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
    os_icon                 # os identifier
    host                    # hostname
    dir                     # current directory
    vcs                     # git status
    prompt_char             # prompt symbol
  )

Enter fullscreen mode Exit fullscreen mode

Step2 : customize hostname.

Note : Customize hostname may cause unexpected side effects.

scutil --set HostName
HostName: #input hostname you want
Enter fullscreen mode Exit fullscreen mode

Step3 : Confirm result

source ~/.p10k.zsh
Enter fullscreen mode Exit fullscreen mode

Image description

I successfully done.

I think is silly problem, but It really bother me..
I hope it will help people who wander like me.

Thank you for reading.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay