Aligning modules to the right side of the shell. #2046
-
|
Hello, This would allow me to have things like the battery usage and the date aligned on the right of the terminal window, and to have important information the username, hostname and directory on the left side. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
This is a popular feature request (tracking issue for it is #498) but we haven't had anyone who's been willing to implement it so far. |
Beta Was this translation helpful? Give feedback.
-
|
@Malternative3772 what shell are you using? There is an easy way to do it in |
Beta Was this translation helpful? Give feedback.
-
|
As I believe the questions will be asked by quite some people, and I wanted to get the right prompt to work in Workaround for Right Prompt (Zsh & Fish Shell)
General notesYou need to run Also, you need to create two Fish shellRun function fish_prompt
...
endThe second section starts after the The first sections needs to go in your ...
set --export STARSHIP_CONFIG /Your/Path/To/Your/starship-left.toml ## change /Your/Path/To/Your/starship-left.toml
"/Your/Local/bin/Path/to/starship" prompt --status=$exit_code --keymap=$keymap --cmd-duration=$starship_duration --jobs=(count (jobs -p)) ## Don't copy this line! It's just for reference ;)
...And finally, you need to edit the function fish_right_prompt --description 'Write out the prompt on the right side (starship style)'
set --export STARSHIP_CONFIG Your/Path/To/Your/starship-right.toml ## change Your/Path/To/Your/starship-right.toml
"/Your/Local/bin/Path/to/starship" prompt
endIf you want to have the ZshRun When you open that file in your editor, you need to replace the following line starting with ...
starship_render() {
...
## change /Your/Path/To/Your/starship-left.toml
PROMPT="$(STARSHIP_CONFIG=/Your/Path/To/Your/starship-left.toml "/Your/Local/bin/Path/to/starship" prompt --keymap="${KEYMAP-}" --status=$STARSHIP_CMD_STATUS --cmd-duration=${STARSHIP_DURATION-} --jobs="$NUM_JOBS")"
## change /Your/Path/To/Your/starship-right.toml
RPROMPT="$(STARSHIP_CONFIG=/Your/Path/To/Your/starship-right.toml "/Your/Local/bin/Path/to/starship" prompt)"
...
}
...If you want to have the Finally you need to change the line Take care |
Beta Was this translation helpful? Give feedback.
As I believe the questions will be asked by quite some people, and I wanted to get the right prompt to work in
Zshanyway, here is the guide to set up a right prompt in both shells.Workaround for Right Prompt (Zsh & Fish Shell)
First, let me start with a big disclaimer: anything you're doing here
may break with any update ofStarship, as we may change the init process of Starship. Therefore you need to check it on each update of Starship.Second, as prerequisite, you should feel comfortable fiddling around with your shell configuration as well as know at least a bit about scripting in your shell (
Fish ShellorZsh).General notes
You need to run
starship init $YourShell --print-ful…