Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add starship #7

Merged
merged 6 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion env/linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ cd -

# rust
install_rust
install_rust_cmds lsd zoxide bat killport joshuto
install_rust_cmds lsd zoxide starship bat killport joshuto
install_rust_special_cmd rg ripgrep
install_rust_special_cmd fd fd-find
install_rust_special_cmd sk skim
Expand Down
2 changes: 1 addition & 1 deletion env/mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ brew install lsd
## need change iterm font
brew tap homebrew/cask-fonts && brew install font-hack-nerd-font

brew install zoxide fzf
brew install zoxide fzf starship

# brew install mysql

Expand Down
1 change: 1 addition & 0 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ if [[ -L nvim ]]; then
rm nvim
fi
ln -sf $dot/vim/packer nvim
ln -sf $dot/zsh/starship.toml starship.toml

p=".docker"
[[ ! -d $p ]] && mkdir $p
Expand Down
100 changes: 100 additions & 0 deletions zsh/starship.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# doc: https://starship.rs/config/

format = """
$directory\
$git_branch\
$git_commit\
$git_state\
$git_metrics\
$git_status\
$env_var\
$custom\
$line_break\
$status\
$character"""

right_format = """
$username\
$hostname\
$cmd_duration\
$golang\
$python\
$rust\
$package\
$c\
$jobs\
$time\
"""

add_newline = false

[character]
format = ''

[directory]
style = "green"
read_only = " 󰌾"
truncation_length = 1 # the number of parent folders that the current directory should be truncated to.

[git_branch]
# symbol = " "
symbol = ""
format = '[\($branch\)](bold blue) '

# +-的行数
[git_metrics]
disabled = true

# info 与 character 之间是否换行
[line_break]
disabled = true

# status of last cmd, i.e. echo $?
[status]
disabled = false

[username]
style_user = 'green'
format = '$user'
show_always = true

[hostname]
ssh_symbol = " "
format = '@$hostname '
ssh_only = false

[localip]
disabled = false
style = 'green'

[os.symbols]
Macos = " "
Ubuntu = " "
Debian = " "
Redhat = " "
Linux = " "
Unknown = " "
Windows = "󰍲 "

[shell]
disabled = true

[c]
symbol = " "

[golang]
symbol = ""
format = 'Go$version '

[python]
symbol = " "

[rust]
symbol = "󱘗 "

[package]
symbol = "󰏗 "

[time]
disabled = false
format = '$time'
11 changes: 9 additions & 2 deletions zsh/zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,15 @@ fi

export TERM=xterm-256color
export LANG=en_US.UTF-8
export PS1='%(!.%{$fg[red]%}.%{$fg[green]%})%1~%{$fg_bold[blue]%}$(git_prompt_info)%{$reset_color%} '
export RPROMPT='%n@%m %*'

which starship >/dev/null
if [[ $? -eq 0 ]]; then
eval "$(starship init zsh)"
else
export PS1='%(!.%{$fg[red]%}.%{$fg[green]%})%1~%{$fg_bold[blue]%}$(git_prompt_info)%{$reset_color%} '
export RPROMPT='%n@%m %*'
fi


setopt vi
setopt NO_HUP
Expand Down
Loading