edit zsh prompt

  1. append to .zshrc in home folder to import file:
    $ vim ~/.zshrc
    ...
    source .zshrc-prompt
  2. create .zshrc-prompt in home dir:
    $ cat .zshrc-prompt 
    # Prompt format: [USER@MACHINE:DIRECTORY] [TIME] \n →;
    
    # create bold fonting+color
    PROMPT="%{$terminfo[bold]$fg[green]%}[%{$fg[yellow]%}"
    
    # username@MACHINE:
    # %n username
    # %M machine
    PROMPT="$PROMPT%n@%M:"
    
    # directory
    # %~ directory and $HOME is repalced by ~
    PROMPT="$PROMPT$fg[blue]%}%~"
    
    # color stuff
    PROMPT="$PROMPT%{$fg[green]%}]%{$reset_color%}"
    
    # add time
    PROMPT="$PROMPT%{$terminfo[bold]$fg[black]%} [%*]"
    
    # add 2nd line
    PROMPT="$PROMPT
    %{$terminfo[bold]$fg[white]%}→ %{$reset_color%}"
    
  3. do same for root (same as (1)):
    $ vim /root/.zshrc
    ...
    source .zshrc-prompt
  4. similar to (2):
    $ cat /root/.zshrc-prompt 
    # Prompt format: [USER@MACHINE:DIRECTORY] [TIME] \n #;
    
    # create bold fonting+color
    PROMPT="%{$terminfo[bold]$fg[green]%}[%{$fg[red]%}"
    
    # username@MACHINE:
    # %n username
    # %M machine
    PROMPT="$PROMPT%n@%M:"
    
    # directory
    # %~ directory and $HOME is repalced by ~
    PROMPT="$PROMPT$fg[blue]%}%~"
    
    # color stuff
    PROMPT="$PROMPT%{$fg[green]%}]%{$reset_color%}"
    
    # add time
    PROMPT="$PROMPT%{$terminfo[bold]$fg[black]%} [%*]"
    
    # add 2nd line
    PROMPT="$PROMPT
    %{$terminfo[bold]$fg[red]%}# %{$reset_color%}"
    
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s