From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19769 invoked from network); 7 Oct 2007 07:13:20 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 7 Oct 2007 07:13:20 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 56583 invoked from network); 7 Oct 2007 07:13:13 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 7 Oct 2007 07:13:13 -0000 Received: (qmail 20898 invoked by alias); 7 Oct 2007 07:13:04 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11943 Received: (qmail 20880 invoked from network); 7 Oct 2007 07:13:03 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 7 Oct 2007 07:13:03 -0000 Received: (qmail 55357 invoked from network); 7 Oct 2007 07:13:03 -0000 Received: from mail1.panix.com (166.84.1.72) by a.mx.sunsite.dk with SMTP; 7 Oct 2007 07:12:57 -0000 Received: from panix1.panix.com (panix1.panix.com [166.84.1.1]) by mail1.panix.com (Postfix) with ESMTP id 96ACF2940B for ; Sun, 7 Oct 2007 03:12:56 -0400 (EDT) Received: (from rj@localhost) by panix1.panix.com (8.11.6p3/8.8.8/PanixN1.1) id l977CuG06724 for zsh-users@sunsite.dk; Sun, 7 Oct 2007 03:12:56 -0400 (EDT) Date: Sun, 7 Oct 2007 03:12:56 -0400 From: Russell Hoover To: zsh-users@sunsite.dk Subject: Re: sluggish prompt Message-ID: <20071007071256.GA14895@panix.com> Mail-Followup-To: zsh-users@sunsite.dk References: <20071007045049.GA28877@panix.com> <20071007053638.14299.qmail@smasher.org> <20071007061947.GA6554@panix.com> <20071007063359.30913.qmail@smasher.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20071007063359.30913.qmail@smasher.org> X-To-All-My-Friends-In-Domestic-Surveillance: Hi There, Sports Fans! User-Agent: Mutt/1.5.10i On Sun 10/07/07 at 07:33 PM +1300, Atom Smasher 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=3D$? 235 psvar[1]=3DSIG 236 [[ $exitstatus -ge 128 ]] && psvar[1]=3DSIG$signals[$exitstatus= -127] 237 # [[ $psvar[1] =3D SIG ]] && psvar[1]=3D$exitstatus 238 # jobs % >& /dev/null && psvar[2]=3D"" || psvar[2]=3D() 239 psvar[2]=3D$#jobstates; [[ $psvar[2] -eq 0 ]] && psvar[2]=3D() 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 t= he shell itself. umask 077 # Keeps permissions for group and ot= hers off. bindkey -e # Command-line history-events are ob= tained in # emacs-mode, using the up & down ar= row-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 "=1B;" describe-key-briefly bindkey "^X^I" expand-or-complete-prefix #--------------------------------------> backward-delete-to-slash () { local WORDCHARS=3D${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=3D1000 export MAIL=3D$HOME/.maildir/ export MAILCHECK=3D10 # remove duplicate entries from path,cdpath,manpath & fpath: typeset -U path cdpath manpath fpath path=3D( $PATH /usr/local/bin /usr/bin /usr/sbin /usr/local/sbin = /sbin /usr/X11R6/bin /bin ${HOME}/bin ${HOME}/.zfunc /usr/local/contrib/b= in ) # Set up the aliases (I have a lot of 'em): # Display the current directory's 30 largest files, from largest to smalles= t: alias 30=3D'du -a | sort -nr | head -30' alias a=3D'alias |less' # Display all aliases via the ``les= s" pager. alias ap=3Dapropos alias b=3Dbye alias c=3D'clear gls --co=3Dauto -sF' # Clear the screen & list current d= ir at top. alias cal=3Dgcal # Gnu cal is better than cal. alias cdh=3D'cd /htdocs/userdirs/rj/' alias dk=3D'c cl cal' alias cp=3D'nocorrect cp -ip' # No spelling correction on cp; que= ry if overwriting # an existing file; preserve mode, ti= me & flags etc info. alias d=3D'dirs -v' # Display the directory stack. alias ee=3D'exec zsh -l' #alias ss=3D'screen -D -R' alias f=3Dpfinger alias find=3D'gfind |m' alias grep=3D'grep i' # ignore case in both pattern & inp= ut files. alias h=3D'history -fD 1 |less' # Display the command-history stack. alias j=3D'jobs -l' # Display all jobs currently runnin= g. alias _L=3D'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=3D'gls --co=3Dauto -sdF' # File/dir displays, short view (name & block size only): alias lg=3D'gls --co=3Dauto -dsF .*' # Dot-files. alias ls=3D'gls --co=3Dauto -sF' # Regular (non-dot) files. alias ldd=3D'gls --co=3Dauto -adsF *(/)' # Directories (dot & non-dot). alias cl=3D'gls --co=3Dauto -asF' # All files. # File/dir displays, full view (permissions, owner, size, date, name): alias lsd=3D'gls --co=3Dauto -dlF .*' # Dot-files. alias la=3D'gls --co=3Dauto -lF' # Regular (non-dot) files. alias ll=3D'gls --co=3Dauto -adlF *(/)' # All dirs (dot & non-dot). alias lf=3D'gls --co=3Dauto -alFA' # All files. alias lh=3D'lf /htdocs/userdirs/rj/' # List all files in my ~/public_htm= l subdir. alias lff=3D'lf /var/tmp/rj/' # List files in my /tmp dir. alias lft=3D'lf /var/tmp/' alias lss=3D'gls --co=3Dauto -aSlF' # Smallest files & dirs. alias lsb=3D'gls --co=3Dauto -SlF' # Biggest files & dirs. alias lsn=3D'gls --co=3Dauto -tlF' # Newest. alias m=3Dless # Display named file(s) via the les= s pager. alias make=3Dgmake alias ma=3D'most /usr/local/libdata/mutt-1.5.10p1/manual.txt' alias man=3D'man -m $HOME/man' alias mc=3D'nw | egrep "mutt*"' alias md=3D'nocorrect mkdir' # no spelling correction on mkdir. alias mo=3Dmost alias mr=3D'v .muttrc' alias mt=3Dmutt_slang.new alias mz=3D'mt -Z' # Open mutt to 1st mailbox w/new ma= il. alias mv=3D'nocorrect mv -i' # No spelling correction on mv; que= ry if # overwriting an existing file. alias nc=3Dncftp # Rename the current dir to specified name (e.g., to # shorten a long directory name); defined in .zfunc: alias nd=3Dnamedir alias nl=3D'nlast -urj -start=3D * -g' # Show use-pattern chart for name= d user. alias nt=3Dnout alias ping=3D/sbin/ping alias pd=3Dpushd # Put the current dir on the stack & change t= o a new dir. alias po=3Dpopd # Pop a dir off the top of the stack & change= to it. alias ps=3D'ps && pstree -u rj -g 2' alias rd=3Drmdir # Remove named directory. alias rm=3Dsafe-rm # Make rm command safe, with the 'safe-rm' .z= func file. sa() {finger " -bhmp $1@panix.com"} alias sch=3D'most /usr/local/libdata/slrn-0.9.8.0-p1/doc/manual.txt' # Display current settings of all env variables & options: alias set=3D'set | m' # See which staffers are logged in: alias sf=3D'~mikhail/bin/staff -n' alias sl=3D'slrn -n' # Secure-shell login from panix to shore.net: alias sn=3D'ssh shell.shore.net' alias s=3D'screen.new -D -R' # Re-attach to a Gnu/Screen session. alias sz=3D'sz -uw 2048' # '-u' unlinks file after successful xmis= sion; # '-w 2048' limits xmit windowsize to 2048 = bits. alias td=3D'nocorrect mkdir /var/tmp/rj' alias trr=3Dtraceroute alias tree=3D'ls -alsR |less' # Recursively display all # files in home dir & subdirs. alias ua=3Dunalias alias uc=3Duncompress alias v=3Dvim alias vv=3D'v .vimrc' alias vx=3D'ssh q@vex.net' alias vs=3Dq@vex.net alias w=3D'nw -L|m; nw -R|m' # Show who's logged on, p1 at top. alias ww=3D'nw |sort |m' # Show who's logged on, sorted. # Show who's online from .friends file: alias wf=3D'nw | egrep -f .friends |sort |m' alias wh=3Dweather # Weather for NYC. alias wj=3D'/users/dman/contrib/rhoosiers |m' # Show who's logged on= by host. # Shell functions # # where to look for autoloaded function definitions: fpath=3D(/usr/local/libdata/zsh/4.3.4/functions $HOME/.zfunc) autoload -U promptinit; promptinit # -U =3D "unique": it tells zsh t= o 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=3D"%{${fg[red]}%}" # grey=3D"%{${fg[grey]}%}" # blue=3D"%{${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 nu= mber ## to start menu compl. if list has that number of completions (or more): zstyle ':completion:*' menu select=3Dlong 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}=3D{A-Z}' function precmd { local exitstatus=3D$? psvar[1]=3DSIG [[ $exitstatus -ge 128 ]] && psvar[1]=3DSIG$signals[$exitstatus-127] # [[ $psvar[1] =3D SIG ]] && psvar[1]=3D$exitstatus # jobs % >& /dev/null && psvar[2]=3D"" || psvar[2]=3D() psvar[2]=3D$#jobstates; [[ $psvar[2] -eq 0 ]] && psvar[2]=3D() } # 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 ########################### --=20 // rj@panix.com //