Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 149777 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^3 gentoo prompt
prompt_gentoo_setup (text/plain), 3.31 KB, created by
Leonardo Valeri Manera
on 2008-04-15 08:24:31 UTC
(
hide
)
Description:
A better^3 gentoo prompt
Filename:
MIME Type:
Creator:
Leonardo Valeri Manera
Created:
2008-04-15 08:24:31 UTC
Size:
3.31 KB
patch
obsolete
># -*- mode: sh; -*- ># gentoo prompt theme > >prompt_gentoo_help () { > cat <<'EOF' >This prompt is configurable via styles: > > Context: :gentoo:prompt > > 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. > > Clipped path indicator: > cut-string - the string to prepend to a clipped path. defaults to '..' > > 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_temp p_done i > local maxlength ratio > local cut_string > local prompt_color > local user_color > local root_color > local path_style > local base_prompt post_prompt path_prompt > > 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 > > zstyle -s :gentoo:prompt cut-string cut_string > cut_string=${cut_string:-..} > > case ${path_style} in > full) > path_prompt=$(print -P %~) > ;; > subdir) > path_prompt=$(print -P "%($(( ${maxlength} + 1 ))~|${cut_string}|)%${maxlength}~") > ;; > ratio|fixed) > p_done=$(print -P %~) > if (( ${#p_done} > ${maxlength} )); then > for (( i=1 ; ; ++i )); do > p_temp=$(print -P %${i}~) > if (( ( ${#p_temp} + ${#cut_string} ) < ${maxlength} )); then > p_done=${cut_string}${p_temp} > elif (( ${i} == 1 )); then > p_done=${cut_string}${p_temp} > break > else > break > fi > done > fi > path_prompt=${p_done} > ;; > esac > > 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