zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Marijan Peh <marijan.peh@hi.hinet.hr>, zsh-users <zsh-users@sunsite.dk>
Subject: Re: My zshrc; any sugestions welcome
Date: Mon, 25 Mar 2002 15:46:21 +0000	[thread overview]
Message-ID: <1020325154622.ZM31551@candle.brasslantern.com> (raw)
In-Reply-To: <20020325114508.A723@nymos.home.hr>

On Mar 25, 11:45am, Marijan Peh wrote:
} 
} Any sugestions welcome, thanks.

Oh, what the heck, I've got half an hour to waste.

----------
## [[ ${+*} -eq 0 ]] = if variable is set don't set it anymore
[[ ${+USER} -eq 0 ]] && export USER=$USERNAME

You can write this as

(( ${+USER} )) || export USER=$USERNAME

Or even as

export USER=${USER:-$USERNAME}

----------
        ## display user@host and name of current process in (xterm|rxvt) title
        preexec () {print -Pn "\033]0;%n@%m [$1] %~\007"}

It'd probably be better to use ${${(z)1}[1]} there, rather than $1, if
you want just the command name.  Or even ${${${(z)1}:#*[[:punct:]]*}[1]}
in case the first "word" is an open-paren or something.

----------
        function compstyle { }

You meant `function zstyle { }', I'll bet.  It hasn't been called compstyle
for a while now.

----------
alias x='startx & disown && exit'

You can write that as

alias x='startx &! exit'

so that `disown' can't accidentally disown the wrong job.

----------
[in pskill()]

        kill -9 `print -r $pid`

Any reason why that isn't just `kill -9 $pid'?

----------
## invoke this every time when u change .zshrc to
## recompile it.
src()
{
        ! [ -f ~/.zshrc.zwc ] && zcompile ~/.zshrc
        ! [ -f ~/.zcompdump.zwc ] && zcompile ~/.zcompdump
        autoload zrecompile
        [ -f ~/.zshrc ] && zrecompile ~/.zshrc
        [ -f ~/.zcompdump ] && zrecompile ~/.zcompdump
        [ -f ~/.zshrc.zwc.old ] && rm -f ~/.zshrc.zwc.old
        [ -f ~/.zcompdump.zwc.old ] && rm -f ~/.zcompdump.zwc.old
        source ~/.zshrc
}

You should be able to get rid of those first two zcompile lines; just
change the two zrecompile lines to be:

	[ -f ~/.zshrc ] && zrecompile -p ~/.zshrc
        [ -f ~/.zcompdump ] && zrecompile -p ~/.zcompdump

----------
## restore all .bak files
## call this with something like: restore_bak 'find . -name "*.bak"'
restore_bak ()
{
        foreach f ($argv);
        mv $f ${f%%.bak};
        end
}

No problem with that (portability back to 3.0, etc.), but in 4.0:

autoload -U zmv
zmv '(**/)(*).bak' '$1$2'

----------
[in readme()]

In 4.0 with extendedglob you can write that files assignment as

	files=(./(#i)*(read*me|lue*m(in|)ut)*(ND))

----------
That's all.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


  reply	other threads:[~2002-03-25 15:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-25 10:45 Marijan Peh
2002-03-25 15:46 ` Bart Schaefer [this message]
2002-03-25 16:49   ` Adam Spiers
2002-03-25 17:35     ` Marijan Peh
2002-03-25 16:59   ` Marijan Peh
2002-03-25 19:03     ` Bart Schaefer
2002-03-26  9:38       ` Marijan Peh
2002-03-26 15:11         ` Bart Schaefer
2002-03-26 16:46           ` Marijan Peh
2002-03-26 17:10             ` Bart Schaefer
2002-03-26 17:49               ` Marijan Peh
2002-04-01 10:31               ` Marijan Peh
2002-06-01  3:23                 ` Andy Spiegl
2002-06-01 21:29                   ` Bart Schaefer
2002-03-26  0:06 ` Joakim Ryden
2002-03-26  1:17   ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1020325154622.ZM31551@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=marijan.peh@hi.hinet.hr \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).