mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-24 21:20:07 +00:00
Merge commit '0717e57ff46201ff04e7d62cda8677e174a83be6'
This commit is contained in:
commit
5e5d3f5aff
4 changed files with 15 additions and 13 deletions
|
@ -103,9 +103,9 @@ function my_set_prompt() {
|
||||||
|
|
||||||
if gitstatus_query MY && [[ $VCS_STATUS_RESULT == ok-sync ]]; then
|
if gitstatus_query MY && [[ $VCS_STATUS_RESULT == ok-sync ]]; then
|
||||||
RPROMPT=${${VCS_STATUS_LOCAL_BRANCH:-@${VCS_STATUS_COMMIT}}//\%/%%} # escape %
|
RPROMPT=${${VCS_STATUS_LOCAL_BRANCH:-@${VCS_STATUS_COMMIT}}//\%/%%} # escape %
|
||||||
(( $VCS_STATUS_NUM_STAGED )) && RPROMPT+='+'
|
(( VCS_STATUS_NUM_STAGED )) && RPROMPT+='+'
|
||||||
(( $VCS_STATUS_NUM_UNSTAGED )) && RPROMPT+='!'
|
(( VCS_STATUS_NUM_UNSTAGED )) && RPROMPT+='!'
|
||||||
(( $VCS_STATUS_NUM_UNTRACKED )) && RPROMPT+='?'
|
(( VCS_STATUS_NUM_UNTRACKED )) && RPROMPT+='?'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
setopt no_prompt_{bang,subst} prompt_percent # enable/disable correct prompt expansions
|
setopt no_prompt_{bang,subst} prompt_percent # enable/disable correct prompt expansions
|
||||||
|
@ -204,9 +204,9 @@ function my_set_prompt() {
|
||||||
else
|
else
|
||||||
PS1+=" @${VCS_STATUS_COMMIT//\\/\\\\}" # escape backslash
|
PS1+=" @${VCS_STATUS_COMMIT//\\/\\\\}" # escape backslash
|
||||||
fi
|
fi
|
||||||
[[ "$VCS_STATUS_HAS_STAGED" == 1 ]] && PS1+='+'
|
(( VCS_STATUS_HAS_STAGED" )) && PS1+='+'
|
||||||
[[ "$VCS_STATUS_HAS_UNSTAGED" == 1 ]] && PS1+='!'
|
(( VCS_STATUS_HAS_UNSTAGED" )) && PS1+='!'
|
||||||
[[ "$VCS_STATUS_HAS_UNTRACKED" == 1 ]] && PS1+='?'
|
(( VCS_STATUS_HAS_UNTRACKED" )) && PS1+='?'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PS1+='\n\$ '
|
PS1+='\n\$ '
|
||||||
|
|
|
@ -94,7 +94,7 @@ shopt -s promptvars
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
#
|
#
|
||||||
# user@host ~/projects/skynet master+!
|
# user@host ~/projects/skynet master ⇡42
|
||||||
# $ █
|
# $ █
|
||||||
PS1='\[\033[01;32m\]\u@\h\[\033[00m\] ' # green user@host
|
PS1='\[\033[01;32m\]\u@\h\[\033[00m\] ' # green user@host
|
||||||
PS1+='\[\033[01;34m\]\w\[\033[00m\]' # blue current working directory
|
PS1+='\[\033[01;34m\]\w\[\033[00m\]' # blue current working directory
|
||||||
|
|
|
@ -131,7 +131,7 @@ END
|
||||||
>&2 echo "[gitstatus] error: GITSTATUS_DAEMON is not absolute path: $daemon"
|
>&2 echo "[gitstatus] error: GITSTATUS_DAEMON is not absolute path: $daemon"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if [ -z "$daemon" && -e "$gitstatus_dir"/usrbin/gitstatusd ]; then
|
if [ -z "$daemon" -a -e "$gitstatus_dir"/usrbin/gitstatusd ]; then
|
||||||
daemon="$gitstatus_dir"/usrbin/gitstatusd
|
daemon="$gitstatus_dir"/usrbin/gitstatusd
|
||||||
fi
|
fi
|
||||||
if [ -n "$daemon" ]; then
|
if [ -n "$daemon" ]; then
|
||||||
|
|
|
@ -116,16 +116,18 @@ bool ListDir(int dir_fd, Arena& arena, std::vector<char*>& entries, bool precomp
|
||||||
entries.clear();
|
entries.clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (n == 0) break;
|
|
||||||
for (int pos = 0; pos < n;) {
|
for (int pos = 0; pos < n;) {
|
||||||
auto* ent = reinterpret_cast<linux_dirent64*>(buf + pos);
|
auto* ent = reinterpret_cast<linux_dirent64*>(buf + pos);
|
||||||
if (!Dots(ent->d_name)) entries.push_back(ent->d_name);
|
if (!Dots(ent->d_name)) entries.push_back(ent->d_name);
|
||||||
pos += ent->d_reclen;
|
pos += ent->d_reclen;
|
||||||
// It's tempting to bail here if n + sizeof(linux_dirent64) + 512 <= n. After all, there
|
|
||||||
// was enough space for another entry but SYS_getdents64 didn't write it, so this must be
|
|
||||||
// the end of the directory listing, right? Unfortuatenly, no. SYS_getdents64 is finicky.
|
|
||||||
// It sometimes writes a partial list of entries even if the full list would fit.
|
|
||||||
}
|
}
|
||||||
|
if (n == 0) break;
|
||||||
|
// The following optimization relies on SYS_getdents64 always returning as many
|
||||||
|
// entries as would fit. This is not guaranteed by the specification and I don't
|
||||||
|
// know if this is true in practice. The optimization has no measurable effect on
|
||||||
|
// gitstatus performance, so it's turned off.
|
||||||
|
//
|
||||||
|
// if (n + sizeof(linux_dirent64) + 512 <= kBufSize) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (case_sensitive) {
|
if (case_sensitive) {
|
||||||
|
|
Loading…
Reference in a new issue