Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: sluggish prompt
- X-seq: zsh-users 11943
- From: Russell Hoover <rj@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: sluggish prompt
- Date: Sun, 7 Oct 2007 03:12:56 -0400
- In-reply-to: <20071007063359.30913.qmail@xxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20071007045049.GA28877@xxxxxxxxx> <20071007053638.14299.qmail@xxxxxxxxxxx> <20071007061947.GA6554@xxxxxxxxx> <20071007063359.30913.qmail@xxxxxxxxxxx>
On Sun 10/07/07 at 07:33 PM +1300, Atom Smasher <atom@xxxxxxxxxxx> wrote:
> if it's hanging at every prompt (not just when the shell starts) i would
> start with turning on XTRACE within the precmd function.
It hangs after any inactivity. I don't know that I've ever used the
precmd function. How would I enable XTRACE with it?
> also, is there any command substitution in your prompt?
In the prompt . . . I don't think so.
> about how big is your ~/.zshrc?
290 lines.
> did you copy it from somewhere? or did you write it yourself?
I wrote it slowly myself over several years. A few isolated segments
were copied.
if the latter, you must've either noticed it getting
> getting slower... or you must have done something to make it hang.
I think I made a few adjustments to the rc recently after starting
to use zsh-3.4.3. One thing I noticed in the read-out that it kept
repeating all the different filenames for lines 251 & 253 over & over.
Here are those lines:
----------------------------------------------------
248 for dirname in $fpath
249 do
250 for files in $dirname/*(:t)
251 do
252 autoload $files
253 done
254 done
------------------------------------------------------
The lines I quoted that kept repeating whenever I hit return
I now notice are from the rcfile:
-------------------------------------------------------
233 function precmd {
234 local exitstatus=$?
235 psvar[1]=SIG
236 [[ $exitstatus -ge 128 ]] && psvar[1]=SIG$signals[$exitstatus-127]
237 # [[ $psvar[1] = SIG ]] && psvar[1]=$exitstatus
238 # jobs % >& /dev/null && psvar[2]="" || psvar[2]=()
239 psvar[2]=$#jobstates; [[ $psvar[2] -eq 0 ]] && psvar[2]=()
240 }
--------------------------------------------------------
Not sure why the two lines are commented out -- these lines were
definitely copied, though almost all of the rest of the file is not.
At the risk of overkill here's the whole file, thanks for helping:
--------------------------------------------------------------------------
#
# Russell Hoover's panix .zshrc file for zsh 4.3.4
# Last update: 2007/09/24 3:01 p.m. EDT
#
# From "Intro to Zsh": ".zshrc is sourced in interactive shells
# [~/.zshrc is sourced *after* ~/.zprofile.] It should contain
# commands to set up aliases, functions, options, key bindings, etc."
#
# Most of the environment variables are set in ~/.zshenv;
# whatever can't be set there is set here (see below).
#
# All resource limits are at their default. Default for coredumpsize
# is zero. Set core dump anyway, so as to *always* avoid core dump:
#
limit coredumpsize 0 # This applies to the shell itself.
ulimit -c 0 # Limits to zero the coredumpsize of core dumped
# by children of the shell but not the shell itself.
umask 077 # Keeps permissions for group and others off.
bindkey -e # Command-line history-events are obtained in
# emacs-mode, using the up & down arrow-keys.
bindkey -s "^P" "\rpwd\r" # Print current working dir & return to the prompt.
bindkey "^F" forward-word
bindkey "^B" backward-word
bindkey "^W" kill-word
bindkey "^H" backward-kill-word
bindkey "^J" backward-delete-to-slash # See immediately below.
bindkey ";" describe-key-briefly
bindkey "^X^I" expand-or-complete-prefix
#-------------------------------------->
backward-delete-to-slash () {
local WORDCHARS=${WORDCHARS//\//}
zle .backward-delete-word
}
zle -N backward-delete-to-slash
#--------------------------------------<
# Set here only the environment variables that can't be set in ~/.zshenv
# (because they'd be overwritten by /etc/zprofile, the panix system
# config file for zsh. /etc/zprofile loads *after* ~/.zshenv):
#
export HISTSIZE=1000
export MAIL=$HOME/.maildir/
export MAILCHECK=10
# remove duplicate entries from path,cdpath,manpath & fpath:
typeset -U path cdpath manpath fpath
path=( $PATH /usr/local/bin /usr/bin /usr/sbin /usr/local/sbin /sbin
/usr/X11R6/bin /bin ${HOME}/bin ${HOME}/.zfunc /usr/local/contrib/bin )
# Set up the aliases (I have a lot of 'em):
# Display the current directory's 30 largest files, from largest to smallest:
alias 30='du -a | sort -nr | head -30'
alias a='alias |less' # Display all aliases via the ``less" pager.
alias ap=apropos
alias b=bye
alias c='clear
gls --co=auto -sF' # Clear the screen & list current dir at top.
alias cal=gcal # Gnu cal is better than cal.
alias cdh='cd /htdocs/userdirs/rj/'
alias dk='c
cl
cal'
alias cp='nocorrect cp -ip' # No spelling correction on cp; query if overwriting
# an existing file; preserve mode, time & flags etc info.
alias d='dirs -v' # Display the directory stack.
alias ee='exec zsh -l'
#alias ss='screen -D -R'
alias f=pfinger
alias find='gfind |m'
alias grep='grep i' # ignore case in both pattern & input files.
alias h='history -fD 1 |less' # Display the command-history stack.
alias j='jobs -l' # Display all jobs currently running.
alias _L='last|head -40' # List top of local lastlog file.
# Use this next alias for pattern-matching, e.g., 'l *(x)' shows all
# executable files; 'l *(/)' shows all directories; 'l *(.)' shows all
# dot files; 'l *(^.)' shows all *non*-dot files, etc:
alias l='gls --co=auto -sdF'
# File/dir displays, short view (name & block size only):
alias lg='gls --co=auto -dsF .*' # Dot-files.
alias ls='gls --co=auto -sF' # Regular (non-dot) files.
alias ldd='gls --co=auto -adsF *(/)' # Directories (dot & non-dot).
alias cl='gls --co=auto -asF' # All files.
# File/dir displays, full view (permissions, owner, size, date, name):
alias lsd='gls --co=auto -dlF .*' # Dot-files.
alias la='gls --co=auto -lF' # Regular (non-dot) files.
alias ll='gls --co=auto -adlF *(/)' # All dirs (dot & non-dot).
alias lf='gls --co=auto -alFA' # All files.
alias lh='lf /htdocs/userdirs/rj/' # List all files in my ~/public_html subdir.
alias lff='lf /var/tmp/rj/' # List files in my /tmp dir.
alias lft='lf /var/tmp/'
alias lss='gls --co=auto -aSlF' # Smallest files & dirs.
alias lsb='gls --co=auto -SlF' # Biggest files & dirs.
alias lsn='gls --co=auto -tlF' # Newest.
alias m=less # Display named file(s) via the less pager.
alias make=gmake
alias ma='most /usr/local/libdata/mutt-1.5.10p1/manual.txt'
alias man='man -m $HOME/man'
alias mc='nw | egrep "mutt*"'
alias md='nocorrect mkdir' # no spelling correction on mkdir.
alias mo=most
alias mr='v .muttrc'
alias mt=mutt_slang.new
alias mz='mt -Z' # Open mutt to 1st mailbox w/new mail.
alias mv='nocorrect mv -i' # No spelling correction on mv; query if
# overwriting an existing file.
alias nc=ncftp
# Rename the current dir to specified name (e.g., to
# shorten a long directory name); defined in .zfunc:
alias nd=namedir
alias nl='nlast -urj -start= * -g' # Show use-pattern chart for named user.
alias nt=nout
alias ping=/sbin/ping
alias pd=pushd # Put the current dir on the stack & change to a new dir.
alias po=popd # Pop a dir off the top of the stack & change to it.
alias ps='ps && pstree -u rj -g 2'
alias rd=rmdir # Remove named directory.
alias rm=safe-rm # Make rm command safe, with the 'safe-rm' .zfunc file.
sa() {finger " -bhmp $1@xxxxxxxxx"}
alias sch='most /usr/local/libdata/slrn-0.9.8.0-p1/doc/manual.txt'
# Display current settings of all env variables & options:
alias set='set | m'
# See which staffers are logged in:
alias sf='~mikhail/bin/staff -n'
alias sl='slrn -n'
# Secure-shell login from panix to shore.net:
alias sn='ssh shell.shore.net'
alias s='screen.new -D -R' # Re-attach to a Gnu/Screen session.
alias sz='sz -uw 2048' # '-u' unlinks file after successful xmission;
# '-w 2048' limits xmit windowsize to 2048 bits.
alias td='nocorrect mkdir /var/tmp/rj'
alias trr=traceroute
alias tree='ls -alsR |less' # Recursively display all
# files in home dir & subdirs.
alias ua=unalias
alias uc=uncompress
alias v=vim
alias vv='v .vimrc'
alias vx='ssh q@xxxxxxx'
alias vs=q@xxxxxxx
alias w='nw -L|m; nw -R|m' # Show who's logged on, p1 at top.
alias ww='nw |sort |m' # Show who's logged on, sorted.
# Show who's online from .friends file:
alias wf='nw | egrep -f .friends |sort |m'
alias wh=weather # Weather for NYC.
alias wj='/users/dman/contrib/rhoosiers |m' # Show who's logged on by host.
# Shell functions
#
# where to look for autoloaded function definitions:
fpath=(/usr/local/libdata/zsh/4.3.4/functions $HOME/.zfunc)
autoload -U promptinit; promptinit # -U = "unique": it tells zsh to keep only
# the first element of identical copies.
autoload -U is-at-least; is-at-least
autoload -U compinit; compinit
autoload -U colors; colors
# red="%{${fg[red]}%}"
# grey="%{${fg[grey]}%}"
# blue="%{${fg[blue]}%}"
autoload -U zmv
zstyle ':completion:*' verbose yes
zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion:*:messages' format '%d'
zstyle ':completion:*:warnings' format 'No matches for: %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' add-space yes
zstyle ':completion:*:default' list-prompt '%S%l %m %p %s'
## add colors to completions:
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
## For maximum completion:
zstyle ':completion:*' completer _complete _list _oldlist _expand _ignored _match _correct _approximate _prefix
## use 'long' to start menu compl. if list is bigger than screen or some number
## to start menu compl. if list has that number of completions (or more):
zstyle ':completion:*' menu select=long
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always
## case-insensitive (uppercase from lowercase) completion
## zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
function precmd {
local exitstatus=$?
psvar[1]=SIG
[[ $exitstatus -ge 128 ]] && psvar[1]=SIG$signals[$exitstatus-127]
# [[ $psvar[1] = SIG ]] && psvar[1]=$exitstatus
# jobs % >& /dev/null && psvar[2]="" || psvar[2]=()
psvar[2]=$#jobstates; [[ $psvar[2] -eq 0 ]] && psvar[2]=()
}
# autoload all shell functions in $fpath:
## [[ To load only those that have the executable bit on (the executable
## bit isn't necessary, but gives you an easy way to stop the autoloading
## of a particular function), add .x just before the :t as in (.x:t) ]]
for dirname in $fpath
do
for files in $dirname/*(:t)
do
autoload $files
done
done
# Set/unset shell options:
setopt always_to_end append_history
setopt auto_cd auto_list
setopt auto_param_slash
setopt auto_pushd auto_remove_slash
setopt auto_resume no_bad_patterN
setopt no_beep bg_nice
setopt brace_ccl cdable_vars
setopt no_clobber complete_in_word
setopt correct correct_all
setopt equals extended_glob
setopt extended_history
setopt glob_complete glob_dots
setopt glob_subst hist_allow_clobber
setopt hist_expire_dups_first
setopt hist_ignore_dups
setopt hist_ignore_space hist_no_store
setopt hist_reduce_blanks hist_verify
setopt interactive_comments no_list_beep
setopt list_types long_list_jobs
setopt no_mail_warning menu_complete
setopt multibyte no_nomatch
setopt numeric_glob_sort path_dirs
setopt prompt_bang prompt_subst
setopt pushd_ignore_dups
setopt pushd_minus pushd_silent
setopt pushd_to_home rc_quotes
setopt rec_exact no_sun_keyboard_hack
unsetopt single_line_zle
##################### END OF FILE ###########################
--
// rj@xxxxxxxxx //
Messages sorted by:
Reverse Date,
Date,
Thread,
Author