Welcome, Guest. Please login or register.
+  Linux Soft Forum
|-+  Īnvaţă» Tips&Tricks» .zshrc colorat
[Picture 161] [Picture 160] [Picture 159]
Username:
Password:
 
Pages: [1]   Go Down
  Print  
Author Topic: .zshrc colorat  (Read 925 times)
0 Members and 1 Guest are viewing this topic.
mapleoin
Admini
**

mapleoin@jabber.org


WWW
« on: December 08, 2006, 10:08:27 PM »

dau un ping cui imi da cel mai frumos colorat .zshrc cu cel mai util/intersant prompt
Ideal ar fi un screenshot cu cat mai multe chestii colorate de vazut + .zshrc pus aici, daca nu e prea lung sau pe un pastebin sau unde credeti



.zshrc-ul meu actual arata asa:

Code:
# Lines configured by zsh-newuser-install
setopt extendedglob
unsetopt beep
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/oin/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall

deci are nevoie de imbunatatiri mari

Multumesc in avans
Si cu astea, let the games begin!  :cheers: Hai noroc
Logged

oblio
Admini
**


WWW
« Reply #1 on: December 08, 2006, 10:18:29 PM »

Presupun că ai făcut topicul ăsta pentru că ştii că nu mă pot abţine. Momentan am probleme cu istoria shell-ului, aşa că puteţi să scoateţi liniile acelea Smiley
Code:
# this terminal is compiled without UTF support
LANG=C

alias inst='sudo aptitude install -r'
alias remove='sudo aptitude remove'
alias purge='sudo aptitude remove --purge'
alias search='apt-cache search'
alias advsearch='aptitude search'
alias show='apt-cache show'
alias new='sudo apt-get update'
alias upgrade='sudo apt-get upgrade'
alias ls='ls --color=auto -F'
alias ll='ls -lh'
alias la='ls -A'
alias move='mv'
alias mv='mv -i'
alias grep='grep --color=always -n'
# turn on autocomplete
autoload -U compinit
compinit

# for extended history & only appending to it
HISTSIZE=100000
SAVEHIST=80000
HISTFILE='~/.zsh/history'

setopt HIST_IGNORE_DUPS
setopt HIST_REDUCE_BLANKS
setopt SHARE_HISTORY

# autocorrect
setopt CORRECT
setopt CORRECT_ALL

# use hashes for faster completion
setopt HASH_CMDS
setopt HASH_DIRS
setopt HASH_LIST_ALL

# use a cache for even faster completion
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache

# do not complete CVS and lost+found directories
zstyle ':completion:*:(all-|)files' ignored-patterns '(|*/)CVS'
zstyle ':completion:*:cd:*' ignored-patterns '(*/)#CVS'
zstyle ':completion:*:cd:*' ignored-patterns '(*/)#lost+found'

# do not complete commands I don't have
zstyle ':completion:*:functions' ignored-patterns '_*'

# ignore filenames already in the command line
zstyle ':completion:*:(rm|kill|diff):*' ignore-line yes

# fuzzy match - for autocorrecting 1 error
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric

# autocompletion for kill
zstyle ':completion:*:*:*:*:processes' menu yes select
zstyle ':completion:*:*:*:*:processes' force-list always

# load colored completion
zmodload zsh/complist

# colored completion
zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=36=31"

# this should set the prompt
function precmd {

    local TERMWIDTH
    (( TERMWIDTH = ${COLUMNS} - 1 ))


    ###
    # Truncate the path if it's too long.
   
    PR_FILLBAR=""
    PR_PWDLEN=""
   
    local promptsize=${#${(%):---(%n@%m:%l)---()--}}
    local pwdsize=${#${(%):-%~}}
   
    if [[ "$promptsize + $pwdsize" -gt $TERMWIDTH ]]; then
    ((PR_PWDLEN=$TERMWIDTH - $promptsize))
    else
PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $pwdsize)))..${PR_HBAR}.)}"
    fi
}


setopt extended_glob
preexec () {
    if [[ "$TERM" == "screen" ]]; then
local CMD=${1[(wr)^(*=*|sudo|-*)]}
echo -n "\ek$CMD\e\\"
    fi
}


setprompt () {
    ###
    # Need this so the prompt will work.

    setopt prompt_subst


    ###
    # See if we can use colors.

    autoload colors zsh/terminfo
    if [[ "$terminfo[colors]" -ge 8 ]]; then
colors
    fi
    for color in RED BLUE CYAN WHITE; do
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
(( count = $count + 1 ))
    done
    PR_NO_COLOUR="%{$terminfo[sgr0]%}"


    ###
    # See if we can use extended characters to look nicer.
   
    typeset -A altchar
    set -A altchar ${(s..)terminfo[acsc]}
    PR_SET_CHARSET="%{$terminfo[enacs]%}"
    PR_SHIFT_IN="%{$terminfo[smacs]%}"
    PR_SHIFT_OUT="%{$terminfo[rmacs]%}"
    #PR_HBAR=${altchar[q]:--}
    #PR_ULCORNER=${altchar[l]:--}
    #PR_LLCORNER=${altchar[m]:--}
    #PR_LRCORNER=${altchar[j]:--}
    #PR_URCORNER=${altchar[k]:--}

    PR_HBAR=--
    PR_ULCORNER=|
    PR_LLCORNER=|
    PR_LRCORNER=|
    PR_URCORNER=|
    ###
    # Finally, the prompt.

    PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
$PR_BLUE$PR_SHIFT_IN$PR_ULCORNER$PR_BLUE$PR_SHIFT_OUT(\
$PR_CYAN%(!.%SROOT%s.%n)$PR_CYAN@%m:%l\
$PR_BLUE)$PR_SHIFT_IN$PR_BLUE$PR_HBAR${(e)PR_FILLBAR}$PR_BLUE$PR_HBAR$PR_BLUE$PR_HBAR\
$PR_BLUE$PR_HBAR$PR_SHIFT_OUT($PR_CYAN%$PR_PWDLEN<...<%~%<<\
$PR_BLUE)$PR_SHIFT_IN$PR_BLUE$PR_URCORNER$PR_SHIFT_OUT\

$PR_BLUE$PR_SHIFT_IN$PR_LLCORNER$PR_BLUE$PR_SHIFT_OUT(\
%(?..$PR_LIGHT_RED%?$PR_BLUE:)\
$PR_CYAN%D{%H:%M}\
$PR_LIGHT_BLUE:%(!.$PR_RED.$PR_WHITE)%#$PR_BLUE)$PR_SHIFT_OUT\
$PR_SHIFT_OUT$PR_NO_COLOUR '

    RPROMPT=' $PR_BLUE$PR_SHIFT_IN$PR_BLUE$PR_SHIFT_OUT\
($PR_CYAN%D{%a,%b%d}$PR_BLUE)$PR_SHIFT_IN$PR_BLUE$PR_LRCORNER$PR_SHIFT_OUT$PR_NO_COLOUR'

    PS2='$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
$PR_BLUE$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT(\
$PR_LIGHT_GREEN%_$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
$PR_SHIFT_OUT$PR_NO_COLOUR '
}

setprompt
Chestia ciudată de la final e un prompt găsit pe net, simplificat şi aranjat un pic Smiley

Am impresia că pot īmprumuta şi de la tine nişte chestii :D Ranjeste fasolea
Logged

Distribuţie: ubuntu | Localitate: Bucureşti | Vārstă: 24

Oh! Everything has a point, and if it doesn't, then there's a point to it.

Oblio's
Licaon
Membru
*


« Reply #2 on: December 08, 2006, 11:53:04 PM »

poză ceva?
Logged

oblio
Admini
**


WWW
« Reply #3 on: December 08, 2006, 11:53:51 PM »

Pregătesc una mai specială. Īn care vreau să văd dacă-mi ghiceşte cineva vreo aplicaţie care se vede :D Ranjeste fasolea
Logged

Distribuţie: ubuntu | Localitate: Bucureşti | Vārstă: 24

Oh! Everything has a point, and if it doesn't, then there's a point to it.

Oblio's
aramdune
Guest
« Reply #4 on: December 31, 2006, 01:14:43 PM »

Al meu este extrem de simplu:

Code:
autoload -U compinit promptinit

compinit
promptinit
prompt off

zstyle ':completion::complete:*' use-cache 1

alias ls=ls\ -F\ --color


Am autocomplete avansat, culori la ls, afisare diferentiata la ls pentru fisiere, directoare etc, prompt default UNIX.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: