1
0
raylu 1 жил өмнө
parent
commit
335c0198ae
2 өөрчлөгдсөн 108 нэмэгдсэн , 21 устгасан
  1. 83 0
      config/starship.toml
  2. 25 21
      zshrc

+ 83 - 0
config/starship.toml

@@ -0,0 +1,83 @@
+format = """
+[](#065555)\
+$hostname\
+$username\
+[](bg:#334A77 fg:#065555)\
+$directory\
+[](fg:#334A77 bg:#775570)\
+$git_branch\
+$git_state\
+$git_status\
+[](fg:#775570 bg:#86BBD8)\
+$status\
+$cmd_duration\
+[](fg:#86BBD8 bg:#773477)\
+$shlvl\
+$jobs\
+[](fg:#773477 bg:#225560)\
+$time\
+[ ](fg:#225560)\
+$line_break\
+\\$ 
+"""
+
+add_newline = true
+
+[hostname]
+style = 'bg:#065555'
+format = '[$hostname ]($style)'
+
+[username]
+show_always = false
+style_user = 'bg:#065555'
+style_root = 'bg:#065555 fg:#FF5577 bold'
+format = '[$user ]($style)'
+
+[directory]
+style = 'bg:#334A77'
+format = "[ $path ]($style)"
+truncation_length = 5
+truncate_to_repo = false
+truncation_symbol = '…/'
+
+[git_branch]
+style = 'bg:#775570'
+format = '[ $branch ]($style)'
+
+[git_state]
+style = 'bg:#775570'
+format = '[\($state( $progress_current/$progress_total)\) ]($style)'
+
+[git_status]
+style = 'bg:#775570'
+format = '[$all_status$ahead_behind ]($style)'
+
+[status]
+disabled = false
+style = 'bg:#86BBD8 fg:#000000'
+pipestatus = true
+format = '[ $status( $signal_name) ]($style)'
+pipestatus_format = '[$pipestatus→ $int ]($style)'
+
+[cmd_duration]
+style = 'bg:#86BBD8 fg:#000000'
+show_milliseconds = true
+format = '[ $duration ]($style)'
+
+[shlvl]
+disabled = false
+format = '[ SHLVL:$shlvl ]($style)'
+style = 'bg:#773477'
+
+[jobs]
+format = '[ $symbol$number ]($style)'
+style = 'bg:#773477'
+
+[time]
+disabled = false
+time_format = '%R' # hour:minute
+style = 'bg:#225560 fg:#AAAAAA'
+format = '[ $time ]($style)'
+
+[line_break]
+disabled = false

+ 25 - 21
zshrc

@@ -43,27 +43,6 @@ bindkey '\C-v' edit-command-line
 bindkey '\Ea' push-line
 local WORDCHARS=${WORDCHARS//\//}\| # remove forward slash, add pipe
 
-autoload colors
-colors
-bright_cyan='%{%}' # not provided by colors
-autoload -Uz vcs_info
-zstyle ':vcs_info:*' unstagedstr "%{$fg[red]%}*"
-zstyle ':vcs_info:*' stagedstr "%{$fg[red]%}+"
-zstyle ':vcs_info:*' formats "$bright_cyan%b%u%c"
-zstyle ':vcs_info:*' actionformats "$bright_cyan%b%u%c|%a"
-zstyle ':vcs_info:git:*' check-for-changes true
-zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b:%r'
-zstyle ':vcs_info:bzr:*' use-simple true
-zstyle ':vcs_info:*' enable git hg bzr svn cvs
-precmd () { vcs_info }
-PROMPT="%{$fg_bold[grey]%}%* " # time
-PROMPT+="%{${fg_bold[green]}%}%m%{${reset_color}%}:" # host
-PROMPT+="%{${fg_bold[blue]}%}%50<...<%~%<<%{${reset_color}%} " # path
-PROMPT+='${vcs_info_msg_0_} '
-PROMPT+="%(?..%{$fg_bold[red]%}%? %{$reset_color%})" # exit status
-PROMPT+="%1(j.%{$fg[green]%}%j .)" # suspended jobs
-PROMPT+=$'%{$reset_color%} \n%(!.#.\$) '
-
 autoload -U url-quote-magic
 zle -N self-insert url-quote-magic
 
@@ -144,6 +123,31 @@ if [ -d $HOME/bin ]; then
 	PATH=$HOME/bin:$PATH
 fi
 
+if builtin which starship > /dev/null; then
+	eval "$(starship init zsh)"
+else
+	autoload colors
+	colors
+	bright_cyan='%{%}' # not provided by colors
+	autoload -Uz vcs_info
+	zstyle ':vcs_info:*' unstagedstr "%{$fg[red]%}*"
+	zstyle ':vcs_info:*' stagedstr "%{$fg[red]%}+"
+	zstyle ':vcs_info:*' formats "$bright_cyan%b%u%c"
+	zstyle ':vcs_info:*' actionformats "$bright_cyan%b%u%c|%a"
+	zstyle ':vcs_info:git:*' check-for-changes true
+	zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b:%r'
+	zstyle ':vcs_info:bzr:*' use-simple true
+	zstyle ':vcs_info:*' enable git hg bzr svn cvs
+	precmd () { vcs_info }
+	PROMPT="%{$fg_bold[grey]%}%* " # time
+	PROMPT+="%{${fg_bold[green]}%}%m%{${reset_color}%}:" # host
+	PROMPT+="%{${fg_bold[blue]}%}%50<...<%~%<<%{${reset_color}%} " # path
+	PROMPT+='${vcs_info_msg_0_} '
+	PROMPT+="%(?..%{$fg_bold[red]%}%? %{$reset_color%})" # exit status
+	PROMPT+="%1(j.%{$fg[green]%}%j .)" # suspended jobs
+	PROMPT+=$'%{$reset_color%} \n%(!.#.\$) '
+fi
+
 if [ -x /usr/bin/fzf ]; then
 	FZF_DEFAULT_OPTS='--no-mouse'
 	source "/usr/share/doc/fzf/examples/key-bindings.zsh"