diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..41b2d3a8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +* text=auto +*.zsh text eol=lf +*.zsh-theme text eol=lf +/prompt_powerlevel9k_setup text eol=lf +/prompt_powerlevel10k_setup text eol=lf diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index 5f1424ab..9113fd2f 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -65,6 +65,7 @@ context # user@hostname nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) ranger # ranger shell (https://github.com/ranger/ranger) + vi_mode # vi mode (you don't need this if you've enabled prompt_char) # vpn_ip # virtual private network indicator # ram # free RAM # load # CPU load @@ -512,6 +513,23 @@ # Custom icon. # typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐' + ###########[ vi_mode: vi mode (you don't need this if you've enabled prompt_char) ]########### + # Text and color for normal (a.k.a. command) vi mode. + typeset -g POWERLEVEL9K_VI_COMMAND_MODE_STRING=NORMAL + typeset -g POWERLEVEL9K_VI_MODE_NORMAL_FOREGROUND=106 + # Text and color for visual vi mode. + typeset -g POWERLEVEL9K_VI_VISUAL_MODE_STRING=VISUAL + typeset -g POWERLEVEL9K_VI_MODE_VISUAL_FOREGROUND=68 + # Text and color for overtype (a.k.a. overwrite and replace) vi mode. + typeset -g POWERLEVEL9K_VI_OVERWRITE_MODE_STRING=OVERTYPE + typeset -g POWERLEVEL9K_VI_MODE_OVERWRITE_FOREGROUND=172 + # Text and color for insert vi mode. + typeset -g POWERLEVEL9K_VI_INSERT_MODE_STRING= + typeset -g POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND=66 + + # Custom icon. + # typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐' + ######################################[ ram: free RAM ]####################################### # RAM color. typeset -g POWERLEVEL9K_RAM_FOREGROUND=66 diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh index c1e70030..1aadec92 100644 --- a/config/p10k-rainbow.zsh +++ b/config/p10k-rainbow.zsh @@ -65,6 +65,7 @@ context # user@hostname nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) ranger # ranger shell (https://github.com/ranger/ranger) + vi_mode # vi mode (you don't need this if you've enabled prompt_char) # vpn_ip # virtual private network indicator # ram # free RAM # load # CPU load @@ -511,6 +512,22 @@ # Custom icon. # typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐' + ###########[ vi_mode: vi mode (you don't need this if you've enabled prompt_char) ]########### + # Foreground color. + typeset -g POWERLEVEL9K_VI_MODE_FOREGROUND=0 + # Text and color for normal (a.k.a. command) vi mode. + typeset -g POWERLEVEL9K_VI_COMMAND_MODE_STRING=NORMAL + typeset -g POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND=2 + # Text and color for visual vi mode. + typeset -g POWERLEVEL9K_VI_VISUAL_MODE_STRING=VISUAL + typeset -g POWERLEVEL9K_VI_MODE_VISUAL_BACKGROUND=4 + # Text and color for overtype (a.k.a. overwrite and replace) vi mode. + typeset -g POWERLEVEL9K_VI_OVERWRITE_MODE_STRING=OVERTYPE + typeset -g POWERLEVEL9K_VI_MODE_OVERWRITE_BACKGROUND=3 + # Text and color for insert vi mode. + typeset -g POWERLEVEL9K_VI_INSERT_MODE_STRING= + typeset -g POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND=8 + ######################################[ ram: free RAM ]####################################### # RAM color. # typeset -g POWERLEVEL9K_RAM_FOREGROUND=0 diff --git a/gitstatus/bin/gitstatusd-android-aarch64 b/gitstatus/bin/gitstatusd-android-aarch64 index e9b22e72..cdea703e 100755 Binary files a/gitstatus/bin/gitstatusd-android-aarch64 and b/gitstatus/bin/gitstatusd-android-aarch64 differ diff --git a/gitstatus/bin/gitstatusd-cygwin_nt-10.0-x86_64 b/gitstatus/bin/gitstatusd-cygwin_nt-10.0-x86_64 index a1baa948..0568ca78 100755 Binary files a/gitstatus/bin/gitstatusd-cygwin_nt-10.0-x86_64 and b/gitstatus/bin/gitstatusd-cygwin_nt-10.0-x86_64 differ diff --git a/gitstatus/bin/gitstatusd-darwin-x86_64 b/gitstatus/bin/gitstatusd-darwin-x86_64 index dab60fc7..17b0ddcf 100755 Binary files a/gitstatus/bin/gitstatusd-darwin-x86_64 and b/gitstatus/bin/gitstatusd-darwin-x86_64 differ diff --git a/gitstatus/bin/gitstatusd-freebsd-amd64 b/gitstatus/bin/gitstatusd-freebsd-amd64 index de7e0f24..f164a48e 100755 Binary files a/gitstatus/bin/gitstatusd-freebsd-amd64 and b/gitstatus/bin/gitstatusd-freebsd-amd64 differ diff --git a/gitstatus/bin/gitstatusd-linux-aarch64 b/gitstatus/bin/gitstatusd-linux-aarch64 index b99ecfee..af762125 100755 Binary files a/gitstatus/bin/gitstatusd-linux-aarch64 and b/gitstatus/bin/gitstatusd-linux-aarch64 differ diff --git a/gitstatus/bin/gitstatusd-linux-armv7l b/gitstatus/bin/gitstatusd-linux-armv7l index 3d301aa9..bef8cc66 100755 Binary files a/gitstatus/bin/gitstatusd-linux-armv7l and b/gitstatus/bin/gitstatusd-linux-armv7l differ diff --git a/gitstatus/bin/gitstatusd-linux-x86_64 b/gitstatus/bin/gitstatusd-linux-x86_64 index 5538aa05..8f10274d 100755 Binary files a/gitstatus/bin/gitstatusd-linux-x86_64 and b/gitstatus/bin/gitstatusd-linux-x86_64 differ diff --git a/gitstatus/bin/gitstatusd-linux-x86_64-static b/gitstatus/bin/gitstatusd-linux-x86_64-static index b561edd9..46466532 100755 Binary files a/gitstatus/bin/gitstatusd-linux-x86_64-static and b/gitstatus/bin/gitstatusd-linux-x86_64-static differ diff --git a/gitstatus/bin/gitstatusd-msys_nt-10.0-x86_64 b/gitstatus/bin/gitstatusd-msys_nt-10.0-x86_64 new file mode 100755 index 00000000..f74138e3 Binary files /dev/null and b/gitstatus/bin/gitstatusd-msys_nt-10.0-x86_64 differ diff --git a/gitstatus/gitstatus.plugin.zsh b/gitstatus/gitstatus.plugin.zsh index d64421db..e8e8d624 100644 --- a/gitstatus/gitstatus.plugin.zsh +++ b/gitstatus/gitstatus.plugin.zsh @@ -273,10 +273,19 @@ function _gitstatus_process_response() { # -d INT Report at most this many untracked files; negative value means infinity. # Defaults to 1. # -# -m INT If a repo has more files in its index than this, override -u and -d (but not -s) -# with zeros. Negative value means infinity. Defaults to -1. +# -m INT Report -1 unstaged, untracked and conflicted if there are more than this many +# files in the index. Negative value means infinity. Defaults to -1. # # -e Count files within untracked directories like `git status --untracked-files`. +# +# -U Unless this option is specified, report zero untracked files for repositories +# with status.showUntrackedFiles = false. +# +# -W Unless this option is specified, report zero untracked files for repositories +# with bash.showUntrackedFiles = false. +# +# -D Unless this option is specified, report zero staged, unstaged and conflicted +# changes for repositories with bash.showDirtyState = false. function gitstatus_start() { emulate -L zsh setopt err_return no_unset no_bg_nice @@ -289,9 +298,9 @@ function gitstatus_start() { local -i max_num_untracked=1 local -i dirty_max_index_size=-1 local -i async - local recurse_untracked_dirs + local -a extra_flags=() while true; do - getopts "t:s:u:c:d:m:ea" opt || break + getopts "t:s:u:c:d:m:eaUWD" opt || break case $opt in a) async=1;; t) timeout=$OPTARG;; @@ -300,8 +309,14 @@ function gitstatus_start() { c) max_num_conflicted=$OPTARG;; d) max_num_untracked=$OPTARG;; m) dirty_max_index_size=$OPTARG;; - e) recurse_untracked_dirs='--recurse-untracked-dirs';; - +e) recurse_untracked_dirs=;; + e) extra_flags+='--recurse-untracked-dirs';; + +e) extra_flags=(${(@)extra_flags:#--recurse-untracked-dirs});; + U) extra_flags+='--ignore-status-show-untracked-files';; + +U) extra_flags=(${(@)extra_flags:#--ignore-status-show-untracked-files});; + W) extra_flags+='--ignore-bash-show-untracked-files';; + +W) extra_flags=(${(@)extra_flags:#--ignore-bash-show-untracked-files});; + D) extra_flags+='--ignore-bash-show-dirty-state';; + +D) extra_flags=(${(@)extra_flags:#--ignore-bash-show-dirty-state});; ?) return 1;; esac done @@ -346,6 +361,7 @@ function gitstatus_start() { [[ -n $daemon ]] || { os="$(uname -s)" && [[ -n $os ]] [[ $os != Linux || "$(uname -o)" != Android ]] || os=Android + [[ $os != (MINGW64_NT-10.0|MSYS_NT-10.0-*) ]] || os=MSYS_NT-10.0 local arch && arch="$(uname -m)" && [[ -n $arch ]] daemon=$_gitstatus_plugin_dir/bin/gitstatusd-${os:l}-${arch:l} } @@ -380,7 +396,7 @@ function gitstatus_start() { --max-num-untracked=${(q)max_num_untracked} --dirty-max-index-size=${(q)dirty_max_index_size} --log-level=${(q)log_level:-INFO} - $recurse_untracked_dirs) + $extra_flags) local cmd=" exec >&4 diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 3d990e58..243ab560 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -3432,6 +3432,8 @@ function _p9k_set_iface() { function _p9k_build_segment() { _p9k_segment_name=${_p9k_segment_name%_joined} + local disabled=POWERLEVEL9K_${(U)_p9k_segment_name}_DISABLED_DIR_PATTERN + [[ $_p9k_pwd == ${(P)~disabled} ]] && return if [[ $_p9k_segment_name == custom_* ]]; then _p9k_custom_prompt $_p9k_segment_name[8,-1] elif (( $+functions[prompt_$_p9k_segment_name] )); then @@ -3442,6 +3444,8 @@ function _p9k_build_segment() { function _p9k_build_instant_segment() { _p9k_segment_name=${_p9k_segment_name%_joined} + local disabled=POWERLEVEL9K_${(U)_p9k_segment_name}_DISABLED_DIR_PATTERN + [[ $_p9k_pwd == ${(P)~disabled} ]] && return if (( $+functions[instant_prompt_$_p9k_segment_name] )); then local -i len=$#_p9k__prompt _p9k_non_hermetic_expansion=0 @@ -5428,7 +5432,13 @@ _p9k_init_vcs() { local daemon=${GITSTATUS_DAEMON} if [[ -z $daemon ]]; then daemon=$gitstatus_dir/bin/gitstatusd- - [[ $_p9k_uname_o == Android ]] && daemon+=android || daemon+=${_p9k_uname:l} + if [[ $_p9k_uname_o == Android ]]; then + daemon+=android + elif [[ $_p9k_uname == (MINGW_64-10.0|MSYS_NT-10.0-*) ]]; then + daemon+=msys_nt-10.0 + else + daemon+=${_p9k_uname:l} + fi daemon+=-${_p9k_uname_m:l} fi local -i threads=${GITSTATUS_NUM_THREADS:-0} diff --git a/internal/wizard.zsh b/internal/wizard.zsh index 4f11ef68..1700c898 100755 --- a/internal/wizard.zsh +++ b/internal/wizard.zsh @@ -1368,8 +1368,8 @@ function ask_zshrc_edit() { cp -p $__p9k_zshrc $zshrc_backup || quit -c print -r -- $zshrc_content >$zshrc_backup || quit -c zshrc_backup_u=${${TMPDIR:+\$TMPDIR}:-/tmp}/${(q-)zshrc_backup:t} - break fi + break ;; esac done @@ -1538,12 +1538,19 @@ function generate_config() { sub MULTILINE_FIRST_PROMPT_PREFIX '' sub MULTILINE_NEWLINE_PROMPT_PREFIX '' sub MULTILINE_LAST_PROMPT_PREFIX '' - uncomment prompt_char sub STATUS_OK false sub STATUS_ERROR false fi fi + if [[ $style == (classic|rainbow) ]]; then + if (( num_lines == 2 && ! left_frame )); then + uncomment prompt_char + else + uncomment vi_mode + fi + fi + (( empty_line )) && sub PROMPT_ADD_NEWLINE true || sub PROMPT_ADD_NEWLINE false sub INSTANT_PROMPT $instant_prompt