Skip to content

Instantly share code, notes, and snippets.

@ryo-ARAKI
Last active May 24, 2024 22:34
Show Gist options
  • Save ryo-ARAKI/48a11585299f9032fa4bda60c9bba593 to your computer and use it in GitHub Desktop.
Save ryo-ARAKI/48a11585299f9032fa4bda60c9bba593 to your computer and use it in GitHub Desktop.
Starship configuration file
# ~/.config/starship.toml
[battery]
full_symbol = "๐Ÿ”‹"
charging_symbol = "๐Ÿ”Œ"
discharging_symbol = "โšก"
[[battery.display]]
threshold = 30
style = "bold red"
[character]
error_symbol = "[โœ–](bold red) "
[cmd_duration]
min_time = 10_000 # Show command duration over 10,000 milliseconds (=10 sec)
format = " took [$duration]($style)"
[directory]
truncation_length = 5
format = "[$path]($style)[$lock_symbol]($lock_style)"
[git_branch]
format = " [$symbol$branch]($style) "
symbol = "๐Ÿฃ "
style = "bold yellow"
[git_commit]
commit_hash_length = 8
style = "bold white"
[git_state]
format = '[\($state( $progress_current of $progress_total)\)]($style) '
[git_status]
conflicted = "โš”๏ธ "
ahead = "๐ŸŽ๏ธ ๐Ÿ’จ ร—${count} "
behind = "๐Ÿข ร—${count} "
diverged = "๐Ÿ”ฑ ๐ŸŽ๏ธ ๐Ÿ’จ ร—${ahead_count} ๐Ÿข ร—${behind_count} "
untracked = "๐Ÿ›ค๏ธ ร—${count} "
stashed = "๐Ÿ“ฆ "
modified = "๐Ÿ“ ร—${count} "
staged = "๐Ÿ—ƒ๏ธ ร—${count} "
renamed = "๐Ÿ“› ร—${count} "
deleted = "๐Ÿ—‘๏ธ ร—${count} "
style = "bright-white"
format = "$all_status$ahead_behind"
[hostname]
ssh_only = false
format = "<[$hostname]($style)>"
trim_at = "-"
style = "bold dimmed white"
disabled = true
[julia]
format = "[$symbol$version]($style) "
symbol = "เฎƒ "
style = "bold green"
[memory_usage]
format = "$symbol[${ram}( | ${swap})]($style) "
threshold = 70
style = "bold dimmed white"
disabled = false
[package]
disabled = true
[python]
format = "[$symbol$version]($style) "
style = "bold green"
[rust]
format = "[$symbol$version]($style) "
style = "bold green"
[time]
time_format = "%T"
format = "๐Ÿ•™ $time($style) "
style = "bright-white"
disabled = false
[typst]
format = "[$symbol($version)]($style)"
style = "bold #239dae"
[username]
style_user = "bold dimmed blue"
show_always = false
[nodejs]
format = "via [๐Ÿค– $version](bold green) "
@Kjvthomas
Copy link

Kjvthomas commented Aug 4, 2021

Well I think you've most probably misput the [character] module within the [battery] module.

[battery]
full_symbol = "๐Ÿ”‹"
charging_symbol = "๐Ÿ”Œ"
discharging_symbol = "โšก"

[battery.display]
threshold = 30
style = "bold red"

[character]
error_symbol = "[โœ–](bold red)"

my current error:

(starship::config): Unable to parse the config file: redefinition of table character for key character at line 28 column 1

when i # the errorsymbol the error goes away

EDIT:
I have to do this to get the error to go away
#[character]
#error_symbol = "[โœ–](bold red)"

if i dont #[character] the error is still there

@nazibalalam
Copy link

nazibalalam commented Aug 5, 2021

You have to put the "submodules" in double third brackets @Kjvthomas

# This is the one you have
     

[battery]
full_symbol = "battery"
charging_symbol = "electric_plug"
discharging_symbol = "zap"

[battery.display]
threshold = 30
style = "bold red"
# This is the one it should be : 
[[battery.display]]  # "bold red" style and discharging_symbol when capacity is between 0% and 10%
threshold = 10
style = "bold red"

@Kjvthomas
Copy link

You have to put the "submodules" in double third brackets @Kjvthomas

# This is the one you have
     

[battery]
full_symbol = "battery"
charging_symbol = "electric_plug"
discharging_symbol = "zap"

[battery.display]
threshold = 30
style = "bold red"
# This is the one it should be : 
[[battery.display]]  # "bold red" style and discharging_symbol when capacity is between 0% and 10%
threshold = 10
style = "bold red"

Yeah I know I was trying different things to get the [character] area to work. Thatโ€™s the area thatโ€™s broken

@nazibalalam
Copy link

So @Kjvthomas does it work now?

@Kjvthomas
Copy link

So @Kjvthomas does it work now?

Same error. The lack of brackets were never the problem. I did remove them to see if that was the issue and it wasnโ€™t.

@nazibalalam
Copy link

Well, @Kjvthomas I think you should print your full-config file here, I am unable to determine the problem until I see what's wrong, thank you

@Kjvthomas
Copy link

Well, @Kjvthomas I think you should print your full-config file here, I am unable to determine the problem until I see what's wrong, thank you

Thanks for your help, Here it is:


Don't print a new line at the start of the prompt

add_newline = false

Make prompt a single line instead of two lines

[line_break]
disabled = true

Replace the "โฏ" symbol in the prompt with "โžœ"

[character] # The name of the module we are configuring is "character"
success_symbol = "[โžœ](bold green)" # The "success_symbol" is set to "โžœ" with color "bold green"

Use custom format

format = """
[โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€>](bold green)
[โ”‚](bold green)$directory$rust$package
[โ””โ”€>](bold green) """

[battery]
full_symbol = "๐Ÿ”‹"
charging_symbol = "๐Ÿ”Œ"
discharging_symbol = "โšก"

[[battery.display]]
threshold = 30
style = "bold red"

#[character]
#error_symbol = "[โœ–](bold red)"

[cmd_duration]
min_time = 10_000 # Show command duration over 10,000 milliseconds (=10 sec)
format = " took $duration"

[directory]
truncation_length = 5
format = "$path$lock_symbol "

[git_branch]
format = " $symbol$branch "
symbol = "๐Ÿฃ "
style = "bold yellow"

[git_commit]
commit_hash_length = 8
style = "bold white"

[git_state]
format = '($state( $progress_current of $progress_total)) '

[git_status]
conflicted = "โš”๏ธ "
ahead = "๐ŸŽ๏ธ ๐Ÿ’จ ร—${count}"
behind = "๐Ÿข ร—${count}"
diverged = "๐Ÿ”ฑ ๐ŸŽ๏ธ ๐Ÿ’จ ร—${ahead_count} ๐Ÿข ร—${behind_count}"
untracked = "๐Ÿ›ค๏ธ ร—${count}"
stashed = "๐Ÿ“ฆ "
modified = "๐Ÿ“ ร—${count}"
staged = "๐Ÿ—ƒ๏ธ ร—${count}"
renamed = "๐Ÿ“› ร—${count}"
deleted = "๐Ÿ—‘๏ธ ร—${count}"
style = "bright-white"
format = "$all_status$ahead_behind"

[hostname]
ssh_only = false
format = "<$hostname>"
trim_at = "-"
style = "bold dimmed white"
disabled = true

[julia]
format = "$symbol$version "
symbol = "เฎƒ "
style = "bold green"

[memory_usage]
format = "$symbol${ram}( | ${swap}) "
threshold = 70
style = "bold dimmed white"
disabled = false

[package]
disabled = true

[python]
format = "$symbol$version "
style = "bold green"

[rust]
format = "$symbol$version "
style = "bold green"

[time]
time_format = "%a, %b %d, %Y | %I:%M%P ๏ธ"
format = "$time($style) "
style = "bright-white"
disabled = false

[username]
style_user = "bold dimmed blue"
show_always = false

@nazibalalam
Copy link

Those comments weren't necessary, you could've just pasted the file within 3 backticks, that would've been better. So I suppose that everything is written as-is in ur message, but just without those comments?

@Kjvthomas
Copy link

Those comments weren't necessary, you could've just pasted the file within 3 backticks, that would've been better. So I suppose that everything is written as-is in ur message, but just without those comments?

Yeahโ€ฆ. Iโ€™m sorry about that. I literally pasted the config. Iโ€™m new to GitHub please pardon me

@nazibalalam
Copy link

Ok no problem, just post it again without any modifications

@Kjvthomas
Copy link

Ok no problem, just post it again without any modifications

Itโ€™s literally the raw config posted above if that helps.

@nazibalalam
Copy link

Try taking the error_symbol part up to the [character] module on line 7. Most likely the problem was because you put the [character] module on 2 different places.

@Kjvthomas
Copy link

Try taking the error_symbol part up to the [character] module on line 7. Most likely the problem was because you put the [character] module on 2 different places.

fixed thanks!

@HarshalRathore
Copy link

HarshalRathore commented Oct 23, 2021

I have copied the same config as here in my ~/.config/starship.toxl but my terminal (alacritty) is not redering few symbols / icons / emojis correctly there is small square box in there place which means the symbols were not rendered correctly as far as I know. So what font modules do I have to download for these to work correctly. Currently I have these fonts

 Comfortaa-Regular.ttf               FiraCode-Medium.ttf                        iosevka_nerd_font.ttf
 Comfortaa-VariableFont_wght.ttf     Fira_Code_Regular_Nerd_Font_Complete.ttf  'System San Francisco Display Bold.ttf'
 Fantasque-Sans-Mono-Nerd-Font.ttf   FiraCode-Regular.ttf                      'System San Francisco Display Regular.ttf'
 Feather.ttf                         FiraCode-Retina.ttf                       'System San Francisco Display Thin.ttf'
 FiraCode-Bold.ttf                   FiraCode-SemiBold.ttf                     'System San Francisco Display Ultralight.ttf'```
in my ~/.local/share/fonts/

@nazibalalam
Copy link

@HarshalRathore You should use a nerd font in your alacritty, you have to have a nerd font installed (seems like you already have) and then you have to use that nerd font in your alacritty config. By the way what do you mean by a "small square box"?

@HarshalRathore
Copy link

@nazibalalam
I meant this
How my alacritty looks
Wednesday 27 October 2021 12:42:42 PM IST
And how my kitty looks
Wednesday 27 October 2021 12:42:54 PM IST

@k2s09
Copy link

k2s09 commented Nov 7, 2021

@HarshalRathore AFAIK, alacritty does not have proper ligature support. Kitty does and thus it works as expected.

@nazibalalam
Copy link

nazibalalam commented Nov 10, 2021

@HarshalRathore install the alacritty-ligatures package and see if it's fixed.
Edit: Sorry for the long delay! ๐Ÿ™

@pedoc
Copy link

pedoc commented Mar 25, 2022

Is it possible to display the full path of the current working directory?
If you use $directory only the last directory name will be displayed.

@jlcastrogro
Copy link

Is it possible to display the full path of the current working directory? If you use $directory only the last directory name will be displayed.

You can add to the config file:

[directory]
truncation_length = 0

@NormTurtle
Copy link

ayo anyone . i want my starship something like this what i put for that smiling face?

https://i.redd.it/zxuhsf790in91.png

@deepanchal
Copy link

Just wanted to share my organized starship config here if anyone is interested
https://gist.github.com/deepanchal/415e78646aaf5e57e10490d01ad90109

Here is what it looks like:
image

@avizyt
Copy link

avizyt commented Apr 8, 2023

How to change the region value of the prompt?

@deepanchal
Copy link

deepanchal commented Apr 8, 2023

@avizyt

How to change the region value of the prompt?

From starship docs:

The aws module shows the current AWS region and profile and an expiration timer when using temporary credentials. The output of the module uses the AWS_REGION, AWS_DEFAULT_REGION, and AWS_PROFILE env vars and the ~/.aws/config and ~/.aws/credentials files as required.

I have a default region set in my ~/.aws/config

# example config

[default]
sso_session = my-sso
sso_account_id = 111122223333
sso_role_name = readOnly
region = us-west-2 # <-- starship uses this
output = text

[profile user1]
sso_session = my-sso
sso_account_id = 444455556666
sso_role_name = readOnly
region = us-east-1
output = json

[sso-session my-sso]
sso_region = us-east-1
sso_start_url = https://my-sso-portal.awsapps.com/start
sso_registration_scopes = sso:account:access

Check this out for more details: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html

@deepanchal
Copy link

@omaru-ok

ayo anyone . i want my starship something like this what i put for that smiling face?

i.redd.it/zxuhsf790in91.png

Adding this to your starship config (~/.config/starship.toml) should give you :) / :( in your prompt.

[character]
success_symbol = '[:\)](green)' # The 'success_symbol' segment is being set to ':)' with the color 'green'
error_symbol = '[:\(](red)' # The 'error_symbol' segment is being set to ':(' with the color 'red'

image

@NormTurtle
Copy link

damn

@avizyt
Copy link

avizyt commented Apr 18, 2023

@avizyt

How to change the region value of the prompt?

From starship docs:

The aws module shows the current AWS region and profile and an expiration timer when using temporary credentials. The output of the module uses the AWS_REGION, AWS_DEFAULT_REGION, and AWS_PROFILE env vars and the ~/.aws/config and ~/.aws/credentials files as required.

I have a default region set in my ~/.aws/config

# example config

[default]
sso_session = my-sso
sso_account_id = 111122223333
sso_role_name = readOnly
region = us-west-2 # <-- starship uses this
output = text

[profile user1]
sso_session = my-sso
sso_account_id = 444455556666
sso_role_name = readOnly
region = us-east-1
output = json

[sso-session my-sso]
sso_region = us-east-1
sso_start_url = https://my-sso-portal.awsapps.com/start
sso_registration_scopes = sso:account:access

Check this out for more details: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html

Thank you.

@SanjidChowdhury
Copy link

SanjidChowdhury commented Aug 19, 2023

Hi, how can i make it so that my directory shows like "Dashboard > resources" instead of "Dashboard/resources"? I am using the nerd-font-symbols preset. Also, as this is in VSCode, I want to show the full directory to "Dashboard". Putting the code in the config below does not work.

[directory]
truncation_length = 0
read_only = " ๓ฐŒพ"

image

@muscaiu
Copy link

muscaiu commented Nov 18, 2023

[nodejs] format = 'via [๐Ÿค– $version](bold green) '

it will show the git status, but not the Node version

Any idea why?

Screenshot 2023-11-18 at 16 07 55

@plsnotracking
Copy link

Hi,

Thank you for sharing this, I'm pretty new to starship. I've moved from basic .zsh terminal to starship.

I wanted to port my .zshrc configuration to starship, couldn't find proper documentation to follow.

Kind of looking for equivalents of doing aliases. For example:

## cat
alias bat='bat --theme=ansi-dark'
command -v bat > /dev/null && alias cat='bat --pager=never'

## du
command -v dust > /dev/null && alias du='dust'

## find
command -v fd > /dev/null && alias find='fd'

## fzf
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

## git aliases and functions
source $HOME/.config/zsh/git.zsh

## history
source $HOME/.config/zsh/history.zsh

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment