mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-11 00:00:06 +00:00
Merging @dritter's work to allow shortened dir segment.
This is PR #54. Merge remote-tracking branch 'dritter/dritter/shorten_dir_path'
This commit is contained in:
commit
20cb4a245e
2 changed files with 15 additions and 1 deletions
|
@ -260,6 +260,14 @@ elements (it is by default), and define a `DEFAULT_USER` in your `~/.zshrc`:
|
|||
|
||||
export DEFAULT_USER=<your username>
|
||||
|
||||
#### The `dir` segment
|
||||
|
||||
The `dir` segment shows the current working directory. You can limit the output
|
||||
to a certain length:
|
||||
|
||||
# Limit to the last two folders
|
||||
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
||||
|
||||
#### The 'time' segment
|
||||
|
||||
By default the time is show in 'H:M:S' format. If you want to change it,
|
||||
|
|
|
@ -443,7 +443,13 @@ prompt_context() {
|
|||
|
||||
# Dir: current working directory
|
||||
prompt_dir() {
|
||||
$1_prompt_segment "$0" "blue" "$DEFAULT_COLOR" '%~'
|
||||
local current_path='%~'
|
||||
if [[ -n "$POWERLEVEL9K_SHORTEN_DIR_LENGTH" ]]; then
|
||||
# shorten path to $POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
||||
current_path="%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:.../:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c"
|
||||
fi
|
||||
|
||||
$1_prompt_segment "$0" "blue" "$DEFAULT_COLOR" "$current_path"
|
||||
}
|
||||
|
||||
# Command number (in local history)
|
||||
|
|
Loading…
Reference in a new issue