Skip to content

Conversation

@prime-run
Copy link
Collaborator

Pull Request

Description

This pull request introduces updates to the configuration files to enhance the shell prompt experience using straship (#491). The following changes are included:

  1. New Starship Prompt Configurations:

    • Added multiple Starship configuration files:
      • brackets.toml
      • heavy-right.toml
      • lualine.toml
      • powerline.toml
      • starship.toml
    • These configurations provide various styles and features for customizing the Starship prompt.
  2. Replacement of Powerlevel10k Theme:

    • Integrated Starship prompt initialization for Zsh:
      • Dynamic paths for STARSHIP_CACHE and STARSHIP_CONFIG are now supported.
      • Simplified prompt initialization with Starship.
  3. Updates to .zshrc:

    • Included notes and comments for transient prompt functionality using Starship.
    • Added placeholders for setting long and short prompts dynamically.
  4. Improvements to .zshenv:

    • Commneted Powerlevel10k initialization with Starship initialization.

Benefits:

  • Enhanced customization and visual appeal of the shell prompt.
  • Improved modularity with multiple Starship configuration options.
  • Simplified and modernized shell environment setup.

Type of change

Please put an x in the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (non-breaking change; modified files are limited to the documentations)
  • Technical debt (a code change that does not fix a bug or add a feature but makes something clearer for devs)
  • Other (provide details below)

Checklist

Please put an x in the boxes that apply:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My commit message follows the commit guidelines.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added a changelog entry.
  • I have added necessary comments/documentation to my code.
  • I have added tests to cover my changes.
  • I have tested my code locally and it works as expected.
  • All new and existing tests passed.

Screenshots

default presets

Additional context

@prime-run prime-run requested a review from kRHYME7 April 23, 2025 04:04
@prime-run
Copy link
Collaborator Author

updated and rebased

@kRHYME7
Copy link
Contributor

kRHYME7 commented Apr 25, 2025

I'm still learning starship. I want to copy the p10k look. I want to prove that starship can be customized this far.

@prime-run
Copy link
Collaborator Author

prime-run commented Apr 25, 2025

I'm still learning starship. I want to copy the p10k look. I want to prove that starship can be customized this far.

ofc it can! which p10k look you trying to recreate ?

update: *any specific looks ?

@kRHYME7
Copy link
Contributor

kRHYME7 commented Apr 25, 2025

Same as the look in this repo.

image

But when it retracts, I do not know how to hide it
image

  1. Another thing is I want to add the time on the right most opposite the prompt.

  2. an I make the arch logo dynamic?

  3. How can we make the prompt behave like this? This is much, much cleaner IMO
    image

@prime-run
Copy link
Collaborator Author

prime-run commented Apr 25, 2025

there you go

It's not exactly the same but i did it in line 15 min!

and mostly i was shaving off features from starship

Another this is I want to add the time on the right most opposite the prompt.

use :

right_format = """
...

"""

there is a preset in the PR called havy-right

and for the last spacer color issue, trying putting it in the format but wrap it with style
sth like :
250425_12h13m53s_screenshot

keep in mind the spacer fg should match the line's bg.
basically get the spacer down in the format!

also you can do conditionals

@prime-run
Copy link
Collaborator Author

an I make the arch logo dynamic?

how dynamic ? XD


How can we make the prompt behave like this? This is much, much cleaner IMO

cehck out https://starship.rs/advanced-config/

@prime-run
Copy link
Collaborator Author

wtw the gist is linked you is not updated i started working on it before you sent these screenshots!
I'll update it

@kRHYME7
Copy link
Contributor

kRHYME7 commented Apr 25, 2025

cehck out https://starship.rs/advanced-config/

Already on it. It is called transient prompt. . And I don't think I can do this on my own. I am dumb. 😉. I don't know if we needed this https://github.com/akinomyoga/ble.sh, but it looks like this is bash?

Edit2: Also so the time on the right side is called secondary prompt.

Edit: I drafted it for now, I might accidentally click the merge.

@kRHYME7 kRHYME7 marked this pull request as draft April 25, 2025 12:25
@prime-run
Copy link
Collaborator Author

I am dumb. 😉

bruh!! we've seen your work! NEVER say that

called transient prompt.

yea transient prompt is popular!

# .zshrc
eval "$(starship init zsh)"

set-long-prompt() { PROMPT=$(starship prompt) }
precmd_functions=(set-long-prompt)

set-short-prompt() {
  if [[ $PROMPT != '%# ' ]]; then
      PROMPT=$(starship module character)
    zle .reset-prompt
  fi
}

zle-line-finish() { set-short-prompt }
zle -N zle-line-finish

trap 'set-short-prompt; return 130' INT

this should work!
I added similar thing to the .zshrc with comments,

@prime-run
Copy link
Collaborator Author

I might accidentally click the merge.

XD what do you mean "accidentally" starship is 10k times better than p10k 😁😁

@prime-run
Copy link
Collaborator Author

I added similar thing to the .zshrc with comments,
I'll update it to this one for better readability!

@kRHYME7
Copy link
Contributor

kRHYME7 commented Apr 25, 2025

I felt like I will add Oh-my-posh too(soon ). I usually use OMP on my Raspi and some servers because of the bright colors by default.

I added similar thing to the .zshrc with comments,
Cool! should be fine then.

@prime-run prime-run marked this pull request as ready for review April 25, 2025 12:46
@prime-run
Copy link
Collaborator Author

I felt like I will add Oh-my-posh too

well I personally rather write go than rust (as you probably can see in my repos lol) but I don't actually trust go to style my shell (performance wise)!
starship -> rs
OMP -> go
:)

@prime-run
Copy link
Collaborator Author

prime-run commented Apr 25, 2025

I suggest keeping at least 2, config files so that we can use them for a per-window-styling via

export STARSHIP_CONFIG=~/.config/starship/xxxx.toml

and I added docs for it in .zshenv

something like:
250425_13h29m44s_screenshot

BTW, is it possible to use the terminal colors instead of hard coding it?

yup! don't style it! nither in main format or [component]'s format

@kRHYME7
Copy link
Contributor

kRHYME7 commented Apr 25, 2025

least 2, config files so that we can use them for a per-window-styling via..

oki

@prime-run
Copy link
Collaborator Author

btw format supports \n

format = """
...
 \n$character"""

for sth like this:
250425_13h41m27s_screenshot

@prime-run
Copy link
Collaborator Author

prime-run commented Apr 25, 2025

can we remove the other toml files for now and use a single starship.toml?

I think lualine.toml and brackets.toml are easiest to remove! the rest are lowkey unique!

update: I might have stolen lualine from lualine.nvim 😁😁😁

@kRHYME7
Copy link
Contributor

kRHYME7 commented Apr 25, 2025

function STARSHIP_TRANSIENT_PROMPT {
set-long-prompt() { PROMPT=$(starship prompt) }
precmd_functions=(set-long-prompt)

set-short-prompt() {
  if [[ $PROMPT != '%# ' ]]; then
      PROMPT=$(starship module character)
    zle .reset-prompt
  fi
}

zle-line-finish() { set-short-prompt }
zle -N zle-line-finish

trap 'set-short-prompt; return 130' INT
}

function NO_STARSHIP_TRANSIENT_PROMPT {
set-long-prompt() { PROMPT=$(starship prompt) }
precmd_functions=(set-long-prompt)

set-short-prompt() {
  if [[ $PROMPT != '%# ' ]]; then
      PROMPT=$(starship module character)
  fi
}

zle-line-finish() { set-short-prompt }
zle -N zle-line-finish

trap 'set-short-prompt; return 130' INT
}

image

this way instead of long block of code in zshrc you can just add a one-liner. Can we add this fucntionsin zshenv?

@prime-run
Copy link
Collaborator Author

good job bro 😁

Can we add this fucntionsin zshenv?

??
do you want me to add it !!?

and this is getting too long do you want to continue on discord LOL ?!

@kRHYME7
Copy link
Contributor

kRHYME7 commented Apr 25, 2025

and this is getting too long do you want to continue on discord LOL ?!

It's almost ready. ahha my laptop is lagging so won't open discord for now.

??
do you want me to add it !!?

Yeah, if this is a good approach.

so that in your ~/.zshrc, you we can add something like

# Starship's transient prompt
# NO_STARSHIP_TRANSIENT_PROMPT # Disable transient prompt

@prime-run
Copy link
Collaborator Author

if this is a good approach.

it certainly is,

so functions in .zshenv and # NO_STARSHIP_TRANSIENT_PROMPT # Disable transient prompt ins .zshrc correct?
anything else ?

@kRHYME7
Copy link
Contributor

kRHYME7 commented Apr 25, 2025

so functions in .zshenv and # NO_STARSHIP_TRANSIENT_PROMPT # Disable transient prompt ins .zshrc correct?
anything else ?

Yup, I think so.

@prime-run
Copy link
Collaborator Author

wait @kRHYME7 where in .zshenv you wan them ? XD

    if command -v starship &> /dev/null; then
        eval "$(starship init zsh)"
        export STARSHIP_CACHE=~/.starship/cache
        export STARSHIP_CONFIG=~/.config/starship/starship.toml
        function STARSHIP_TRANSIENT_PROMPT {
            set-long-prompt() { PROMPT=$(starship prompt) }
            precmd_functions=(set-long-prompt)
            set-short-prompt() {
              if [[ $PROMPT != '%# ' ]]; then
                  PROMPT=$(starship module character)
                zle .reset-prompt
              fi
            }

            zle-line-finish() { set-short-prompt }
            zle -N zle-line-finish

            trap 'set-short-prompt; return 130' INT
            }

        function NO_STARSHIP_TRANSIENT_PROMPT {
            set-long-prompt() { PROMPT=$(starship prompt) }
            precmd_functions=(set-long-prompt)

            set-short-prompt() {
              if [[ $PROMPT != '%# ' ]]; then
                  PROMPT=$(starship module character)
              fi
            }

            zle-line-finish() { set-short-prompt }
            zle -N zle-line-finish

            trap 'set-short-prompt; return 130' INT
            }

    fi

right?

and I'll get ridof lualine preset!

P.S : Allow edits by maintainers is enabled :)

@kRHYME7
Copy link
Contributor

kRHYME7 commented Apr 25, 2025

P.S : Allow edits by maintainers is enabled :)

😅 let me sort my hyrpland first, cause the latest is lagging so much.

I will add the transient prompt toggle (I forgot you despised shell scripting 😅)


Can we remove the off colored BG for the time?
image

@prime-run
Copy link
Collaborator Author

the latest is lagging so much.

j6sikqody1n81 (1)

@kRHYME7
Copy link
Contributor

kRHYME7 commented Apr 25, 2025

And here we are chatting like in Discord. 🤣

@prime-run
Copy link
Collaborator Author

Well I give up LOL

I'm on it XD

I tried to modify to :

function starship_transient_prompt {
  local enabled=$1

  set-long-prompt() {
    PROMPT=$(starship prompt)
  }
  precmd_functions=(set-long-prompt)

  set-short-prompt() {
    if [[ $PROMPT != '%# ' ]]; then
      PROMPT=$(starship module character)
      if [[ $enabled == true ]]; then
        zle .reset-prompt
      fi
    fi
  }

  zle-line-finish() { set-short-prompt }
  zle -N zle-line-finish

  trap 'set-short-prompt; return 130' INT
}
#   starship_transient_prompt true   
#   starship_transient_prompt false  

to avoid calling it twice in case of NO_STARSHIP_TRANSIENT_PROMPT

I'll update the rest, tho :)

@prime-run
Copy link
Collaborator Author

so to keep you updated,

starship_transient_prompt() {
  local enabled=${1:-true}
  
  if [[ "$enabled" == "true" ]]; then
    set-long-prompt() { PROMPT=$(starship prompt) }
    precmd_functions=(set-long-prompt)
    
    set-short-prompt() {
      if [[ $PROMPT != '%# ' ]]; then
        PROMPT=$(starship module character)
        zle .reset-prompt
      fi
    }
    
    zle-line-finish() { set-short-prompt }
    zle -N zle-line-finish
    
    trap 'set-short-prompt; return 130' INT
    
    #WARN: I HATE BASH! REMOVE THIS LINE WHEN YOU'RE DONE TESTING
    echo "Transient prompt enabled"
  else
    typeset -f set-long-prompt >/dev/null && unset -f set-long-prompt
    typeset -f set-short-prompt >/dev/null && unset -f set-short-prompt
    
    precmd_functions=("${(@)precmd_functions:#set-long-prompt}")
    zle -D zle-line-finish 2>/dev/null
    trap - INT
    PROMPT=$(starship prompt)
    
    #WARN: I HATE BASH! X2 REMOVE THIS LINE WHEN YOU'RE DONE TESTING
    echo "Transient prompt disabled"
  fi
}

I seems to be working! but honestly! I feel like the code block in .zshrc is the way !!!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces the Powerlevel10k theme with new Starship prompt configurations, offering a range of customizable styles and simplified prompt initialization.

  • Added multiple Starship configuration files (including starship.toml and powerline.toml) with customized formatting for various modules.
  • Updated prompt initialization in shell configuration to support dynamic paths and refined visual elements.

Reviewed Changes

Copilot reviewed 2 out of 7 changed files in this pull request and generated 1 comment.

File Description
Configs/.config/starship/starship.toml Main Starship configuration with custom modules and formatting options
Configs/.config/starship/powerline.toml Alternative prompt configuration mimicking Powerline style
Files not reviewed (5)
  • Configs/.zshenv: Language not supported
  • Scripts/pkg_core.lst: Language not supported
  • Scripts/pkg_extra.lst: Language not supported
  • Scripts/restore_cfg.lst: Language not supported
  • Scripts/restore_cfg.psv: Language not supported

Copy link
Contributor

@kRHYME7 kRHYME7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your patience @prime-run

@kRHYME7 kRHYME7 requested a review from Copilot April 25, 2025 17:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces the existing Powerlevel10k theme with new Starship prompt configurations and updates the corresponding configuration files to enhance and simplify the shell prompt setup for Zsh.

  • Introduces several new Starship configuration files (starship.toml, powerline.toml, etc.).
  • Updates prompt initialization in .zshrc and disables outdated Powerlevel10k initialization in .zshenv.

Reviewed Changes

Copilot reviewed 2 out of 7 changed files in this pull request and generated no comments.

File Description
Configs/.config/starship/starship.toml New Starship prompt configuration with various modules and formatting options
Configs/.config/starship/powerline.toml New Powerline-style configuration using Starship prompt sections
Files not reviewed (5)
  • Configs/.zshenv: Language not supported
  • Scripts/pkg_core.lst: Language not supported
  • Scripts/pkg_extra.lst: Language not supported
  • Scripts/restore_cfg.lst: Language not supported
  • Scripts/restore_cfg.psv: Language not supported

@kRHYME7 kRHYME7 merged commit 6eede76 into HyDE-Project:master Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants