Coloring Zsh

I have a lot of questions about coloring zsh. I've read a LOT about coloring zsh and simply can't grasp some of the concepts. Here is my current ~/.zshrc:
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt appendhistory autocd
unsetopt extendedglob
bindkey -e
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/clarence/.zshrc'
autoload -U colors && colors
autoload -U promptinit
autoload -Uz compinit
compinit
# End of lines added by compinstall
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
PROMPT="%{$fg[white]%}[%{$fg[blue]%}%n%{$fg[white]%}@%{$fg[white]%}%m %{$fg[white]%}%1~]$ "
Here is my goal: To be able to look at my ~/.zshrc and know exactly what all of it means and be able to manipulate it into using the 256-colors that I want.
I would like to be able to use a brighter blue for my name and some light/darker greys for some of the other parts but it seems I'm limited to simple colors and not 256-colors. From what I understand the "autoload -U colors && colors" section of my ~/.zshrc has something to do with the colors I am able to use. I would like to know how to be able to use colors like light blue and grey.
Another issue is that when I use nano on zsh the text is black and that doesn't work out very well since I have a black background :S I have the same problem with reading man pages. I would like to know how to change the colors for that text too.
If anyone can translate my ~/.zshrc and walk me through the steps of complete customization, I would be very thankful. Oh, I'm using urxvt too if that is of any count. Thanks in advance!
Edit: Removed the big picture.
Last edited by Clarence.e.a (2012-04-28 20:58:27)

I read on the wiki that most doesn't have a user-specific configuration file by default, and I did create that, I just copied the one from /usr/share/doc/most/most.rc to ~/, but the thing is that when I didn't have a ~/.mostrc I could see the effects, some orange/green/cyan text so I knew it was working and reading off of a system-wide config file, and it had a transparent background. Since I added the ~/.mostrc file it doesn't have a transparent background and it's kind of annoying. I wanted to look at the system-wide config file so I could see what they did to give it a transparent background. By the way, thanks for the tip about looking at the package database, that will definitely come in handy later, but this time it still didn't point me to a system-wide config file.
Since I included that path file in ~/.nanorc I can see similar effects of most, syntax being colored green and orange, but the normal text is still black and pretty hard to read. Here is the specific section I want to change in ~/.nanorc to get an overall white foreground and transparent background, but every time I change it I get the "cannot add a color command without a syntax command" error, even though I included the syntax line in ~/.nanorc.
## Color setup
## Format:
## syntax "short description" ["filename regex" ...]
## The "none" syntax is reserved; specifying it on the command line is
## the same as not having a syntax at all. The "default" syntax is
## special: it takes no filename regexes, and applies to files that
## don't match any other syntax's filename regexes.
## color foreground,background "regex" ["regex"...]
## or
## icolor foreground,background "regex" ["regex"...]
## "color" will do case sensitive matches, while "icolor" will do case
## insensitive matches.
## Valid colors: white, black, red, blue, green, yellow, magenta, cyan.
## For foreground colors, you may use the prefix "bright" to get a
## stronger highlight.
## To use multi-line regexes, use the start="regex" end="regex"
## [start="regex" end="regex"...] format.
## If your system supports transparency, not specifying a background
## color will use a transparent color. If you don't want this, be sure
## to set the background color to black or white.
## If you wish, you may put your syntaxes in separate files. You can
## make use of such files (which can only include "syntax", "color", and
## "icolor" commands) as follows:
include "/usr/share/nano/sh.nanorc"
## Unless otherwise noted, the name of the syntax file (without the
## ".nanorc" extension) should be the same as the "short description"
## name inside that file. These names are kept fairly short to make
## them easier to remember and faster to type using nano's -Y option.
## All regexes should be extended regular expressions.
About the alsamixer thing, I didn't think it would be TOO hard, but if you say so I should probably put that off until later.
Thanks for the help,
Clarence

Similar Messages

  • Zsh: "set | grep foo" show my not the result...

    hello!
    i have "successfully" switched to zsh! i must say: its amazing!!!
    but i have one problem: i often use commands like this:
    $ set | grep foo
    but i get this:
    hit:
    $ set | grep foo
    Binary file (standard input) matches
    no hit:
    $ set | grep foo
    what i have to change in the .zshrc to get the lines where the word is included?
    here is my config:
    # history
    HISTSIZE=1000
    SAVEHIST=1000
    HISTFILE=$HOME/.zsh_history
    setopt append_history
    setopt no_hist_beep
    setopt hist_ignore_space
    setopt hist_ignore_all_dups # prevent duplicated entries
    # colors and prompt shells
    autoload colors zsh/terminfo
    if [[ "$terminfo[colors]" -ge 8 ]]; then
    colors
    fi
    for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
    eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
    eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
    (( count = $count + 1 ))
    done
    PR_NO_COLOR="%{$terminfo[sgr0]%}"
    #PS1="[$PR_BLUE%n$PR_WHITE@$PR_GREEN%U%m%u$PR_NO_COLOR:$PR_RED%2c$PR_NO_COLOR]%(!.#.$) "
    PS1="[%{$PR_GREEN%}%n%{$PR_WHITE%}@%m%u %{$PR_BLUE%}%2c%{$PR_NO_COLOR%}]%(!.#.$) "
    RPS1="$PR_LIGHT_YELLOW(%D{%d-%m-%y %H:%M})$PR_NO_COLOR"
    # advanced tab-completion
    autoload -U compinit
    compinit
    zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
    zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
    zstyle ':completion:*' menu select interactive # shows menu which you can browse with arrow keys
    # tab completion for "kill"
    zstyle ':completion:*:kill:*' menu yes select
    zstyle ':completion:*:kill:*' force-list always
    zstyle ':completion:*:processes' command 'ps x'
    # tab completion for "man"
    zstyle ':completion:*:manuals' menu yes select
    # colors in completion
    #eval $(dircolors)
    #zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
    # command correction
    setopt correctall
    # auto change directory ( "/etc" instead of "cd /etc" )
    setopt autocd
    # other options
    unsetopt bgnice autoparamslash
    # key bindings
    typeset -g -A key
    bindkey '^[OH' beginning-of-line # pos1 key
    bindkey '^[OF' end-of-line # end key
    bindkey '^[[3~' delete-char # del key
    bindkey '^[[6~' down-line-or-history # page down key
    bindkey '^[[5~' down-line-or-history # page up key
    thx, iggy

    I don't know much about zsh, but wouldn't
    echo $foo
    work just as well?
    -edit-
    Actually, you might be able to use the following bash-isms:
    $ # To display variables
    $ declare -p VARNAME
    $ # To display functions
    $ declare -f functname
    Last edited by Cerebral (2007-07-27 13:54:56)

  • Multiline zsh prompt messes RPROMPT

    Hello,
    I have a multiline zsh prompt which is fine, but I'd like to add the hour in the RPROMPT. Unfortunately, the RPROMPT displays at the end of the second line of the prompt, whereas I want it at the first line. What I have looks like this:
    ~
    >>= archey 3:22
    And I would like this:
    ~ 3:22
    >>= archey
    So, I tried adding a control character to move the cursor up one line, but it still doesn't work. Before adding a control char:
    autoload -U colors && colors
    setopt prompt_subst
    PROMPT=$'%{$fg[blue]%}%~%{$reset_color%}
    %{$fg[red]%}>>=%{$reset_color%} '
    RPROMPT="%D{%L:%M:%S}"
    And after:
    autoload -U colors && colors
    setopt prompt_subst
    PROMPT=$'%{$fg[blue]%}%~%{$reset_color%}
    %{$fg[red]%}>>=%{$reset_color%} '
    RPROMPT="\033[1A%D{%L:%M:%S}"
    Could you help me sort this out ?
    Last edited by Mathuin (2014-04-23 14:36:57)

    You may want to move precmd() outside of the setprompt() function ...
    Also, there's no reason to create $PR_COLORS. ZSH supports %B...%b for bold and %F{color}...%f for foreground colors. If you're using a 256 color terminal, you can specify 001-255 in %F{}.
    Here is my prompt;
    setprompt () {
    # Need this so the prompt will work.
    setopt prompt_subst
    # see if we can use colors.
    autoload colors zsh/terminfo
    colors
    if [[ $UID == 0 ]] ; then
    PROMPT='[%B%F{red}%n%f%b@%F{green}%m%f:%y] %B%F{yellow}%~%f%b %# '
    else
    PROMPT='[%F{025}%n%f@%F{200}%m%f:%y] %B%F{035}%~%f%b %# '
    fi
    setprompt
    See also
    man zshall | less -p "Visual effects"

  • Zsh change cursor color to indicate vi mode

    Hello, I have written this for the .zshrc to change the cursor color to red when in cmd mode on the zsh command line.
    zle-keymap-select () {
    if [ $KEYMAP = vicmd ]; then
    echo -ne "\033]12;Red\007"
    else
    echo -ne "\033]12;Grey\007"
    fi
    zle -N zle-keymap-select
    zle-line-init () {
    zle -K viins
    echo -ne "\033]12;Grey\007"
    zle -N zle-line-init
    bindkey -v
    It works well in urxvt however my tty does not know what to do with the escape codes so It just prints them to the command line. Is there any command for changing the cursor color that is for urxvt only? I think this would fix the problem.
    Thanks,
    Andreas

    Cool! The extra $TERM conditional works. Thank you.
    With xterm the color changing does not work as well, the cursor color only changes back to insert-mode-color once text is being typed.
    This is working for me. I may simplify it later.
    zle-keymap-select () {
    if [ $TERM = "rxvt-256color" ]; then
    if [ $KEYMAP = vicmd ]; then
    echo -ne "\033]12;Red\007"
    else
    echo -ne "\033]12;Grey\007"
    fi
    fi
    zle -N zle-keymap-select
    zle-line-init () {
    zle -K viins
    if [ $TERM = "rxvt-256color" ]; then
    echo -ne "\033]12;Grey\007"
    fi
    zle -N zle-line-init
    bindkey -v
    There are many colorname choices in /usr/share/X11/rgb,txt
    You can also add colors. Or just use rgb values directly, apparently. More about the color stuff here.
    EDIT: You can just use the hex as you defined it in your .Xdefaults:
    echo -ne "\033]12;#83C048\007"
    Last edited by AndreasBWagner (2010-05-01 02:48:28)

  • [solved] zsh, compinit and colors

    Hi all,
    I've just updated my zsh package to version 4.3.11-1 and now I can't run two of its built-in functions, namely compinit and colors.
    My .zshrc contains the following code:
    # rest of ~/.zshrc ...
    zstyle :compinstall filename '/home/andre/.local/.zshrc'
    autoload -U compinit
    compinit
    zstyle ':completion:*' completer _complete _match _approximate
    zstyle ':completion:*:match:*' original only
    zstyle ':completion:*:approximate:*' max-errors 1 numeric
    zstyle ':completion:*' menu select=5
    zstyle ':completion:*' squeeze-slashes true
    zstyle ':completion:*:*:kill:*' menu yes select
    zstyle ':completion:*:kill:*' force-list always
    zstyle ':completion:*:cd:*' ignore-parents parent pwd
    # colors array (e.g. $fg[blue])
    autoload colors
    colors
    # rest of ~/.zshrc ...
    But when I open up a terminal (or type any of these two functions) I get the messages:
    /home/ars/.zshrc:57: compinit: function definition file not found
    /home/ars/.zshrc:69: colors: function definition file not found
    I guess this isn't something very complex, but I couldn't find anything about it.
    TIA.
    Last edited by andre.ramaciotti (2010-12-22 00:15:09)

    So what do lines 57 and 69 of your .zshrc file say specificially?
    It's hard to tell what the line numbers are from what you posted, so.....
    Also are those functions actually in your /usr/share/zsh/<version number>/functions directory?
    colors appears to be in Misc and compinit appears to be in Completion in mine (version 4.3.10).

  • Color shell/script output in bash/zsh

    So, I wanted to have an easy way to color my script output. In zsh there is a color module, but as far as I know it does only bold for special effects. Also there are some scripts around that let you call a predefined array, but there aren't any where you can combine options easily, like both bold and italic. ansi-color comes close, but it has almost 250 lines of code and I thought it could be done more efficiently. So here's color, both in a zsh and a bash variant (the shebang and the way of defining an array being the only difference).
    Save as "color" in your path, or wrap it in a function to store in either .bashrc or .zshrc. color --help for instructions. Let me know what you think, if it has bugs or if the coding can be more efficient or better (I did this mostly as a programming exercise, it's not *that* useful.
    ZSH color
    #!/bin/zsh
    color-usage() {
    cat <<"USAGE"
    Usage: color [OPTIONS] <color>
    -b|--bold for bold text
    -i|--italic for italic text
    -u|--underline for underlined text
    -f|--flash for blinking text, not possible together with --bg
    -r|--reverse to switch fg and bg colors
    -/--bg <color> for background color
    -d|--dark for fainted / less intense colors (your terminal may not support this)
    -x|--invisible for invisible text (your terminal may not support this)
    -ff|--fastflash for fast blinking text (your terminal may not support this), not possible together with --bg
    Color can be: black, red, green, yellow, blue, magenta, cyan, white and lightblack, lightred etc.
    Use "color" without specifying the color to reset to default.
    Notes:
    1. You can not use blink in combination with --bg, but you can do -r instead and define <color> as desired bg-color. Example: color -f -r blue lets black text blink on blue background. This means you have the bg color as text color, which can't be changed."
    2. Append $(color) behind the string you have formatted, or the color sequence may stay in effect, especially in bash.
    3. You can combine options like -b -i -f, but be sensible; -x -f is not sensible; neither is -d lightred.
    Examples:
    echo "This is $(color -f -i lightred)blinking italic lightred text$(color)"
    echo "This is $(color -bg blue white)white text on blue bg$(color)"
    echo "This shows words in $(color green)green $(color magenta)magenta $(color)and the rest normal"
    echo "This shows $(color -f -r cyan)bold blinking text on cyan background$(color)"
    USAGE
    # Define and create array "colors"
    typeset -Ag colors
    colors=( black "0" red "1" green "2" yellow "3" blue "4" magenta "5" cyan "6" white "7" )
    # Loop to read options and arguments
    while [ $1 ]; do
    case "$1" in
    '-h'|'--help') color-usage;;
    '-b'|'--bold') mode="${mode}1;";;
    '-d'|'--dark') mode="${mode}2;";;
    '-i'|'--italic') mode="${mode}3;";;
    '-u'|'--underline') mode="${mode}4;";;
    '-f'|'--flash') mode="${mode}5;";;
    '-ff'|'--fastflash') mode="${mode}6;";;
    '-r'|'--reverse') mode="${mode}7;";;
    '-x'|'--invisible') mode="8;";;
    '-bg'|'--bg') case "$2" in
    light*) bgc=";10${colors[${2#light}]}"; shift;;
    black|red|green|yellow|blue|magenta|cyan|white) bgc=";4${colors[$2]}"; shift;;
    esac;;
    'reset') reset=true;;
    *) case "$1" in
    light*) fgc=";9${colors[${1#light}]}";;
    black|red|green|yellow|blue|magenta|cyan|white) fgc=";3${colors[$1]}";;
    *) echo The color loop is buggy or you used it wrong;;
    esac;;
    esac
    shift
    done
    # Set color sequence
    mode="${mode%;}" # strip ";" from mode string if it ends with that
    echo -e "\e[${mode:-0}${fgc}${bgc}m" # (default value for mode = 0, so if nothing was set, go default; -e to please bash)
    unset mode intensity bgc fgc # clean up
    BASH color
    #!/bin/bash
    color-usage() {
    cat <<"USAGE"
    Usage: color [OPTIONS] <color>
    -b|--bold for bold text
    -i|--italic for italic text
    -u|--underline for underlined text
    -f|--flash for blinking text, not possible together with --bg
    -r|--reverse to switch fg and bg colors
    -/--bg <color> for background color
    -d|--dark for fainted / less intense colors (your terminal may not support this)
    -x|--invisible for invisible text (your terminal may not support this)
    -ff|--fastflash for fast blinking text (your terminal may not support this), not possible together with --bg
    Color can be: black, red, green, yellow, blue, magenta, cyan, white and lightblack, lightred etc.
    Use "color" without specifying the color to reset to default.
    Notes:
    1. You can not use blink in combination with --bg, but you can do -r instead and define <color> as desired bg-color. Example: color -f -r blue lets black text blink on blue background. This means you have the bg color as text color, which can't be changed."
    2. Append $(color) behind the string you have formatted, or the color sequence may stay in effect, especially in bash.
    3. You can combine options like -b -i -f, but be sensible; -x -f is not sensible; neither is -d lightred.
    Examples:
    echo "This is $(color -f -i lightred)blinking italic lightred text$(color)"
    echo "This is $(color -bg blue white)white text on blue bg$(color)"
    echo "This shows words in $(color green)green $(color magenta)magenta $(color)and the rest normal"
    echo "This shows $(color -f -r cyan)bold blinking text on cyan background$(color)"
    USAGE
    # Define and create array "colors"
    declare -A colors
    colors=( [black]="0" [red]="1" [green]="2" [yellow]="3" [blue]="4" [magenta]="5" [cyan]="6" [white]="7" )
    # Loop to read options and arguments
    while [ $1 ]; do
    case "$1" in
    '-h'|'--help') color-usage;;
    '-b'|'--bold') mode="${mode}1;";;
    '-d'|'--dark') mode="${mode}2;";;
    '-i'|'--italic') mode="${mode}3;";;
    '-u'|'--underline') mode="${mode}4;";;
    '-f'|'--flash') mode="${mode}5;";;
    '-ff'|'--fastflash') mode="${mode}6;";;
    '-r'|'--reverse') mode="${mode}7;";;
    '-x'|'--invisible') mode="8;";;
    '-bg'|'--bg') case "$2" in
    light*) bgc=";10${colors[${2#light}]}"; shift;;
    black|red|green|yellow|blue|magenta|cyan|white) bgc=";4${colors[$2]}"; shift;;
    esac;;
    'reset') reset=true;;
    *) case "$1" in
    light*) fgc=";9${colors[${1#light}]}";;
    black|red|green|yellow|blue|magenta|cyan|white) fgc=";3${colors[$1]}";;
    *) echo The color loop is buggy or you used it wrong;;
    esac;;
    esac
    shift
    done
    # Set color sequence
    mode="${mode%;}" # strip ";" from mode string if it ends with that
    echo -e "\e[${mode:-0}${fgc}${bgc}m" # (default value for mode = 0, so if nothing was set, go default; -e to please bash)
    unset mode intensity bgc fgc # clean up

    Soemthing like this will work

  • [SOLVED] zsh prompt colors misaligns the prompt

    Im using urxvt.
    For some reason, using colors in zsh somewhat screws up my prompt.
    In effect, the cursor ends up inside the left hand prompt (see screenhot).
    Also; the right hand prompt gets indented about 5 spaces to much from the right.
    This is my .zshrc:
    #open tmux on startup
    #[[ $TERM != "screen" ]] && tmux && exit
    autoload -Uz compinit
    compinit
    #zstyle ':completion*' menu select
    #setopt completealiases
    #autoload -U promptinit
    #promptinit
    autoload -U colors && colors
    function precmd () {
    local battp=$(ibam --percentbattery | grep % | awk '{print $3}')
    RPROMPT="[%~] [$battp]"
    PROMPT="[%n@%m:]$ "
    #keybindings
    bindkey "^[[7~" beginning-of-line # Home
    bindkey "^[[8~" end-of-line # End
    bindkey "^[[5~" history-beginning-search-backward # PageUp
    bindkey "^[[6~" history-beginning-search-forward # PageDown
    bindkey "^[[2~" quoted-insert # Ins
    bindkey "^[[3~" delete-char # Del
    bindkey "^[[1;5C" forward-word
    bindkey "\eOc" emacs-forward-word
    bindkey "^[[1;5D" backward-word
    bindkey "\eOd" emacs-backward-word
    bindkey "^[[Z" reverse-menu-complete # Shift+Tab
    HISTFILE=~/.histfile
    HISTSIZE=65536
    SAVEHIST=65000
    #aliases
    alias ls='ls --color=auto'
    alias df='df -hT'
    alias cl='clear'
    alias ll='ls -l'
    alias la='ls -A'
    alias free='free -m'
    alias wcu='wicd-curses'
    # The following lines were added by compinstall
    zstyle ':completion:*' completer _complete _ignored
    zstyle ':completion:*' file-sort name
    zstyle ':completion:*' format 'Completing %d'
    zstyle ':completion:*' list-colors ''
    zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|[. -]=** r:|=**'
    zstyle ':completion:*' menu select=0
    zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
    zstyle ':completion:*' use-compctl false
    zstyle ':completion:*' verbose true
    zstyle :compinstall filename '/home/bladt/.zshrc'
    autoload -Uz compinit
    compinit
    # End of lines added by compinstall
    # Lines configured by zsh-newuser-install
    HISTFILE=~/.histfile
    HISTSIZE=10000
    SAVEHIST=15000
    bindkey -e
    # End of lines configured by zsh-newuser-install
    It seems to have been messed up a little by compinit, lets pretend that didn't happen
    (note that "autoload -U promptinit" and "promptinit" are commented out. This doesnt seem to change anything though)
    Last edited by Bladtman242 (2012-02-17 17:59:34)

    Well, yeah actually. It's the colours
    Adding a color in the left-hand prompt moves the right-hand prompt to far to the left.
    Adding a color to the right-hand prompt misplaces the cursor
    Any suggestions?
    EDIT: If I come across seeming a bit smug, it is unintended. Promise
    Last edited by Bladtman242 (2012-02-15 23:18:54)

  • Zsh cursor position corrupt when using $fg[] for colors and RPROMPT

    Hi,
    So far, in my zsh prompt, when using color I did something like:
    %F{yellow}
    in my PROMPT variable.
    Now, this seemed to not have worked on some computers (it did not change color, but showed {yellow}).
    So I change to using
    $fg[yellow]
    This works, but currupts my cursor position (it is not at the end of the prompt anymore) when (and only when) I also use RPROMPT.
    Can this be corrected? What is the most easier way to define colors that works?
    Simple example for prompt that does not work:
    PROMPT="$fg[yellow]>"
    RPROMPT="$fg[white]($fg[yellow]%T$fg[white])"
    Thanks!
    Nathan

    Enclose your colors with %{/%}, as in
    %{$fg[red]%}

  • Zsh (and Bash) Backgrounds Refuse to Change Color [SOLVED]

    I'm sorry if this sounds like a stupid question, but here goes.
    I installed Arch about a week ago and decided that I wanted to change the color of the terminal. I followed the guide on the Arch Wiki, (https://wiki.archlinux.org/index.php/Color_Bash_Prompt), creating all of the necessary files and copy-and-pasting all of the given text into those files. When I restarted my terminal, nothing happened. Fed up, I tried installing Zsh + oh-my-zsh. I successfully installed the two and installed  a zsh theme, but the background color still does not change. The text color, however, changes to the appopriate colors, but the background color remains white.
    Can anyone please tell me what I'm doing wrong?
    Edit: I didn't specify, but I really don't care which terminal I end up using, just as long as the colors work.
    Last edited by Thermite (2012-12-19 01:23:20)

    zsh and bash are shells, not terminal emulators. There is no "default" terminal, if you're using Arch. You had to install a terminal emulator at some point. Or maybe if you followed the beginner's guide you're using xterm. What window manager are you using?
    There are ways to set the background color in rxvt and in xterm using your .Xresources file. Look at the wiki topic for each of those terminals for more information.
    Maybe an easier method for you would be to install a terminal emulator that has menu support, like Terminator, LXTerminal, or Sakura. Then you can just right-click in the terminal and use the menu to set the background color and opacity.
    Last edited by 2ManyDogs (2012-12-18 23:03:53)

  • [Solved] $LANG and zsh prompt color problems

    Hi,
    I recently discovered, trying to use Newsbeuter, that, in X, certain parts of my profile aren't set. Until now it only seemed to be $LANG, which is empty if I echo it from urxvt in XMonad, but yields the correct setting if I do the same in a tty.
    To make things worse now, my zsh seems to be acting up. I have differently colored prompts for my normal user and root. But since a few days ago, the root colors aren't applied unless I source .zshrc again after sudo-ing.
    I updated a lot recently and it's gotten hard to track these issues, especially the $LANG one, to a specific update. The only thing I know is that my desktop, running Kdemod, doesn't have these problems.
    I'm using Slim and XMonad. Neither issue is limited to a certain terminal.
    Most of my configs can be found in my GitHub dotfiles repository. If anything's missing to get a clear picture, ask for it.
    My rc.conf can be found here [Gist].
    Last edited by count-corrupt (2010-08-22 13:33:06)

    jac wrote:
    I finally went through the new sudoers file and got mine to work, see this thread for details. Using that, and using a workaround for libetc, your prompt works for me.
    You appear not to use libetc, but if you do and don't also have root set up to use libetc, you will need to create a link to/from ~/.zshrc from/to ~/.config/zshrc
    I actually just solved it in another way. Your original point, that sudo changed it's default behavior was the key. In the official zsh documentation somewhere it says that all settings that are wanted for root should be put into /root/.zshrc. I just did that and it works.
    Your solution works too by the way. Just enabling
    Defaults env_keep += "HOME"
    does the trick and also (logically) re-enables other things that I hadn't even realized were gone yet like syntax highlighting in vim. I guess I should read into the nature of said privilige escalation problems. Maybe there's a way to selectively keep parts of HOME.
    So thank you very much for the help.

  • Zsh PS1 tty console color issues with newline

    So in a tty I get only white in my PS1 when I use 2 lines:
    PS1="%{%F{white}%}%~ %{%F{green}%}%{%f%}%(10l.
    .)>> "
    My old PS1 works fine though:
    PS1="%{%F{white}%}%~ %{%F{green}%}>> %{%f%}"
    Anyone have any ideas / workarounds?

    copy the rxvt-unicode-256color terminfo to ~/.terminfo/r/ on the remote and make sure your $TERM is set to it. If you get a error about it being too long either fix ssh on the remote, or just rename it and chante TERM acordingy.
    Last edited by Mr.Elendig (2011-05-28 08:03:05)

  • [SOLVED]Oh-my-zsh themes not loading

    [ edit]
    So the solution was to remove the grml-zsh-config package, and reboot(sourcing the .zshrc for some reason didn't make any difference).
    [/ edit ]
    Hello,
    I don't know if this is the best section to post this question but this isn't necessarily related to Arch exactly so...
    I have two machines that I'm using currently, each with a git repository where i keep track of my stuff(mainly config files), and i share them between the machines. Now, for some reason, on my main machine, with Arch x64 the oh-my-zsh themes load, but on my netbook(with x86 Arch ) they don't load, the prompt just looks like username@hostname.
    I tried editing my .zshrc but t doesn't change anything. Does anyone ever had this problem? I Googled and what i get is that the plugins don't work, not the themes.
    My .zshrc is as follows:
    # defs
    ZSH=/usr/share/oh-my-zsh/
    ZSH_THEME="robbyrussell"
    #ZSH_THEME="afowler"
    CASE_SENSITIVE="true"
    DISABLE_AUTO_UPDATE="true"
    # Uncomment following line if you want red dots to be displayed while waiting for completion
    COMPLETION_WAITING_DOTS="true"
    # on login
    if [ ! -f /tmp/login ]; then
    touch /tmp/login
    eval $(ssh-agent)
    ssh-add -l >/dev/null || alias ssh='ssh-add -l >/dev/null || ssh-add && unalias ssh; ssh'
    fi
    # Uncomment to change how often before auto-updates occur? (in days)
    # export UPDATE_ZSH_DAYS=13
    # Uncomment following line if you want to disable colors in ls
    # DISABLE_LS_COLORS="true"
    # Uncomment following line if you want to disable autosetting terminal
    # title. DISABLE_AUTO_TITLE="true"
    # Uncomment following line if you want to disable command autocorrection
    # DISABLE_CORRECTION="true"
    # Uncomment following line if you want to disable marking untracked files
    # under VCS as dirty. This makes repository status check for large
    # repositories much, much faster.
    #DISABLE_UNTRACKED_FILES_DIRTY="true"
    # Which plugins would you like to load? (plugins can be found in
    # ~/.oh-my-zsh/plugins/*) Custom plugins may be added to
    # ~/.oh-my-zsh/custom/plugins/ Example format: plugins=(rails git textmate
    # ruby lighthouse)
    #plugins=(git)
    source $ZSH/oh-my-zsh.sh
    EDITOR=vim
    VISUAL=$EDITOR
    export EDITOR VISUAL
    bindkey "\e[3~" delete-char
    umask 022
    setopt APPEND_HISTORY
    setopt SHARE_HISTORY
    setopt NOTIFY
    setopt NOHUP
    setopt MAILWARN
    HISTFILE=$HOME/.zsh_history
    HISTSIZE=5000
    SAVEHIST=5000
    export PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl:/home/joseph/.cabal/bin:/home/joseph/.cabal/bin:/home/joseph/bin
    # boot
    #clear
    ~/.scripts/fortune.sh
    # alias
    alias setbackground="~/.scripts/setbackground.sh"
    alias setcursor="~/.scripts/setcursor.sh"
    alias fortune="~/.scripts/fortune.sh"
    alias nano="nano -c"
    alias wifi-menu="sudo wifi-menu"
    alias poweroff="sudo systemctl poweroff"
    alias reboot="sudo systemctl reboot"
    alias suspend="sudo systemctl suspend"
    alias reflector="sudo ~/.scripts/reflector.sh"
    alias ls='ls --color=no'
    alias cp='cp -i --preserve=all'
    alias lock='slock'
    alias pacup="~/.scripts/pacup.sh"
    alias w3md="w3m duckduckgo.com"
    alias startxx="~/.scripts/startxx.sh"
    alias startxo="~/.scripts/startxo.sh"
    alias du="du -h"
    alias mplayer="mplayer -zoom"
    alias pacman="sudo pacman"
    Thank you for helping me.
    Last edited by jantonio2992 (2014-05-31 21:28:41)

    First of all, thank you for helping me.
    Trilby wrote:
    jantonio2992 wrote:I don't know if this is the best section to post this question
    I've moved this here to Applications & Desktop Evironments as it seems a better fit as it is about configuration.
    Thank you,
    Trilby wrote:On topic, I don't use zsh, but two basic checks may be in order: 1) what are the ownership and permissions of the config file on the machine it doesn't work on (`ls -l <filename>`) and 2) do you have the exact same version of oh-my-zsh on each machine and/or are you using the aur package for it?
    1) lrwxrwxrwx 1 joseph joseph , so i bet that permissions shouldn't be a problem no?
    2) Yes, i have same version, i even installed the package again to make sure both had last version.
    ANOKNUSA wrote:
    Jantonio2992 wrote:I have two machines that I'm using currently, each with a git repository where i keep track of my stuff(mainly config files), and i share them between the machines.
    Since you admit that you want the same configuration on each machine, why don't you just replace the broken configuration with the working one?
    I did, Each machine has a normal git repository(git init) and a bare(git init --bare), then i set bare repository as "backupl" on the same machine and as "backup" on the other machine, this is how i share them , so they are basically the same. Still on one(the netbook) the prompt shows as <username>@<hostname> and on my main tower(x64 arch, if that helps) it shows as it should with the theme. So to answer to your sugestion, i did replace them still with no result.
    ANOKNUSA wrote:
    thiagowfx wrote:Check whether the folder /usr/share/oh-my-zsh/themes exist in your other machine, and that your chosen theme is present there.
    For posterity, note that this would only apply if it was installed from the AUR. If one just cloned the Git repo (which would be preferable if the user wants to make any changes) the config will be in ~/.oh-my-zsh.
    Yes it was installed from AUR, if i have to install some package not from officials i usually install from AUR.
    thiagowfx wrote:
    Check whether the folder /usr/share/oh-my-zsh/themes exist in your other machine, and that your chosen theme is present there.
    Also, you might try adding
    set -x
    to the beginning of your ~/.zshrc to try to diff/debug the differences between your machines.
    Since both were installed from AUR they both have the folder themes.
    About the set -x , it did it. Thank you very much. When i did that, i compared the differences of the output as you said i should and the netbook one fave a lot more info, so further inspection, on the output said something about "gmrl" something, and i remembered i had installed the grml-zsh-config because it was the config i used to use before i started using git, since i prefer how the oh-my-zsh themes look.
    So the solution was to remove the grml-zsh-config package, and reboot(sourcing the .zshrc for some reason didn't make any difference).
    thank you for helping me.

  • [SOLVED]ZSH and regular expressions

    Hi
    I am getting into regular expressions and i have noticed that with my .zshrc file i have some problem. In bash this expression works:
    \^\[^#]
    but not also in zsh. I have also noted that regular expression works fine with other zshrc configurations found in archwiki (like grml) but i want to have my configuration. And i really can't find what command make a difference
    My .zshrc file is pulled from this site https://github.com/slashbeast/things/bl … s/DOTzshrc.
    # .zshrc
    # Author: Piotr Karbowski <[email protected]>
    # License: beerware.
    # Basic zsh config.
    umask 077
    ZDOTDIR=${ZDOTDIR:-${HOME}}
    ZSHDDIR="${HOME}/.config/zsh.d"
    HISTFILE="${ZDOTDIR}/.zsh_history"
    HISTSIZE='10000'
    SAVEHIST="${HISTSIZE}"
    export EDITOR="/usr/bin/vim"
    export TMP="$HOME/tmp"
    export TEMP="$TMP"
    export TMPDIR="$TMP"
    export TMPPREFIX="${TMPDIR}/zsh"
    if [ ! -d "${TMP}" ]; then mkdir "${TMP}"; fi
    if ! [[ "${PATH}" =~ "^${HOME}/bin" ]]; then
    export PATH="${HOME}/bin:${PATH}"
    fi
    # Not all servers have terminfo for rxvt-256color. :<
    if [ "${TERM}" = 'rxvt-256color' ] && ! [ -f '/usr/share/terminfo/r/rxvt-256color' ] && ! [ -f '/lib/terminfo/r/rxvt-256color' ] && ! [ -f "${HOME}/.terminfo/r/rxvt-256color" ]; then
    export TERM='rxvt-unicode'
    fi
    # Colors.
    red='\e[0;31m'
    RED='\e[1;31m'
    green='\e[0;32m'
    GREEN='\e[1;32m'
    yellow='\e[0;33m'
    YELLOW='\e[1;33m'
    blue='\e[0;34m'
    BLUE='\e[1;34m'
    purple='\e[0;35m'
    PURPLE='\e[1;35m'
    cyan='\e[0;36m'
    CYAN='\e[1;36m'
    NC='\e[0m'
    # Functions
    if [ -f '/etc/profile.d/prll.sh' ]; then
    . "/etc/profile.d/prll.sh"
    fi
    run_under_tmux() {
    # Run $1 under session or attach if such session already exist.
    # $2 is optional path, if no specified, will use $1 from $PATH.
    # If you need to pass extra variables, use $2 for it as in example below..
    # Example usage:
    # torrent() { run_under_tmux 'rtorrent' '/usr/local/rtorrent-git/bin/rtorrent'; }
    # mutt() { run_under_tmux 'mutt'; }
    # irc() { run_under_tmux 'irssi' "TERM='screen' command irssi"; }
    # There is a bug in linux's libevent...
    # export EVENT_NOEPOLL=1
    command -v tmux >/dev/null 2>&1 || return 1
    if [ -z "$1" ]; then return 1; fi
    local name="$1"
    if [ -n "$2" ]; then
    local file_path="$2"
    else
    local file_path="command ${name}"
    fi
    if tmux has-session -t "${name}" 2>/dev/null; then
    tmux attach -d -t "${name}"
    else
    tmux new-session -s "${name}" "${file_path}" \; set-option status \; set set-titles-string "${name} (tmux@${HOST})"
    fi
    t() { run_under_tmux rtorrent; }
    irc() { run_under_tmux irssi "TERM='screen' command irssi"; }
    over_ssh() {
    if [ -n "${SSH_CLIENT}" ]; then
    return 0
    else
    return 1
    fi
    reload () {
    exec "${SHELL}" "$@"
    confirm() {
    local answer
    echo -ne "zsh: sure you want to run '${YELLOW}$@${NC}' [yN]? "
    read -q answer
    echo
    if [[ "${answer}" =~ ^[Yy]$ ]]; then
    command "${=1}" "${=@:2}"
    else
    return 1
    fi
    confirm_wrapper() {
    if [ "$1" = '--root' ]; then
    local as_root='true'
    shift
    fi
    local runcommand="$1"; shift
    if [ "${as_root}" = 'true' ] && [ "${USER}" != 'root' ]; then
    runcommand="sudo ${runcommand}"
    fi
    confirm "${runcommand}" "$@"
    poweroff() { confirm_wrapper --root $0 "$@"; }
    reboot() { confirm_wrapper --root $0 "$@"; }
    hibernate() { confirm_wrapper --root $0 "$@"; }
    detox() {
    if [ "$#" -ge 1 ]; then
    confirm detox "$@"
    else
    command detox "$@"
    fi
    has() {
    local string="${1}"
    shift
    local element=''
    for element in "$@"; do
    if [ "${string}" = "${element}" ]; then
    return 0
    fi
    done
    return 1
    begin_with() {
    local string="${1}"
    shift
    local element=''
    for element in "$@"; do
    if [[ "${string}" =~ "^${element}" ]]; then
    return 0
    fi
    done
    return 1
    termtitle() {
    case "$TERM" in
    rxvt*|xterm|nxterm|gnome|screen|screen-*)
    local prompt_host="${(%):-%m}"
    local prompt_user="${(%):-%n}"
    local prompt_char="${(%):-%~}"
    case "$1" in
    precmd)
    printf '\e]0;%s@%s: %s\a' "${prompt_user}" "${prompt_host}" "${prompt_char}"
    preexec)
    printf '\e]0;%s [%s@%s: %s]\a' "$2" "${prompt_user}" "${prompt_host}" "${prompt_char}"
    esac
    esac
    git_check_if_worktree() {
    # This function intend to be only executed in chpwd().
    # Check if the current path is in git repo.
    # We would want stop this function, on some big git repos it can take some time to cd into.
    if [ -n "${skip_zsh_git}" ]; then
    git_pwd_is_worktree='false'
    return 1
    fi
    # The : separated list of paths where we will run check for git repo.
    # If not set, then we will do it only for /root and /home.
    if [ "${UID}" = '0' ]; then
    # running 'git' in repo changes owner of git's index files to root, skip prompt git magic if CWD=/home/*
    git_check_if_workdir_path="${git_check_if_workdir_path:-/root:/etc}"
    else
    git_check_if_workdir_path="${git_check_if_workdir_path:-/home}"
    git_check_if_workdir_path_exclude="${git_check_if_workdir_path_exclude:-${HOME}/_sshfs}"
    fi
    if begin_with "${PWD}" ${=git_check_if_workdir_path//:/ }; then
    if ! begin_with "${PWD}" ${=git_check_if_workdir_path_exclude//:/ }; then
    local git_pwd_is_worktree_match='true'
    else
    local git_pwd_is_worktree_match='false'
    fi
    fi
    if ! [ "${git_pwd_is_worktree_match}" = 'true' ]; then
    git_pwd_is_worktree='false'
    return 1
    fi
    # todo: Prevent checking for /.git or /home/.git, if PWD=/home or PWD=/ maybe...
    # damn annoying RBAC messages about Access denied there.
    if [ -d '.git' ] || [ "$(git rev-parse --is-inside-work-tree 2> /dev/null)" = 'true' ]; then
    git_pwd_is_worktree='true'
    git_worktree_is_bare="$(git config core.bare)"
    else
    unset git_branch git_worktree_is_bare
    git_pwd_is_worktree='false'
    fi
    git_branch() {
    git_branch="$(git symbolic-ref HEAD 2>/dev/null)"
    git_branch="${git_branch##*/}"
    git_branch="${git_branch:-no branch}"
    git_dirty() {
    if [ "${git_worktree_is_bare}" = 'false' ] && [ -n "$(git status --untracked-files='no' --porcelain)" ]; then
    git_dirty='%F{green}*'
    else
    unset git_dirty
    fi
    precmd() {
    # Set terminal title.
    termtitle precmd
    if [ "${git_pwd_is_worktree}" = 'true' ]; then
    git_branch
    git_dirty
    git_prompt=" %F{blue}[%F{253}${git_branch}${git_dirty}%F{blue}]"
    else
    unset git_prompt
    fi
    preexec() {
    # Set terminal title along with current executed command pass as second argument
    termtitle preexec "${(V)1}"
    chpwd() {
    git_check_if_worktree
    man() {
    if command -v vimmanpager >/dev/null 2>&1; then
    PAGER="vimmanpager" command man "$@"
    else
    command man "$@"
    fi
    # Are we running under grsecurity's RBAC?
    rbac_auth() {
    local auth_to_role='admin'
    if [ "${USER}" = 'root' ]; then
    if ! grep -qE '^RBAC:' "/proc/self/status" && command -v gradm > /dev/null 2>&1; then
    echo -e "\n${BLUE}*${NC} ${GREEN}RBAC${NC} Authorize to '${auth_to_role}' RBAC role."
    gradm -a "${auth_to_role}"
    fi
    fi
    #rbac_auth
    # Check if we started zsh in git worktree, useful with tmux when your new zsh may spawn in source dir.
    git_check_if_worktree
    if [ "${git_pwd_is_worktree}" = 'true' ]; then
    git_branch
    git_dirty
    git_prompt=" %F{blue}[%F{253}${git_branch}${git_dirty}%F{blue}]"
    else
    unset git_prompt
    fi
    # Le features!
    # extended globbing, awesome!
    setopt extendedGlob
    # zmv - a command for renaming files by means of shell patterns.
    autoload -U zmv
    # zargs, as an alternative to find -exec and xargs.
    autoload -U zargs
    # Turn on command substitution in the prompt (and parameter expansion and arithmetic expansion).
    setopt promptsubst
    # Control-x-e to open current line in $EDITOR, awesome when writting functions or editing multiline commands.
    autoload -U edit-command-line
    zle -N edit-command-line
    bindkey '^x^e' edit-command-line
    # Include user-specified configs.
    if [ ! -d "${ZSHDDIR}" ]; then
    mkdir -p "${ZSHDDIR}" && echo "# Put your user-specified config here." > "${ZSHDDIR}/example.zsh"
    fi
    for zshd in $(ls -A ${HOME}/.config/zsh.d/^*.(z)sh$); do
    . "${zshd}"
    done
    # Completion.
    autoload -Uz compinit
    compinit
    zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
    zstyle ':completion:*' completer _expand _complete _ignored _approximate
    zstyle ':completion:*' menu select=2
    zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
    zstyle ':completion::complete:*' use-cache 1
    zstyle ':completion:*:descriptions' format '%U%F{cyan}%d%f%u'
    # If running as root and nice >0, renice to 0.
    if [ "$USER" = 'root' ] && [ "$(cut -d ' ' -f 19 /proc/$$/stat)" -gt 0 ]; then
    renice -n 0 -p "$$" && echo "# Adjusted nice level for current shell to 0."
    fi
    # Fancy prompt.
    if over_ssh && [ -z "${TMUX}" ]; then
    prompt_is_ssh='%F{blue}[%F{red}SSH%F{blue}] '
    elif over_ssh; then
    prompt_is_ssh='%F{blue}[%F{253}SSH%F{blue}] '
    else
    unset prompt_is_ssh
    fi
    case $USER in
    root)
    PROMPT='%B%F{cyan}%m%k %(?..%F{blue}[%F{253}%?%F{blue}] )${prompt_is_ssh}%B%F{blue}%1~${git_prompt}%F{blue} %# %b%f%k'
    PROMPT='%B%F{blue}%n@%m%k %(?..%F{blue}[%F{253}%?%F{blue}] )${prompt_is_ssh}%B%F{cyan}%1~${git_prompt}%F{cyan} %# %b%f%k'
    esac
    # Ignore lines prefixed with '#'.
    setopt interactivecomments
    # Ignore duplicate in history.
    setopt hist_ignore_dups
    # Prevent record in history entry if preceding them with at least one space
    setopt hist_ignore_space
    # Nobody need flow control anymore. Troublesome feature.
    #stty -ixon
    setopt noflowcontrol
    # Fix for tmux on linux.
    case "$(uname -o)" in
    'GNU/Linux')
    export EVENT_NOEPOLL=1
    esac
    # Aliases
    alias cp='cp -iv'
    alias rcp='rsync -v --progress'
    alias rmv='rsync -v --progress --remove-source-files'
    alias mv='mv -iv'
    alias rm='rm -iv'
    alias rmdir='rmdir -v'
    alias ln='ln -v'
    alias chmod="chmod -c"
    alias chown="chown -c"
    if command -v colordiff > /dev/null 2>&1; then
    alias diff="colordiff -Nuar"
    else
    alias diff="diff -Nuar"
    fi
    alias grep='grep --colour=auto'
    alias egrep='egrep --colour=auto'
    alias ls='ls --color=auto --human-readable --group-directories-first --classify'
    # Keys.
    case $TERM in
    rxvt*|xterm*)
    bindkey "^[[7~" beginning-of-line #Home key
    bindkey "^[[8~" end-of-line #End key
    bindkey "^[[3~" delete-char #Del key
    bindkey "^[[A" history-beginning-search-backward #Up Arrow
    bindkey "^[[B" history-beginning-search-forward #Down Arrow
    bindkey "^[Oc" forward-word # control + right arrow
    bindkey "^[Od" backward-word # control + left arrow
    bindkey "^H" backward-kill-word # control + backspace
    bindkey "^[[3^" kill-word # control + delete
    linux)
    bindkey "^[[1~" beginning-of-line #Home key
    bindkey "^[[4~" end-of-line #End key
    bindkey "^[[3~" delete-char #Del key
    bindkey "^[[A" history-beginning-search-backward
    bindkey "^[[B" history-beginning-search-forward
    screen|screen-*)
    bindkey "^[[1~" beginning-of-line #Home key
    bindkey "^[[4~" end-of-line #End key
    bindkey "^[[3~" delete-char #Del key
    bindkey "^[[A" history-beginning-search-backward #Up Arrow
    bindkey "^[[B" history-beginning-search-forward #Down Arrow
    bindkey "^[Oc" forward-word # control + right arrow
    bindkey "^[Od" backward-word # control + left arrow
    bindkey "^H" backward-kill-word # control + backspace
    bindkey "^[[3^" kill-word # control + delete
    esac
    bindkey "^R" history-incremental-pattern-search-backward
    bindkey "^S" history-incremental-pattern-search-forward
    if [ -f ~/.alert ]; then cat ~/.alert; fi
    Thanks for all the help.
    Last edited by Shark (2013-05-11 22:32:24)

    Raynman wrote:
    "This expression doesn't work", "It doesn't work" ...
    Could you try being a bit more specific?
    Firstly, i am sorry i didn't post the output. I should have know better.
    Secondly, chill out.
    I have used above regex with grep command. Output from terminal is:
    zsh: bad pattern: ^[^#]
    In bash it works perfectly.
    If i issue "setopt re_match_pcre" i have the same ouput as above.
    EDIT: If i issue "unsetopt no_match" it actually works but i have to change the regex from "\^\[^#]" to "\^[^#]" otherwise i get the same output as above. In bash both options work.
    Last edited by Shark (2013-05-11 22:07:21)

  • [SOLVED] zsh config (.zshrc) no longer working for root.

    Hi,
    I must've done something stupid a while ago, cause whenever I sudo -s to get some root privilages it seems .zshrc is not read.
    Prompt is default and aliases don't work.
    Here's my .zshrc, just in case.  I'm quite sure it's okay.
    # OPTIONS FOR ZSH
    # PS1=$'%(!.%{\e[0;31m%}#.%{\e[0;32m%}$)>_ %{\e[0m%}' # $>_ / #>_
    PS1=$'%(!.%{\e[1;31m%}%{\e[5;31m%}>>>.%{\e[1;31m%}>%{\e[1;33m%}>%{\e[1;32m%}>) %{\e[0m%}' # >>> / >>>
    RPS1=$'%{\e[0;33m%}[%~]%{\e[0m%}'
    # RPROMPT=$'[~]'
    export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/opt/mozilla/bin:$HOME/linux/bin:/opt/kde/bin:/opt/java/jre/bin:/usr/local/bin"
    export EDITOR="vim"
    export MANPATH="/usr/share/man:/usr/man"
    export DE=kde
    #export TERM=xterm-256color
    # key bindings
    bindkey -v
    bindkey "^[[2~" overwrite-mode
    bindkey "^[[3~" delete-char
    bindkey "\e[7~" beginning-of-line
    bindkey "\e[8~" end-of-line
    bindkey "$(echotc kl)" backward-char
    bindkey "\E[A" up-line-or-search
    bindkey "\E[B" down-line-or-search
    bindkey '^R' history-incremental-search-backward
    bindkey -M vicmd 'k' up-line-or-search
    bindkey -M vicmd 'j' down-line-or-search
    HISTFILE=~/.zshhistory
    HISTSIZE=50000
    SAVEHIST=50000
    # aliases
    alias ..='cd ..'
    alias cl='clear'
    alias ls='ls --color=auto'
    alias lsl='ls -hl --color=auto'
    alias rm='rm -v'
    alias pg='pgrep -lf'
    alias ka='killall -s 9'
    alias sus='sudo -s'
    alias hdtemp='sudo hddtemp /dev/sda'
    alias du="du -h"
    alias df="df -h"
    alias freq="cpufreq-info | grep decide"
    alias mpdkill="sudo mpd --kill && killall -s 9 mpdscribble"
    alias sudo="sudo "
    alias nc="ncmpcpp"
    alias cmatrix="cmatrix -abu2"
    alias x="startx"
    alias thinkpad-smapi="thinkpad-smapi -b 0"
    alias relap="sudo /etc/rc.d/laptop-mode restart"
    alias rewlan="sudo ifconfig wlan0 {down,up}"
    alias rentpd="sudo /etc/rc.d/openntpd restart"
    alias resamba="sudo /etc/rc.d/samba restart"
    alias recups="sudo /etc/rc.d/cups restart"
    alias reblue="sudo /etc/rc.d/bluetooth restart"
    alias fancool="/etc/rc.d/thinkfan stop && echo level 7 > /proc/acpi/ibm/fan"
    alias fanstart="sudo /etc/rc.d/thinkfan start"
    # functions
    fs() { find $1 -iname '*'$2'*'; }
    gcurses() { gcc $1 -o $(cut -d . -f 1 $1) -lncurses;}
    ranger () {
    command ranger --fail-unless-cd $@ &&
    cd "$(grep \^\' ~/.ranger/bookmarks | cut -b3-)"
    # completion
    autoload -U compinit
    compinit
    # correction
    setopt correctall
    # prompt
    # autoload -U promptinit
    # promptinit
    # prompt redhat
    # options
    setopt hist_ignore_all_dups
    setopt hist_ignore_space
    setopt nohup # don't kill bg jobs when tty quits
    setopt nocheckjobs # don't complain about background jobs on exit
    #Some functions, like _apt and _dpkg, are very slow. You can use a cache in order to proxy the list of results (like the list of available debian packages) Use a cache:
    zstyle ':completion:*' use-cache on
    zstyle ':completion:*' cache-path ~/.zsh/cache
    #Prevent CVS files/directories from being completed:
    zstyle ':completion:*:(all-|)files' ignored-patterns '(|*/)CVS'
    #Ignore completion functions for commands you don't have:
    zstyle ':completion:*:functions' ignored-patterns '_*'
    zstyle ':completion:*:cd:*' ignored-patterns '(*/)#CVS'
    zstyle ':completion:*:processes-names' command 'ps -e -o comm='
    Last edited by vi3dr0 (2010-09-19 15:10:41)

    I think this was a pushed /etc/sudoers file that pacdiffviewer prompts you to replace with, maybe a month ago?  If you were like me, you probably only added yourself being able to sudo.  I don't have the old version, but I don't remember requiring the code I gave you... maybe they've changed something necessitating the new file.  Anyway, happy times, my prompt turns red when I 'sudo -s'

  • Working with zsh

    Hey. Ive been playing around with zsh, and I really like it, more than BASH.
    I set my default shell to zsh using "chsh". Unfortunatly, Ive been running into some problems, and hopefully you guys can help me.
    1. Man pages look messed up. It shows a lot of "ESC" things all over man pages.
    2. the /etc/profile doesnt seem to be executed. None of the env variables from it are set.
    3. The "backspace" key doesnt work.
    4.I set zsh to display colors when autocompleting things, and it only seems to colorize certain files, where BASH did many more. What is the environment variable for the color settings? I cant seem to find it.
    5. Has anyone else changed their shell from BASH? What other things should I adjust to make me compatable.
    Ive had to switch back to BASH until I can get these things worked out, so any help would be appreciated.

    Some of it can be a bit complicated.  I remember the first time I looked at the man page, and thought I would make a good zsh prompt.  My prompt then appeared as
    ${PWD}
    Oops.
    That shell has some nice features though, including the ability to handle floating point decimals.  I haven't run into your particular problems, however.  I have my zsh prompt, put in my .zshrc which is where the shell looks (you might want to put things from your profile in there if they don't seem to be getting read) and colors work fine. I have a prompt based on Sarah's favorite distro, Gentoo's bash prompt, complete with girly-man colors
    PS1=$'%{e[1;32m%}%n@%{e[1;34m%}%m %{e[1;36m%}%1d %{e[1;36m%}%#%{e[0m%} '
    Don't know if that helps you at all
    Scott

Maybe you are looking for