Skip to content

Directory Permissions Segment for Zsh Prompts

License

Notifications You must be signed in to change notification settings

xPMo/zsh-prompt-dir-perms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Directory Permissions Segment for Zsh Prompts

Make sure to look at the Prompt Support and Configuration sections of this README.

Installation

Antigen:

antigen bundle xPMo/zsh-prompt-dir-perms
antigen apply

Zgen:

zgen load xPMo/zsh-prompt-dir-perms
zgen save

Zplug:

zplug xPMo/zsh-prompt-dir-perms

Zplugin:

zplugin ice wait "0"
zplugin light xPMo/zsh-prompt-dir-perms

Manually: Clone the project, and then source it:

source /path/to/zsh-prompt-dir-perms/prompt-dir-perms.plugin.zsh

Prompt Support

Powerlevel10k

For powerlevel10k, add the following to your .p10k.zsh:

typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
	... # segments you want before this segment
	dir_perms
	... # segments you want after this segment
)
function prompt_dir_perms () {
	local REPLY
	prompt_dir_perms::build
	p10k segment -t $REPLY
}
Geometry

For Geometry, add the following to your .zshrc:

GEOMETRY_PROMPT=(
	... # segments you want before this segment
	prompt_dir_perms
	... # segments you want after this segment
)
function prompt_dir_perms () {
	local REPLY
	prompt_dir_perms::build
	print -P -n $REPLY
}
Bullet Train

For Bullet Train, add the following to your .zshrc:

BULLETTRAIN_PROMPT_ORDER=(
	... # segments you want before this segment
	dir_perms
	... # segments you want after this segment
)
function prompt_dir_perms () {
	local REPLY
	prompt_dir_perms::build
	print -P -n $REPLY
}

Configuration

# Set the colors for each 'rwx' triplet
zstyle :prompt:dir-perms color user '%F{green}' group '%F{yellow}' other '%F{magenta}' default '%F{8}' attr '%F{white}'
# Format the results:
zstyle :prompt:dir-perms format '[%u%g%o%a]'