Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Tiny problem with a prompt
- X-seq: zsh-users 16165
- From: Tomasz Moskal <ramshackle.industries@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Tiny problem with a prompt
- Date: Sat, 30 Jul 2011 13:57:06 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:from:reply-to:to:date:content-type:x-mailer :content-transfer-encoding:message-id:mime-version; bh=RKXlI7imTk558qAF++OIRTvNSoWo9XTKQ9pPANM4zrg=; b=Cvr0jKaUGj7JUm9G6dxZCDHrcbR+mzOobUUC/7zW7/tjntMIDQaVto540RWCvlbVNj 224RYZPXnkbAsaG+AZSw8Rz88MAjsw66uK6/fmLq7F5IGpYi7BLBV9IqrJA8fQX+snmE qUDjm9AnnbnhfTehsafQLeF1em6r4rShWW934=
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Reply-to: ramshackle.industries@xxxxxxxxx
I am trying to display current directory in different colour based on if
it's writeable or not. What I thought will be simple if...then...else
task has become a really headache. My (simplistic) code is as follows:
prompt_k2_setup() {
pdir() {
if [[ -w $PWD ]]; then
dirp='%3F%1/%3f '
else
dirp='%1F%1/%1f '
fi
}
precmd() { pdir }
PS1="${dirp} "
}
prompt_k2_setup "$@"
It sort off works, but not as I intended it to - for the prompt to show
current directory I need to execute 'prompt k2' each time I change to
different directory.
I am probably missing something painfully obvious but I can't figure it
out. A nudge in the right direction will be greatly appreciated.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author