Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 148735 Details for
Bug 213627
app-shells/zsh - expand the default config
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
A better gentoo prompt
prompt_gentoo_setup (text/plain), 3.21 KB, created by
Leonardo Valeri Manera
on 2008-04-05 14:40:00 UTC
(
hide
)
Description:
A better gentoo prompt
Filename:
MIME Type:
Creator:
Leonardo Valeri Manera
Created:
2008-04-05 14:40:00 UTC
Size:
3.21 KB
patch
obsolete
># -*- mode: sh; -*- ># gentoo prompt theme > >prompt_gentoo_help () { > cat <<'EOF' >This prompt is configurable via styles: > > Context: :prompt:soor > > Colors (in zsh/terminfo value): > user-color - the color for user@host. defaults to 'green' > root-color - the color for the hostname for root. defaults to 'red' > prompt-color - the color for everything else. defaults to 'blue' > > Path type: > path - possible values: > ratio - use COLUMNS/ratio to clip the path. Default. > fixed - use a fixed maximum lenght. > subdir - clip by number of subdirectories. > full - show the full path > > Path lenght styles: > ratio - the ratio for the 'ratio' path style, funnily enough. > default to 6. > length - the maximin lenght for the 'fixed' path style. > defaults to 20 > subdir - the number of subdirs to show for the 'subdir' path style. > defaults to 3. > > You can set styles in the current terminal to test things out, values > will be updated. > >EOF >} > >prompt_gentoo_setup () { > setopt noxtrace localoptions > > precmd () { > > local p_full > local p_tchars p_temp p_done p_last > local maxlength ratio > local prompt_color > local user_color > local root_color > local path_style > > zstyle -s :gentoo:prompt prompt-color prompt_color > prompt_color=${prompt_color:-'blue'} > zstyle -s :gentoo:prompt user-color user_color > user_color=${user_color:-'green'} > zstyle -s :gentoo:prompt root-color root_color > root_color=${root_color:-'red'} > > [[ -z $(functions zsh/terminfo) ]] && autoload -Uz zsh/terminfo > > if [[ "$terminfo[colors]" -ge 8 ]]; then > if [[ "$EUID" = "0" ]] || [[ "$USER" = 'root' ]] > then > base_prompt="%{$fg_bold[$root_color]%}%m%{$fg_bold[$prompt_color]%} " > else > base_prompt="%{$fg_bold[$user_color]%}%n@%m%{$fg_bold[$prompt_color]%} " > fi > post_prompt="%{$reset_color%}" > else > base_prompt="%n@%m " > post_prompt="" > fi > > if zstyle -t :gentoo:prompt path full ratio fixed subdir; then > zstyle -s :gentoo:prompt path path_style > else > path_style='subdir' > fi > > case "${path_style}" in > ratio) > zstyle -s :gentoo:prompt ratio ratio > ratio=${ratio:-6} > maxlength=$(($COLUMNS/$ratio)) > ;; > fixed) > zstyle -s :gentoo:prompt length maxlength > maxlength=${maxlength:-20} > ;; > subdir) > zstyle -s :gentoo:prompt subdir maxlength > maxlength=${maxlength:-3} > ;; > esac > > case "${path_style}" in > full) > p_done="%~" > ;; > subdir) > p_done=$(print -P "%(4~|..|)%${maxlength}~") > ;; > ratio|fixed) > p_full=$(print -P %~) > if [[ ${#p_full} -le ${maxlength} ]]; then > p_done="${p_full}" > else > # I don't actually remember how this little snippet works. > # But it /does/, somehow, so I'm not touching it. > p_tchars='../' > for (( i=1 ; ; ++i )); do > p_temp="${p_tchars}$(print -P %${i}~)" > if [[ ${#p_temp} -gt ${maxlength} ]]; then > if [[ -n ${p_last} ]]; then > p_done="${p_last}" > else > p_done="${p_temp}" > fi > break > fi > p_last="${p_temp}" > done > fi > ;; > esac > > > path_prompt="${p_done}" > PS1="$base_prompt$path_prompt %# $post_prompt" > PS2="$base_prompt$path_prompt %_> $post_prompt" > PS3="$base_prompt$path_prompt ?# $post_prompt" > } > > preexec () { } >} > >prompt_gentoo_setup
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 213627
:
146343
|
148735
|
148737
|
148770
|
149777
|
406686
|
406688